You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JS/TS language service is quite permissive for JSDoc comment block structure and does not have problems with line breaks and optional leading asterisks (good), but sadly the JavaScript.tmLanguage definitions are more strict and fall back to regular comment block in any sign of irregularity in the structure of the comment. For example simple line break before closing */ of "line" JSDoc comment makes it appear like a normal insignificant comment:
/** @type {string} */vara="OK, highlighted as JSDoc.";/** @type {string}*/varb="ERROR, highlighted like a regular comment.";
See this this abomination of a JSDoc @typedef that is still correctly processed (despite inconsistent usage of leading asterisks and line breaks) yet not highlighted as such. Notice errors on the bottom and the tooltip that shows that all JSDoc blocks are processed:
// @ts-check/** @typedef * { typeof * ABC [ number * ] } * Ch - this - still * works*/// ↑ ERROR, highlighted as a comment, but processedconstABC=/** @type {const} */(["a","b","c"]);/** @type {Ch}*/// ↑ ERROR, highlighted as a comment, but processedvarx='d';/** @type {Ch} */// ↑ OK, highlightedvary='d';
On a personal note, I still do not fully understand why is highlighting done separately from language services. It feels that two parts are doing same work, parsing and tokenizing, but one does it for real and the other just fakes it. Is the Text TextMate grammar processing significantly faster or what is the reason that allows issues such as this one to happen?
VS Code version: Code - Insiders 1.88.0-insider (15a0f3c, 2024-02-29T05:47:41.883Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
Item
Value
CPUs
Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 2112)
TextMate runs on the render thread
which must stay fast
any lag will cause cursor freezing etc
Understood. But still sounds a bit scary: IIUC the "cursor freezing" caveat, the syntax highlighter in the render thread is sorta-kinda synchronous and blocking process, right? What basically means it has even higher priority than keyboard input? If so, it sounds like an odd design choice for software what's primary purpose is to … edit text files by typing or similar user input.
(And yes, I have experienced keyboard lag in VSC, but always thought it is result of certain extension/file combination (humongous markdown with several MD-related extensions, for example) gobbing CPU so much that OS itself runs into problems with HW signals/interrupts, or something, not that VSC waits for information what colour should the last character have.)
Type: Bug
JS/TS language service is quite permissive for JSDoc comment block structure and does not have problems with line breaks and optional leading asterisks (good), but sadly the JavaScript.tmLanguage definitions are more strict and fall back to regular comment block in any sign of irregularity in the structure of the comment. For example simple line break before closing
*/
of "line" JSDoc comment makes it appear like a normal insignificant comment:See this this abomination of a JSDoc
@typedef
that is still correctly processed (despite inconsistent usage of leading asterisks and line breaks) yet not highlighted as such. Notice errors on the bottom and the tooltip that shows that all JSDoc blocks are processed:On a personal note, I still do not fully understand why is highlighting done separately from language services. It feels that two parts are doing same work, parsing and tokenizing, but one does it for real and the other just fakes it. Is the Text TextMate grammar processing significantly faster or what is the reason that allows issues such as this one to happen?
VS Code version: Code - Insiders 1.88.0-insider (15a0f3c, 2024-02-29T05:47:41.883Z)
OS version: Windows_NT x64 10.0.19045
Modes:
System Info
canvas_oop_rasterization: enabled_on
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Extensions (1)
A/B Experiments
The text was updated successfully, but these errors were encountered: