[all-commits] [llvm/llvm-project] 9e3063: [clangd] Support textDocument/semanticTokens/edits

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Apr 2 08:40:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e3063eaceec5054684a77acf5281772df2a7f73
      https://github.com/llvm/llvm-project/commit/9e3063eaceec5054684a77acf5281772df2a7f73
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-04-02 (Thu, 02 Apr 2020)

  Changed paths:
    M clang-tools-extra/clangd/ClangdLSPServer.cpp
    M clang-tools-extra/clangd/ClangdLSPServer.h
    M clang-tools-extra/clangd/Protocol.cpp
    M clang-tools-extra/clangd/Protocol.h
    M clang-tools-extra/clangd/SemanticHighlighting.cpp
    M clang-tools-extra/clangd/SemanticHighlighting.h
    M clang-tools-extra/clangd/test/initialize-params.test
    M clang-tools-extra/clangd/test/semantic-tokens.test
    M clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

  Log Message:
  -----------
  [clangd] Support textDocument/semanticTokens/edits

Summary:
This returns incremental highlights as a set of edits against the
previous highlights.

Server-side, we compute the full set of highlights, this just saves
wire-format size.

For now, the diff used is trivial: everything from the first change to
the last change is sent as a single edit.

The wire format is grungy - the replacement offset/length refer to
positions in the encoded array instead of the logical list of tokens.
We use token-oriented structs and translating to LSP forms when serializing.
This departs from LSP (but is consistent with semanticTokens today).

Tested in VSCode insiders (with a patched client to enable experimental
features).

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77225




More information about the All-commits mailing list