Skip to content

Commit 8885756

Browse files
committed
Clean up checks and add documentation
1 parent dffdfa6 commit 8885756

File tree

5 files changed

+64
-6
lines changed

5 files changed

+64
-6
lines changed

bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/services/ClangdLanguageServer.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
public interface ClangdLanguageServer extends LanguageServer {
3434

3535
/**
36-
* The switchSourceHeader request is sent from the client to the server to
36+
* The <em>textDocument/switchSourceHeader</em> request is sent from the client to the server to
3737
* <ul>
3838
* <li>get the corresponding header if a source file was provided</li>
3939
* <li>get the source file if a header was provided</li>
@@ -47,9 +47,30 @@ public interface ClangdLanguageServer extends LanguageServer {
4747
@JsonRequest(value = "textDocument/switchSourceHeader")
4848
CompletableFuture<String> switchSourceHeader(TextDocumentIdentifier textDocument);
4949

50+
/**
51+
* The <em>textDocument/ast</em> request is sent from the client to the server in order to get
52+
* details about the program structure (so called abstract syntax tree or AST) in a C++ file.
53+
* The structure can be requested for the whole file or for a certain range.
54+
*
55+
* @param astParameters request parameters containing the document identifier and requested documented range
56+
* @return the abstract syntax tree root node (with child hierarchy) for the requested document and range
57+
*
58+
* @see https://clangd.llvm.org/extensions#ast
59+
*/
5060
@JsonRequest(value = "textDocument/ast")
5161
CompletableFuture<AstNode> getAst(AstParams astParameters);
5262

63+
/**
64+
* The <em>textDocument/symbolInfo</em> request is sent from the client to the server in order to access
65+
* details about the element under the cursor. The response provides details like the element's name,
66+
* its parent container's name, and some clangd-specific element IDs (e.g. the "unified symbol resolution"
67+
* identifier).
68+
*
69+
* @param positionParameters request parameters containing the document identifier and the current cursor position
70+
* @return the details about the symbol on the given position
71+
*
72+
* @see https://clangd.llvm.org/extensions#symbol-info-request
73+
*/
5374
@JsonRequest(value = "textDocument/symbolInfo")
5475
CompletableFuture<SymbolDetails[]> getSymbolInfo(TextDocumentPositionParams positionParameters);
5576
}

bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/services/ast/AstNode.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22

33
import java.util.Arrays;
44

5+
import org.eclipse.cdt.lsp.services.ClangdLanguageServer;
56
import org.eclipse.lsp4j.Range;
67
import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
78
import org.eclipse.lsp4j.util.Preconditions;
89
import org.eclipse.lsp4j.util.ToStringBuilder;
910

11+
/**
12+
* Return type for the <em>textDocument/ast</em> request.
13+
* This class was generated by the <em>org.eclipse.lsp4j.generator</em> bundle
14+
* using xtend (see {@link org.eclipse.lsp4j.generator.JsonRpcData JsonRpcData} and
15+
* the <a href="https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/jsonrpc.md">documentation</a>).
16+
*
17+
* @see {@link ClangdLanguageServer#getAst(AstParams)}
18+
*/
1019
public class AstNode {
1120

1221
@NonNull

bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/services/ast/AstParams.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package org.eclipse.cdt.lsp.services.ast;
22

3+
import org.eclipse.cdt.lsp.services.ClangdLanguageServer;
34
import org.eclipse.lsp4j.Range;
45
import org.eclipse.lsp4j.TextDocumentIdentifier;
56
import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
67
import org.eclipse.lsp4j.util.Preconditions;
78
import org.eclipse.lsp4j.util.ToStringBuilder;
89

10+
/**
11+
* Parameter object type for the <em>textDocument/ast</em> request.
12+
* This class was generated by the <em>org.eclipse.lsp4j.generator</em> bundle
13+
* using xtend (see {@link org.eclipse.lsp4j.generator.JsonRpcData JsonRpcData} and
14+
* the <a href="https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/jsonrpc.md">documentation</a>).
15+
*
16+
* @see {@link ClangdLanguageServer#getAst(AstParams)}
17+
*/
918
public class AstParams {
1019

1120
@NonNull

bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/services/symbolinfo/RangeAndUri.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package org.eclipse.cdt.lsp.services.symbolinfo;
22

3+
import org.eclipse.cdt.lsp.services.ClangdLanguageServer;
34
import org.eclipse.lsp4j.Range;
45
import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
56
import org.eclipse.lsp4j.util.Preconditions;
67
import org.eclipse.lsp4j.util.ToStringBuilder;
78

8-
@SuppressWarnings("all")
9+
/**
10+
* Data type used in {@link SymbolDetails} for the <em>textDocument/symbolInfo</em> request.
11+
* This class was generated by the <em>org.eclipse.lsp4j.generator</em> bundle
12+
* using xtend (see {@link org.eclipse.lsp4j.generator.JsonRpcData JsonRpcData} and
13+
* the <a href="https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/jsonrpc.md">documentation</a>).
14+
*
15+
* @see {@link SymbolDetails}
16+
* @see {@link ClangdLanguageServer#getSymbolInfo(org.eclipse.lsp4j.TextDocumentPositionParams)}
17+
*/
918
public class RangeAndUri {
1019
@NonNull
1120
private Range range;
@@ -19,7 +28,7 @@ public Range getRange() {
1928
}
2029

2130
public void setRange(@NonNull final Range range) {
22-
this.range = Preconditions.checkNotNull(range, "range");
31+
this.range = Preconditions.<Range>checkNotNull(range, "range"); //$NON-NLS-1$
2332
}
2433

2534
@NonNull
@@ -28,14 +37,14 @@ public String getUri() {
2837
}
2938

3039
public void setUri(@NonNull final String uri) {
31-
this.uri = Preconditions.checkNotNull(uri, "uri");
40+
this.uri = Preconditions.<String>checkNotNull(uri, "uri"); //$NON-NLS-1$
3241
}
3342

3443
@Override
3544
public String toString() {
3645
ToStringBuilder b = new ToStringBuilder(this);
37-
b.add("range", this.range);
38-
b.add("uri", this.uri);
46+
b.add("range", this.range); //$NON-NLS-1$
47+
b.add("uri", this.uri); //$NON-NLS-1$
3948
return b.toString();
4049
}
4150

bundles/org.eclipse.cdt.lsp/src/org/eclipse/cdt/lsp/services/symbolinfo/SymbolDetails.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
package org.eclipse.cdt.lsp.services.symbolinfo;
22

3+
import org.eclipse.cdt.lsp.services.ClangdLanguageServer;
34
import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
45
import org.eclipse.lsp4j.util.Preconditions;
56
import org.eclipse.lsp4j.util.ToStringBuilder;
67

8+
/**
9+
* Return type for the <em>textDocument/symbolInfo</em> request.
10+
* This class was generated by the <em>org.eclipse.lsp4j.generator</em> bundle
11+
* using xtend (see {@link org.eclipse.lsp4j.generator.JsonRpcData JsonRpcData} and
12+
* the <a href="https://github.com/eclipse-lsp4j/lsp4j/blob/main/documentation/jsonrpc.md">documentation</a>).
13+
*
14+
* @see {@link ClangdLanguageServer#getSymbolInfo(org.eclipse.lsp4j.TextDocumentPositionParams)}
15+
*/
716
public class SymbolDetails {
17+
818
@NonNull
919
private String name;
1020

0 commit comments

Comments
 (0)