fix(editor): syntax-highlight SystemVerilog/Verilog files (#5427)

Map .sv/.svh to the 'systemverilog' language id and .v/.vh to 'verilog' in language-detect, so Monaco's bundled SystemVerilog/Verilog Monarch tokenizers (already registered in editor.main) are applied. Previously these files fell through to plaintext. Refs #5414.

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
This commit is contained in:
Anddy Sahir Agudelo 2026-06-16 02:00:59 -05:00 committed by GitHub
parent 1f80d8bcd0
commit 2c828f1841
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -29,4 +29,12 @@ describe('detectLanguage', () => {
expect(detectLanguage('scripts/setup.bat')).toBe('bat')
expect(detectLanguage('C:\\repo\\scripts\\bootstrap.CMD')).toBe('bat')
})
it('maps SystemVerilog and Verilog files to their Monaco language ids', () => {
expect(detectLanguage('rtl/cpu.sv')).toBe('systemverilog')
expect(detectLanguage('rtl/pkg.svh')).toBe('systemverilog')
expect(detectLanguage('rtl/alu.v')).toBe('verilog')
expect(detectLanguage('rtl/defs.vh')).toBe('verilog')
expect(detectLanguage('C:\\rtl\\TOP.SV')).toBe('systemverilog')
})
})

View File

@ -80,6 +80,10 @@ const EXT_TO_LANGUAGE: Record<string, string> = {
'.vue': 'vue',
'.svelte': 'svelte',
'.astro': 'astro',
'.sv': 'systemverilog',
'.svh': 'systemverilog',
'.v': 'verilog',
'.vh': 'verilog',
'.nim': 'nim',
'.nims': 'nim',
'.nimble': 'nim',