Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Khurana2018-06-25 06:46:13 +0000
committerNathan Ridge2018-06-25 06:59:27 +0000
commit527c2d64a5cf2917a2a687ed7b68ea3d47d5e4c4 (patch)
treea69e0cdfe603391bbbb8dde375d691ac4c5192a4 /lsp4e-cpp
parent48838766e9eb7cac54190a7c3109689fb0925f23 (diff)
downloadorg.eclipse.cdt-527c2d64a5cf2917a2a687ed7b68ea3d47d5e4c4.tar.gz
org.eclipse.cdt-527c2d64a5cf2917a2a687ed7b68ea3d47d5e4c4.tar.xz
org.eclipse.cdt-527c2d64a5cf2917a2a687ed7b68ea3d47d5e4c4.zip
Bug 535629. Add empty implementation for unsupported CQuery notifications
Change-Id: Ic1c91acd00f6d3aca64c82d4abffd8c41396b15c Signed-off-by: Manish Khurana <mkmanishkhurana98@gmail.com>
Diffstat (limited to 'lsp4e-cpp')
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.classpath7
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.project28
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/META-INF/MANIFEST.MF13
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/build.properties4
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/src/org/eclipse/lsp4e/cpp/language/tests/cquery/CqueryJsonParseTest.java114
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/META-INF/MANIFEST.MF6
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/plugin.xml3
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/Server2ClientProtocolExtension.java34
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CqueryInactiveRegions.java31
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySemanticHighlights.java30
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySymbolKind.java40
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/ExtendedSymbolKindType.java65
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/HighlightSymbol.java50
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/IndexingProgressStats.java52
-rw-r--r--lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/StorageClass.java31
16 files changed, 512 insertions, 3 deletions
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.classpath b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.project b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.project
new file mode 100644
index 00000000000..40593687885
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.lsp4e.cpp.language.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.settings/org.eclipse.jdt.core.prefs b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/META-INF/MANIFEST.MF b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..6df0060ac65
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: "Tests for LSP4E C/C++ Support"
+Bundle-SymbolicName: org.eclipse.lsp4e.cpp.language.tests
+Bundle-Version: 1.0.0.qualifier
+Automatic-Module-Name: org.eclipse.lsp4e.cpp.language.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.lsp4e,
+ org.eclipse.lsp4j,
+ org.eclipse.lsp4j.jsonrpc,
+ org.eclipse.lsp4e.cpp.language,
+ com.google.gson;bundle-version="2.8.2",
+ org.junit
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/build.properties b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/src/org/eclipse/lsp4e/cpp/language/tests/cquery/CqueryJsonParseTest.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/src/org/eclipse/lsp4e/cpp/language/tests/cquery/CqueryJsonParseTest.java
new file mode 100644
index 00000000000..f0abdb53268
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language.tests/src/org/eclipse/lsp4e/cpp/language/tests/cquery/CqueryJsonParseTest.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.tests.cquery;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.lsp4e.cpp.language.Server2ClientProtocolExtension;
+import org.eclipse.lsp4e.cpp.language.cquery.*;
+import org.eclipse.lsp4j.Position;
+import org.eclipse.lsp4j.Range;
+import org.eclipse.lsp4j.jsonrpc.json.JsonRpcMethod;
+import org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler;
+import org.eclipse.lsp4j.jsonrpc.messages.*;
+import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CqueryJsonParseTest {
+ Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(Server2ClientProtocolExtension.class);
+ private MessageJsonHandler jsonHandler = new MessageJsonHandler(methods);
+
+ private void assertParse(final String json, final NotificationMessage expectedResult) {
+ Assert.assertEquals(expectedResult.toString(), jsonHandler.parseMessage(json).toString());
+ }
+
+ @Test
+ public void testProgress(){
+ String json = "{\"jsonrpc\": \"2.0\",\"method\": \"$cquery/progress\",\"params\": {" //$NON-NLS-1$
+ + "\"indexRequestCount\": 4,\"doIdMapCount\": 5,\"loadPreviousIndexCount\": 6," //$NON-NLS-1$
+ + "\"onIdMappedCount\": 7,\"onIndexedCount\": 8,\"activeThreads\": 9}}"; //$NON-NLS-1$
+
+ IndexingProgressStats expectedIndex = new IndexingProgressStats(4, 5, 6, 7, 8, 9);
+ NotificationMessage expectedResult = new NotificationMessage();
+ expectedResult.setJsonrpc("2.0"); //$NON-NLS-1$
+ expectedResult.setMethod("$cquery/progress"); //$NON-NLS-1$
+ expectedResult.setParams(expectedIndex);
+ assertParse(json, expectedResult);
+ }
+
+ @Test
+ public void testSetInactiveRegions() {
+ String json = "{\"jsonrpc\": \"2.0\",\"method\": \"$cquery/setInactiveRegions\",\"params\": {" //$NON-NLS-1$
+ + "\"uri\": \"file:///home/foobar.cpp\",\"inactiveRegions\": [{\"start\": {\"line\": " //$NON-NLS-1$
+ + "25,\"character\": 4},\"end\": {\"line\": 25,\"character\": 10}},{\"start\": {\"line\"" //$NON-NLS-1$
+ + ": 35,\"character\": 8},\"end\": {\"line\": 35,\"character\": 15}}]}}"; //$NON-NLS-1$
+
+ URI uri = URI.create("file:///home/foobar.cpp"); //$NON-NLS-1$
+ Position pos1 = new Position(25, 4);
+ Position pos2 = new Position(25, 10);
+ Position pos3 = new Position(35, 8);
+ Position pos4 = new Position(35, 15);
+ Range range1 = new Range(pos1,pos2);
+ Range range2 = new Range(pos3,pos4);
+ List<Range> regions = new ArrayList<>();
+ regions.add(range1);
+ regions.add(range2);
+ CqueryInactiveRegions expectedRegions = new CqueryInactiveRegions(uri, regions);
+
+ NotificationMessage expectedResult = new NotificationMessage();
+ expectedResult.setJsonrpc("2.0"); //$NON-NLS-1$
+ expectedResult.setMethod("$cquery/setInactiveRegions"); //$NON-NLS-1$
+ expectedResult.setParams(expectedRegions);
+ assertParse(json, expectedResult);
+ }
+
+ @Test
+ 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$
+ + "\"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$
+ + "\"character\": 9},\"end\": {\"line\": 39,\"character\": 10}}]}]}}"; //$NON-NLS-1$
+
+ URI uri = URI.create("file:///home/foobar.cpp"); //$NON-NLS-1$
+ Position pos1 = new Position(41, 1);
+ Position pos2 = new Position(41, 5);
+ Position pos3 = new Position(39, 9);
+ Position pos4 = new Position(39, 10);
+ Range range1 = new Range(pos1,pos2);
+ Range range2 = new Range(pos3,pos4);
+ List<Range> ranges1 = new ArrayList<>();
+ List<Range> ranges2 = new ArrayList<>();
+ ranges1.add(range1);
+ ranges2.add(range2);
+ ExtendedSymbolKindType parentKind1 = new ExtendedSymbolKindType(8);
+ ExtendedSymbolKindType parentKind2 = new ExtendedSymbolKindType(12);
+ ExtendedSymbolKindType kind1 = new ExtendedSymbolKindType(0);
+ 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);
+ List<HighlightSymbol> symbols = new ArrayList<>();
+ symbols.add(symbol1);
+ symbols.add(symbol2);
+ CquerySemanticHighlights exceptedHighlights = new CquerySemanticHighlights(uri, symbols);
+
+ NotificationMessage expectedResult = new NotificationMessage();
+ expectedResult.setJsonrpc("2.0"); //$NON-NLS-1$
+ expectedResult.setMethod("$cquery/publishSemanticHighlighting"); //$NON-NLS-1$
+ expectedResult.setParams(exceptedHighlights);
+ assertParse(json, expectedResult);
+ }
+}
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/META-INF/MANIFEST.MF b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/META-INF/MANIFEST.MF
index d581d5016fc..eda7dd83d96 100644
--- a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/META-INF/MANIFEST.MF
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/META-INF/MANIFEST.MF
@@ -17,8 +17,10 @@ Require-Bundle: org.apache.commons.io,
org.eclipse.core.commands,
org.eclipse.core.expressions,
org.eclipse.core.resources,
- com.google.gson;bundle-version="2.8.2"
+ com.google.gson;bundle-version="2.8.2",
+ org.eclipse.lsp4j.jsonrpc
Bundle-Vendor: %Bundle-Vendor
-Export-Package: org.eclipse.lsp4e.cpp.language
+Export-Package: org.eclipse.lsp4e.cpp.language,
+ org.eclipse.lsp4e.cpp.language.cquery
Bundle-Activator: org.eclipse.lsp4e.cpp.language.Activator
Bundle-ActivationPolicy: lazy
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/plugin.xml b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/plugin.xml
index d0370eae59d..5e1621c5a56 100644
--- a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/plugin.xml
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/plugin.xml
@@ -16,7 +16,8 @@
<server
class="org.eclipse.lsp4e.cpp.language.CPPStreamConnectionProvider"
id="org.eclipse.lsp4e.languages.cpp"
- label="%server.label">
+ label="%server.label"
+ clientImpl="org.eclipse.lsp4e.cpp.language.Server2ClientProtocolExtension" >
</server>
<contentTypeMapping
contentType="org.eclipse.lsp4e.languages.cpp"
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/Server2ClientProtocolExtension.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/Server2ClientProtocolExtension.java
new file mode 100644
index 00000000000..80550f9fc37
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/Server2ClientProtocolExtension.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language;
+
+import org.eclipse.lsp4e.LanguageClientImpl;
+import org.eclipse.lsp4e.cpp.language.cquery.CqueryInactiveRegions;
+import org.eclipse.lsp4e.cpp.language.cquery.CquerySemanticHighlights;
+import org.eclipse.lsp4e.cpp.language.cquery.IndexingProgressStats;
+import org.eclipse.lsp4j.jsonrpc.services.JsonNotification;
+
+public class Server2ClientProtocolExtension extends LanguageClientImpl {
+
+ @JsonNotification("$cquery/progress")
+ public final void indexingProgress(IndexingProgressStats stats) {
+ // TODO: Implement
+ }
+
+ @JsonNotification("$cquery/setInactiveRegions")
+ public final void setInactiveRegions(CqueryInactiveRegions regions) {
+ // TODO: Implement
+ }
+
+
+ @JsonNotification("$cquery/publishSemanticHighlighting")
+ public final void semanticHighlights(CquerySemanticHighlights highlights) {
+ // TODO: Implement
+ }
+}
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CqueryInactiveRegions.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CqueryInactiveRegions.java
new file mode 100644
index 00000000000..526179749c3
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CqueryInactiveRegions.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+import java.net.URI;
+import java.util.List;
+
+import org.eclipse.lsp4j.Range;
+
+public class CqueryInactiveRegions {
+ private URI uri;
+ private List<Range> inactiveRegions;
+
+ public CqueryInactiveRegions(URI uri, List<Range> inactiveRegions) {
+ this.uri = uri;
+ this.inactiveRegions = inactiveRegions;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+ public List<Range> getInactiveRegions() {
+ return inactiveRegions;
+ }
+}
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySemanticHighlights.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySemanticHighlights.java
new file mode 100644
index 00000000000..2917e9551cd
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySemanticHighlights.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+import java.net.URI;
+import java.util.List;
+
+public class CquerySemanticHighlights {
+ private URI uri;
+ private List<HighlightSymbol> symbols;
+
+ public URI getUri() {
+ return uri;
+ }
+
+ public List<HighlightSymbol> getSymbols() {
+ return symbols;
+ }
+
+ public CquerySemanticHighlights(URI uri, List<HighlightSymbol> symbols) {
+ this.uri = uri;
+ this.symbols = symbols;
+ }
+}
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySymbolKind.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySymbolKind.java
new file mode 100644
index 00000000000..bc25f37a8b6
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/CquerySymbolKind.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+enum CquerySymbolKind {
+ Unknown(0), TypeAlias(252), Parameter(253), StaticMethod(254), Macro(255);
+
+ private int value;
+
+ public int getValue() {
+ return value;
+ }
+
+ private CquerySymbolKind(int value) {
+ this.value = value;
+ }
+
+ public static CquerySymbolKind forValue(int value) {
+ switch (value) {
+ case 0:
+ return CquerySymbolKind.Unknown;
+ case 252:
+ return CquerySymbolKind.TypeAlias;
+ case 253:
+ return CquerySymbolKind.Parameter;
+ case 254:
+ return CquerySymbolKind.StaticMethod;
+ case 255:
+ return CquerySymbolKind.Macro;
+ default:
+ throw new IllegalArgumentException("Illegal value for cquery symbol kind"); //$NON-NLS-1$
+ }
+ }
+} \ No newline at end of file
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/ExtendedSymbolKindType.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/ExtendedSymbolKindType.java
new file mode 100644
index 00000000000..0632f26fc85
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/ExtendedSymbolKindType.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+import java.lang.reflect.Type;
+
+import org.eclipse.lsp4j.SymbolKind;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParseException;
+import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import com.google.gson.annotations.JsonAdapter;
+
+@JsonAdapter(ExtendedSymbolKindParsers.class)
+public class ExtendedSymbolKindType {
+ int value;
+ transient boolean isProtocolSymbol;
+
+ public ExtendedSymbolKindType(int _v) {
+ try {
+ SymbolKind.forValue(_v);
+ value = _v;
+ isProtocolSymbol = true;
+ } catch (IllegalArgumentException e) {
+ try {
+ CquerySymbolKind.forValue(_v);
+ value = _v;
+ isProtocolSymbol = false;
+ } catch (IllegalArgumentException y) {
+ throw new IllegalArgumentException("Illegal value for SymbolKind"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public int getValue() {
+ return value;
+ }
+}
+
+class ExtendedSymbolKindParsers
+ implements JsonDeserializer<ExtendedSymbolKindType>, JsonSerializer<ExtendedSymbolKindType> {
+ @Override
+ public ExtendedSymbolKindType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
+ throws JsonParseException {
+
+ int symbolKindValue = json.getAsInt();
+ return new ExtendedSymbolKindType(symbolKindValue);
+ }
+
+ @Override
+ public JsonElement serialize(ExtendedSymbolKindType src, Type typeOfSrc, JsonSerializationContext context) {
+ return new JsonPrimitive(src.getValue());
+ }
+}
+
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/HighlightSymbol.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/HighlightSymbol.java
new file mode 100644
index 00000000000..b17b6a5346a
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/HighlightSymbol.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+import java.util.List;
+
+import org.eclipse.lsp4j.Range;
+
+public class HighlightSymbol {
+ private int stableId;
+ private ExtendedSymbolKindType parentKind;
+ private ExtendedSymbolKindType kind;
+ private StorageClass storage;
+ private List<Range> ranges;
+
+ public HighlightSymbol(int stableId, ExtendedSymbolKindType parentKind, ExtendedSymbolKindType kind,
+ StorageClass storage, List<Range> ranges) {
+ this.stableId = stableId;
+ this.parentKind = parentKind;
+ this.kind = kind;
+ this.storage = storage;
+ this.ranges = ranges;
+ }
+
+ public int getStableId() {
+ return stableId;
+ }
+
+ public ExtendedSymbolKindType getParentKind() {
+ return parentKind;
+ }
+
+ public ExtendedSymbolKindType getKind() {
+ return kind;
+ }
+
+ public StorageClass getStorage() {
+ return storage;
+ }
+
+ public List<Range> getRanges() {
+ return ranges;
+ }
+} \ No newline at end of file
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/IndexingProgressStats.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/IndexingProgressStats.java
new file mode 100644
index 00000000000..6a3a9baf485
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/IndexingProgressStats.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+public class IndexingProgressStats {
+ private int indexRequestCount;
+ private int doIdMapCount;
+ private int loadPreviousIndexCount;
+ private int onIdMappedCount;
+ private int onIndexedCount;
+ private int activeThreads;
+
+ public IndexingProgressStats(int indexRequestCount, int doIdMapCount, int loadPreviousIndexCount, int onIdMappedCount,
+ int onIndexedCount, int activeThreads) {
+ this.indexRequestCount = indexRequestCount;
+ this.doIdMapCount = doIdMapCount;
+ this.loadPreviousIndexCount = loadPreviousIndexCount;
+ this.onIdMappedCount = onIdMappedCount;
+ this.onIndexedCount = onIndexedCount;
+ this.activeThreads = activeThreads;
+ }
+
+ public int getIndexRequestCount() {
+ return indexRequestCount;
+ }
+
+ public int getDoIdMapCount() {
+ return doIdMapCount;
+ }
+
+ public int getLoadPreviousIndexCount() {
+ return loadPreviousIndexCount;
+ }
+
+ public int getOnIdMappedCount() {
+ return onIdMappedCount;
+ }
+
+ public int getOnIndexedCount() {
+ return onIndexedCount;
+ }
+
+ public int getActiveThreads() {
+ return activeThreads;
+ }
+} \ No newline at end of file
diff --git a/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/StorageClass.java b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/StorageClass.java
new file mode 100644
index 00000000000..ff3b885e1f9
--- /dev/null
+++ b/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/cquery/StorageClass.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Manish Khurana , Nathan Ridge and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.lsp4e.cpp.language.cquery;
+
+public enum StorageClass {
+ Invalid(0), None(1), Extern(2), Static(3), PrivateExtern(4), Auto(5), Register(6);
+
+ private int value;
+
+ public int getValue() {
+ return value;
+ }
+
+ StorageClass(int value) {
+ this.value = value;
+ }
+
+ public static StorageClass forValue(int value) {
+ StorageClass[] allValues = StorageClass.values();
+ if (value < 1 || value > allValues.length) {
+ throw new IllegalArgumentException("Illegal enum value: " + value); //$NON-NLS-1$
+ }
+ return allValues[value - 1];
+ }
+} \ No newline at end of file

Back to the top