microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
397 stars 125 forks source link

Broken syntax highlighting in typescript after type followed by `label:` #977

Closed mbnuqw closed 1 year ago

mbnuqw commented 1 year ago

Type: Bug

  1. Open vscode 1.77.1 or above (the issue was found on 1.77.1 and reproduced on 1.77.3 and insiders build)
  2. Open .ts file:

    function example() {
    // Without label: OK
    let a = 0
    let A: number | undefined
    while (a < 100) {
    const r = Math.random()
    if (r > 0.9) {
      if (r > 0.95) A = 123
      else A = 321
      break
    }
    a++
    }
    
    // With space (or ';'): OK
    let b = 0
    let B: number | undefined
    
    loop1: while (b < 100) {
    const r = Math.random()
    if (r > 0.9) {
      if (r > 0.95) B = 123
      else B = 321
      break loop1
    }
    b++
    }
    
    // Not OK
    let c = 0
    let C: number | undefined
    loop2: while (c < 100) {
    const r = Math.random()
    if (r > 0.9) {
      if (r > 0.95) C = 123
      else C = 321
      break loop2
    }
    b++
    }
    
    let one = 1
    let two = 2
    }
  3. If ts type followed by 'label:' syntax highlighting of the next code is inconsistent

Screenshots

screenshot-2023-04-13 12:38:50 Default Dark theme


VS Code version: Code - Insiders 1.78.0-insider (c9df8ee8e8c316f38dcc75a894ba150024ce3718, 2023-04-13T05:26:48.114Z) OS version: Linux x64 6.2.10-arch1-1 Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz (8 x 1995)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|2, 1, 1| |Memory (System)|11.63GB (5.92GB free)| |Process Argv|--crash-reporter-id fd2f710a-44b8-42b3-be1c-00cd43bf409b| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|i3| |XDG_CURRENT_DESKTOP|i3| |XDG_SESSION_DESKTOP|i3| |XDG_SESSION_TYPE|x11|
Extensions: none
sheetalkamat commented 1 year ago

Seems to be fixed on main