[PATCH] D77225: [clangd] Support textDocument/semanticTokens/edits

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 09:20:45 PDT 2020


sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, mgrang, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77225

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77225.254226.patch
Type: text/x-patch
Size: 19653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200401/1398f268/attachment-0001.bin>


More information about the cfe-commits mailing list