Syntax coloring bug
See original GitHub issueIssue 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:
- 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.
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:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
This is what happens to
///
comments, whilethis
keyword gets a correct coloring.@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.