Skip to content

Syntax Highlighting optional class variable in type definition file. #55575

@nickzelei

Description

@nickzelei

Issue Type: Bug

VSCode syntax highlighting breaks when it encounters an optional class level variable in a type definition (.d.ts) file.

The example below is a simplified version of what I was seeing in one of my emitted type definition files.

When pasting this block into a .d.ts file, you should see the variables "private readonly" below where test2?; is declared in the TestClient turn from the expected dark blue to a light blue, or the same color as the variable name. This has reaching affects throughout the file and causes other things below it to be improperly rendered. I've provided the TestClient2 definition to show a simple case of it.

// test.d.ts
export declare class TestClient {
    private readonly test1;
    private readonly test2?;
    private readonly test3;
    private readonly test4;
}

export declare class TestClient2 {
    private readonly test1;
    private readonly test2;
    private readonly test3;
    private readonly test4;
    private readonly test5;
}

VS Code version: Code 1.25.1 (1dfc5e5, 2018-07-11T15:43:53.668Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 x 3592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.94GB (8.78GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions (3)
Extension Author (truncated) Version
tslint eg2 1.0.34
vsliveshare ms- 0.3.504
vscode-icons rob 7.24.0

Metadata

Metadata

Assignees

Labels

grammarSyntax highlighting grammarupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions