nvarner / typst-lsp

A brand-new language server for Typst, plus a VS Code extension
MIT License
1.19k stars 77 forks source link

Mathematics highlighting overrides parenthesis coloring #99

Closed Trebor-Huang closed 1 year ago

Trebor-Huang commented 1 year ago

Issue

Currently the math coloring (which seems to be monochrome) overrides the default parenthesis pair coloring, presumably because they are all counted as String. I'm fine with limited highlighting functionalities, but it is very difficult to work with if even the built-in highlighting is turned off.

Enivex commented 1 year ago

Is the issue here that "standard token type" for math seems to be "String"?

Outside of math it's "Other", and parentheses seem to work fine

Enivex commented 1 year ago

As a workaround I replaced the existing part(s) of typst.tmLanguage.json with

{
    "name": "other.math.typst",
    "begin": "\\$",
    "end": "\\$",
    "captures": {
        "0": {
            "name": "punctuation.definition.other.math.typst"
        }
    }
},

which while not perfect at least enables colored parentheses.

nvarner commented 1 year ago

With the integration of semantic highlighting into v0.6, this should be fixed. Please reopen if not.