microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.42k stars 28.95k forks source link

[Bug] No syntax highlighting for `.cjs` `.vue` files in the search editor #185430

Open wenfangdu opened 1 year ago

wenfangdu commented 1 year ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce: image image .js file has syntax highlighting: image

andreamah commented 1 year ago

I believe that the syntax highlighting comes from whether you have that language extension installed. Is there syntax highlighting when you open a .vue or .cjs file?

wenfangdu commented 1 year ago

@andreamah .vue highlighting requires an extension and I've installed it, .cjs highlighting is built-in and doesn't require extensions, both are highlighted when you open them but are not highlighted in the search editor.

andreamah commented 1 year ago

Just checked, and it looks like syntax highlighting is dictated using a fixed set of mappings. I could probably add cjs since it's built-in but we only support built-in languages for syntax highlighting for this; sorry about that!

wenfangdu commented 1 year ago

@andreamah You mean even if I installed the syntax highlighting extension for .vue files, they still won't work in the search editor? That seems like a bug.

andreamah commented 1 year ago

You can create a feature request to support non-default syntax highlighting for the search editor and we can put it as a backlog candidate to see whether enough people would want to see it.

Unfortunately, using a fixed list is intentional, as the grammar for the search editor cannot be dynamically changed based on which extensions are installed. We would need to do a fairly large restructuring (integrate search editor highlighting into core) to get this working.

wenfangdu commented 1 year ago

@andreamah Feature request opened here: https://github.com/microsoft/vscode/issues/185717