Skip to content

Broken syntax highlighting #3919

@eregon

Description

@eregon

Description

Ruby LSP Information

VS Code Version

1.107.1

Ruby LSP Extension Version

0.9.33

Ruby LSP Server Version

0.26.5

Ruby LSP Add-ons

Ruby Version

3.4.7

Ruby Version Manager

chruby

Installed Extensions

Click to expand
  • cmake (0.0.17)
  • cmake-tools (1.21.36)
  • code-spell-checker (4.4.0)
  • cpptools (1.29.3)
  • cpptools-extension-pack (1.3.1)
  • cpptools-themes (2.0.0)
  • debugpy (2025.18.0)
  • python (2026.0.0)
  • ruby-lsp (0.9.33)
  • rust-analyzer (0.3.2761)
  • test-adapter-converter (0.2.1)
  • vscode-github-actions (0.30.0)
  • vscode-jsonnet (0.7.2)
  • vscode-pylance (2025.10.4)
  • vscode-test-explorer (2.22.1)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": false,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": false,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "auto"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {},
  "sigOpacityLevel": "1"
}

Expectation

I would expect syntax highlighting to always be 100% correct for ruby-lsp, at least when the code is valid Ruby code, because I'd assume it uses Prism.
In practice I frequently see syntax highlighting break, making me think it might use some regexps instead, which are well known to work poorly for a grammar as complex as Ruby's.

Reproduction steps

Image

(FWIW gist syntax highlighting doesn't break: https://gist.github.com/eregon/7c46aee1400d5228292978512ef49882#file-generate-cext-trampoline-rb-L176)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions