This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add SemanticRanges to Clangd server.
ClosedPublic

Authored by usaxena95 on Sep 17 2019, 2:52 AM.

Details

Summary

Adds Semantic Ranges capabilities to Clangd server.
Also adds tests for running it via clangd server.

This differs from the LSP spec as the spec needs this to be evaluated on multiple pos and the expected output is a list of list of semantic ranges.
This is majorly for multi cursor purpose and assuming this is a rare thing, we don't want to optimize and make things complicated just for this.
This should be done at the LSP level by queuing one request per pos in the input.

LSP Spec:
https://github.com/microsoft/language-server-protocol/blob/dbaeumer/3.15/specification.md#textDocument_selectionRange

Event Timeline

usaxena95 created this revision.Sep 17 2019, 2:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2019, 2:52 AM
usaxena95 edited the summary of this revision. (Show Details)Sep 17 2019, 2:54 AM
hokein accepted this revision.Sep 17 2019, 3:14 AM

Thanks! looks good. I think next step is to implement it in the LSP layer.

clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
161

nit: we can remove the annotation since we don't use it in the test, just

FS.Files[FooH] = R"cpp(...)cpp";
163

nit: we can get rid of this statement as well.

This revision is now accepted and ready to land.Sep 17 2019, 3:14 AM
hokein retitled this revision from Add SemanticRanges to Clangd server. to [clangd] Add SemanticRanges to Clangd server..Sep 17 2019, 3:15 AM
usaxena95 updated this revision to Diff 220465.Sep 17 2019, 3:21 AM
usaxena95 marked 2 inline comments as done.

Addressed comments.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2019, 3:27 AM