Skip to content

Conversation

@clysto
Copy link

@clysto clysto commented Nov 25, 2025

This PR adds a TextMate grammar to the Verible VS Code extension to provide proper syntax highlighting for SystemVerilog files.
The grammar is adapted from vscode-verilog-hdl-support, with minimal adjustments to integrate cleanly into the existing extension structure.

Before this change, the extension lacked built-in syntax highlighting and relied solely on LSP diagnostics. With the added grammar, users now get immediate and consistent token coloring without installing an additional extension.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 25, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: clysto / name: Yachen Mao (f6da265)

@clysto
Copy link
Author

clysto commented Dec 17, 2025

Any suggestions?

@hzeller
Copy link
Collaborator

hzeller commented Dec 21, 2025

I like the idea, but I am wondering how it interferes is someone already has a system verilog plugin installed ? If so, their coloring should precedence as the Verible plugin would only do that as secondary functionality.
Do you know how these things are configured ?

@clysto
Copy link
Author

clysto commented Dec 22, 2025

Multiple extensions can contribute grammars. If several installed extensions provide a TextMate grammar for the same language (e.g., SystemVerilog), VS Code will pick one based on the language id and the extension’s contributions. There isn’t a user-visible “precedence” setting exposed in the UI—you normally see one set of highlight rules applied. Extensions can override or replace existing grammars by contributing a grammar under the same language id. 

If someone already has a SystemVerilog plugin with its own grammar installed, VS Code will pick one grammar to apply. There isn’t a native per-extension “precedence” setting for TextMate grammars; the editor resolves this based on the active language id/grammar contributions. If desired, users can override the grammar selection manually in the editor for their workspace.

@hzeller
Copy link
Collaborator

hzeller commented Dec 22, 2025

mmh, this does sound it can result in surprising effects for users (in particular existing users of the Verible plug-in that I expect typically already have another plug-in installed for the syntax-highlighting).

Could there be a configuration option that we can offer in the Verible plug-in to use or not use the grammar ? The VSCode options pane allows for configuration options that are provided in the package.json and I wonder if we can have a 'checkbox' configured in the plugin json to then toggle if the grammar is active ? (we can have it default on, but at least it would allow people to switch off things)

@RedCMD
Copy link

RedCMD commented Dec 22, 2025

VSCode provides no way to configure TextMate grammars
the only options are to disable/enable the extension
and staticly via the alphabetical ordering of extension names publisher.name
Z is higher than A

you could add a different language id
to separate them
but then you'll have separate languages

users of the Verible plug-in that I expect typically already have another plug-in installed for the syntax-highlighting

are the grammars not the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants