Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-08-23 20:09:59 +0000
committerNathan Ridge2018-12-01 22:49:05 +0000
commit8c78a241d51511d5f844dd4efa30f57171c580b0 (patch)
tree0ee7878154d87187ac65177bdb01053742240166 /lsp/org.eclipse.cdt.lsp.core.tests
parentf5322a32d3e0323aebcdde8af546e11fd6eec9a3 (diff)
downloadorg.eclipse.cdt-8c78a241d51511d5f844dd4efa30f57171c580b0.tar.gz
org.eclipse.cdt-8c78a241d51511d5f844dd4efa30f57171c580b0.tar.xz
org.eclipse.cdt-8c78a241d51511d5f844dd4efa30f57171c580b0.zip
[LSP4E] Support separate semantic highlightings for declarations of functions, methods, and local variables
Diffstat (limited to 'lsp/org.eclipse.cdt.lsp.core.tests')
-rw-r--r--lsp/org.eclipse.cdt.lsp.core.tests/src/org/eclipse/cdt/lsp/core/tests/cquery/CqueryJsonParseTest.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/lsp/org.eclipse.cdt.lsp.core.tests/src/org/eclipse/cdt/lsp/core/tests/cquery/CqueryJsonParseTest.java b/lsp/org.eclipse.cdt.lsp.core.tests/src/org/eclipse/cdt/lsp/core/tests/cquery/CqueryJsonParseTest.java
index 2d9b0ef08fd..e891b9c8acf 100644
--- a/lsp/org.eclipse.cdt.lsp.core.tests/src/org/eclipse/cdt/lsp/core/tests/cquery/CqueryJsonParseTest.java
+++ b/lsp/org.eclipse.cdt.lsp.core.tests/src/org/eclipse/cdt/lsp/core/tests/cquery/CqueryJsonParseTest.java
@@ -23,6 +23,7 @@ import org.eclipse.cdt.lsp.core.cquery.ExtendedSymbolKindType;
import org.eclipse.cdt.lsp.core.cquery.HighlightSymbol;
import org.eclipse.cdt.lsp.core.cquery.IndexingProgressStats;
import org.eclipse.cdt.lsp.core.cquery.StorageClass;
+import org.eclipse.cdt.lsp.core.cquery.SymbolRole;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.jsonrpc.json.JsonRpcMethod;
@@ -84,9 +85,9 @@ public class CqueryJsonParseTest {
public void testPublishSemanticHighlighting() {
String json = "{\"jsonrpc\": \"2.0\",\"method\": \"$cquery/publishSemanticHighlighting\"," //$NON-NLS-1$
+ "\"params\": {\"uri\": \"file:///home/foobar.cpp\",\"symbols\": [{\"stableId\": 21," //$NON-NLS-1$
- + "\"parentKind\": 8,\"kind\": 0,\"storage\": 3,\"ranges\": [{\"start\": {\"line\": 41," //$NON-NLS-1$
+ + "\"parentKind\": 8,\"kind\": 0,\"storage\": 3,\"role\": 1,\"ranges\": [{\"start\": {\"line\": 41," //$NON-NLS-1$
+ "\"character\": 1},\"end\": {\"line\": 41,\"character\": 5}}]},{\"stableId\": 19," //$NON-NLS-1$
- + "\"parentKind\": 12,\"kind\": 253,\"storage\": 5,\"ranges\": [{\"start\": {\"line\": 39," //$NON-NLS-1$
+ + "\"parentKind\": 12,\"kind\": 253,\"storage\": 5,\"role\": 4,\"ranges\": [{\"start\": {\"line\": 39," //$NON-NLS-1$
+ "\"character\": 9},\"end\": {\"line\": 39,\"character\": 10}}]}]}}"; //$NON-NLS-1$
URI uri = URI.create("file:///home/foobar.cpp"); //$NON-NLS-1$
@@ -106,8 +107,10 @@ public class CqueryJsonParseTest {
ExtendedSymbolKindType kind2 = new ExtendedSymbolKindType(253);
StorageClass storage1 = StorageClass.Static;
StorageClass storage2 = StorageClass.Auto;
- HighlightSymbol symbol1 = new HighlightSymbol(21, parentKind1, kind1, storage1, ranges1);
- HighlightSymbol symbol2 = new HighlightSymbol(19, parentKind2, kind2, storage2, ranges2);
+ int role1 = SymbolRole.Declaration;
+ int role2 = SymbolRole.Reference;
+ HighlightSymbol symbol1 = new HighlightSymbol(21, parentKind1, kind1, storage1, role1, ranges1);
+ HighlightSymbol symbol2 = new HighlightSymbol(19, parentKind2, kind2, storage2, role2, ranges2);
List<HighlightSymbol> symbols = new ArrayList<>();
symbols.add(symbol1);
symbols.add(symbol2);

Back to the top