2020-04-01 18:02:28 +08:00
|
|
|
# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s -implicit-check-not=semanticHighlight
|
|
|
|
# Send capabilities for both Theia semanticHighlight & standard semanticTokens.
|
2021-01-28 08:16:47 +08:00
|
|
|
# clangd should not use/acknowledge the Theia protocol.
|
2020-04-01 18:02:28 +08:00
|
|
|
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"capabilities":{"textDocument":{
|
|
|
|
"semanticHighlightingCapabilities":{"semanticHighlighting":true},
|
|
|
|
"semanticTokens":{"dynamicRegistration":true}
|
|
|
|
}}}}
|
2020-03-24 09:24:47 +08:00
|
|
|
---
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
|
|
|
|
"uri": "test:///foo.cpp",
|
|
|
|
"languageId": "cpp",
|
|
|
|
"text": "int x = 2;"
|
|
|
|
}}}
|
2020-03-24 09:24:47 +08:00
|
|
|
---
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
# Non-incremental token request.
|
2020-07-10 22:08:14 +08:00
|
|
|
{"jsonrpc":"2.0","id":1,"method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"test:///foo.cpp"}}}
|
2020-03-24 09:24:47 +08:00
|
|
|
# CHECK: "id": 1,
|
|
|
|
# CHECK-NEXT: "jsonrpc": "2.0",
|
|
|
|
# CHECK-NEXT: "result": {
|
|
|
|
# CHECK-NEXT: "data": [
|
2021-01-30 06:18:34 +08:00
|
|
|
# First line, char 5, variable, declaration+globalScope
|
2020-03-24 09:24:47 +08:00
|
|
|
# CHECK-NEXT: 0,
|
|
|
|
# CHECK-NEXT: 4,
|
|
|
|
# CHECK-NEXT: 1,
|
|
|
|
# CHECK-NEXT: 0,
|
2021-01-30 08:12:36 +08:00
|
|
|
# CHECK-NEXT: 1025
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
# CHECK-NEXT: ],
|
|
|
|
# CHECK-NEXT: "resultId": "1"
|
2020-03-24 09:24:47 +08:00
|
|
|
# CHECK-NEXT: }
|
|
|
|
---
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{
|
|
|
|
"textDocument": {"uri":"test:///foo.cpp","version":2},
|
|
|
|
"contentChanges":[{"text":"int x = 2;\nint y = 3;"}]
|
|
|
|
}}
|
|
|
|
---
|
|
|
|
# Incremental token request, based on previous response.
|
2020-07-10 22:08:14 +08:00
|
|
|
{"jsonrpc":"2.0","id":2,"method":"textDocument/semanticTokens/full/delta","params":{
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
"textDocument": {"uri":"test:///foo.cpp"},
|
|
|
|
"previousResultId": "1"
|
|
|
|
}}
|
|
|
|
# CHECK: "id": 2,
|
|
|
|
# CHECK-NEXT: "jsonrpc": "2.0",
|
|
|
|
# CHECK-NEXT: "result": {
|
|
|
|
# CHECK-NEXT: "edits": [
|
|
|
|
# CHECK-NEXT: {
|
|
|
|
# CHECK-NEXT: "data": [
|
2021-01-30 06:18:34 +08:00
|
|
|
# Next line, char 5, variable, declaration+globalScope
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
# CHECK-NEXT: 1,
|
|
|
|
# CHECK-NEXT: 4,
|
|
|
|
# CHECK-NEXT: 1,
|
|
|
|
# CHECK-NEXT: 0,
|
2021-01-30 08:12:36 +08:00
|
|
|
# CHECK-NEXT: 1025
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
# CHECK-NEXT: ],
|
|
|
|
# Inserted at position 1
|
|
|
|
# CHECK-NEXT: "deleteCount": 0,
|
|
|
|
# CHECK-NEXT: "start": 5
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ],
|
|
|
|
# CHECK-NEXT: "resultId": "2"
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
---
|
|
|
|
# Incremental token request with incorrect baseline => full tokens list.
|
2020-07-10 22:08:14 +08:00
|
|
|
{"jsonrpc":"2.0","id":2,"method":"textDocument/semanticTokens/full/delta","params":{
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
"textDocument": {"uri":"test:///foo.cpp"},
|
|
|
|
"previousResultId": "bogus"
|
|
|
|
}}
|
|
|
|
# CHECK: "id": 2,
|
|
|
|
# CHECK-NEXT: "jsonrpc": "2.0",
|
|
|
|
# CHECK-NEXT: "result": {
|
|
|
|
# CHECK-NEXT: "data": [
|
|
|
|
# CHECK-NEXT: 0,
|
|
|
|
# CHECK-NEXT: 4,
|
|
|
|
# CHECK-NEXT: 1,
|
|
|
|
# CHECK-NEXT: 0,
|
2021-01-30 08:12:36 +08:00
|
|
|
# CHECK-NEXT: 1025,
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
# CHECK-NEXT: 1,
|
|
|
|
# CHECK-NEXT: 4,
|
|
|
|
# CHECK-NEXT: 1,
|
|
|
|
# CHECK-NEXT: 0,
|
2021-01-30 08:12:36 +08:00
|
|
|
# CHECK-NEXT: 1025
|
[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
2020-04-01 22:21:44 +08:00
|
|
|
# CHECK-NEXT: ],
|
|
|
|
# CHECK-NEXT: "resultId": "3"
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
---
|
|
|
|
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
|
2020-03-24 09:24:47 +08:00
|
|
|
---
|
|
|
|
{"jsonrpc":"2.0","method":"exit"}
|