Skip to content
  • Milian Wolff's avatar
    WIP: Add support for semantic highlighting in the language server · b54e1356
    Milian Wolff authored and Christoph Cullmann's avatar Christoph Cullmann committed
    See https://github.com/microsoft/vscode-languageserver-node/pull/367
    
    This is mostly a POC at this point. It works for the clangd highlight
    support found in clang 9.0+ - I haven't tested any other
    implementations.
    
    Most notably, this patch will need more work in making the highlight
    attributes configurable. Currently I'm just using random colors
    that show what's possible, but they result in some serious eye cancer.
    To fix this, I believe we finally have to open up more of the
    available schema highlighting information and make it accessible
    through a new interface or similar in KTextEditor. Then we can either
    try to match scope names to KTextEditor attribute names, or better
    yet we expand our highlighting files with something like TextMate
    scopes to allow direct matching.
    
    Furthermore, this patch also needs more work in its handling of
    moving ranges. Currently, it just discards everything and starts
    over whenever we get a new notification but that's not really ideal.
    Most of the time nothing big will have changed, so we should try
    to recycle the previously available ranges instead. Additionally,
    we should consider leveraging the ability to map between versions
    to translate ranges if the document got updated in-between. At the
    minimum, we should discard highlighting requests that don't match
    the current version.
    b54e1356