feat: add example Autocomplete
This commit is contained in:
parent
1583fa254d
commit
ff4181de0a
@ -14,14 +14,15 @@ import {
|
||||
// Your extension is activated the very first time the command is executed
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
|
||||
const serverOptions: ServerOptions = {
|
||||
run: {
|
||||
command: 'java',
|
||||
args: ['-jar', "C:/Users/ruben/IdeaProjects/LanguageServerTestServer/target/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe
|
||||
args: ['-jar', "C:\\Users\\ruben\\JavaTXLanguageServer\\JavaTXLanguageServer\\LanguageServer\\target\\JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe
|
||||
},
|
||||
debug: {
|
||||
command: 'java',
|
||||
args: ['-jar', "C:/Users/ruben/IdeaProjects/LanguageServerTestServer/target/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe für Debug
|
||||
args: ['-jar', "C:d \Users\\ruben\\JavaTXLanguageServer\\JavaTXLanguageServer\\LanguageServer\\target\\JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"], // Absolute Pfadangabe für Debug
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -26,15 +26,9 @@ public class JavaTXLanguageServer implements LanguageServer {
|
||||
ServerCapabilities capabilities = new ServerCapabilities();
|
||||
|
||||
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
|
||||
|
||||
|
||||
capabilities.setHoverProvider(true);
|
||||
|
||||
|
||||
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
|
||||
|
||||
|
||||
capabilities.setCompletionProvider(new CompletionOptions(true, List.of(".")));
|
||||
capabilities.setCompletionProvider(new CompletionOptions(true, List.of()));
|
||||
|
||||
capabilities.setWorkspaceSymbolProvider(true);
|
||||
|
||||
|
@ -9,9 +9,10 @@ import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.eclipse.lsp4j.services.LanguageClient;
|
||||
import org.eclipse.lsp4j.services.TextDocumentService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
@ -29,7 +30,16 @@ public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.Tex
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(CompletionParams params) {
|
||||
return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList()));
|
||||
List<CompletionItem> completions = new ArrayList<>();
|
||||
|
||||
CompletionItem item = new CompletionItem("HelloWorld");
|
||||
item.setKind(CompletionItemKind.Text);
|
||||
item.setInsertText("Hello, JavaTX World!");
|
||||
completions.add(item);
|
||||
|
||||
client.showMessage(new MessageParams(MessageType.Info, "Returning completion suggestions: " + completions));
|
||||
|
||||
return CompletableFuture.completedFuture(Either.forLeft(completions));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user