question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax coloring bug

See original GitHub issue

Issue Type: Bug

Hello, the syntax color for C# has a small bug in identifying the keyword “this” as a left hand side expression. This bug was found when coding C# scripts for Unity.

Required extensions: Unity snippets and documentation

Reproduction:

  1. Copy paste this code into a Unity project script folder. You need to have Unity generate a .csproj file for VS Code to parse successfully.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// Component that connects the COR skinning algorithm to the Unity engine
/// </summary>
[RequireComponent(typeof(Animator))]
public class AnimatorCOR : MonoBehaviour
{

    public SkinnedMeshRenderer[] skinnedMeshRenderers;

    public Transform rootBone;
    private GameObject skeletonRoot;

    // Start is called before the first frame update
    void Start()
    {
        // build the skeleton
        int boneCount;
        (this.skeletonRoot, boneCount) = BuildSkeleton(rootBone, 0); // <------ this line
        Debug.Log($"The mesh has {boneCount} bones explored by the skeleton builder"); 
    }

    private (GameObject, int) BuildSkeleton(Transform bone, int index)
    { return (new GameObject(), 0); }
}

Expected behavior: On the screenshot, the keyword “this” is not colored and is gray. Note that even the syntax coloring on the GitHub isn’t identifying “this”. Maybe it is supposed to be gray? Yet there are places “this” is blue.

I simplified the code snippet above by replacing SkeletalRigNode by GameObject. It is a user defined class and GameObject should yield the same behavior.

image

Extension version: 1.23.6 VS Code version: Code 1.51.1 (e5a624b788d92b8d34d1392e4c4d9789406efe8f, 2020-11-10T23:34:32.027Z) OS version: Windows_NT x64 10.0.19041

System Info
Item Value
CPUs Intel® Celeron® CPU N3060 @ 1.60GHz (2 x 1600)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: disabled_off
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.85GB (1.61GB free)
Process Argv C:/Users/Song/Documents/UDEM/ift6113/project/skinning_cor/Skinning with COR -g C:\Users\Song\Documents\UDEM\ift6113\project\skinning_cor\Skinning with COR\Assets\Scripts\SkinnedMesh.cs:1:0 --crash-reporter-id 07503e60-69c5-4288-acbc-bf9a6f6262c3
Screen Reader no
VM 0%

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
XsongyangXcommented, Dec 8, 2020

This is what happens to /// comments, while this keyword gets a correct coloring. image

0reactions
JoeRobichcommented, Dec 8, 2020

@XsongyangX Can you share screenshots of the highlighting that isn’t working the way you expect? If you are using C# semantic colors, we recommend the included Visual Studio 2019 Dark/Light themes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Small but strange syntax highlighting bug (or feature)?
0. OS Version: Ubuntu 16.04. When you open a file, the syntax highlighting is okay: Screenshot from 2020-02-08 14 ...
Read more >
Xcode loses syntax highlighting wh… | Apple Developer Forums
I have had an issue with syntax highlighting/coloring since Xcode 9.3.0. I work in multiple tabs a lot. Sometimes I have the same...
Read more >
486992 – Java Syntax coloring can't save - Bugs - Eclipse
I unchecked Bold checkbox of Prefrences->Java->Editor->Syntax coloring, and click Apply. After restarted Eclipse the checkbox is checked automatically.
Read more >
Visual studio showing wrong syntax highlighting color ...
I have DARK mode enabled on my visual studio IDE and on windows 10 configurations. To reproduce the "bug ...
Read more >
C# syntax highlighting not working - Visual Studio Feedback
Since upgrading to VS 2019 I have been having syntax highlighting issues. Freshly cloned projects look correct, ... Hope they fix this bug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found