diff --git a/Clients/VisualStudioCode/src/extension.ts b/Clients/VisualStudioCode/src/extension.ts index ceb865e..a7d32f4 100644 --- a/Clients/VisualStudioCode/src/extension.ts +++ b/Clients/VisualStudioCode/src/extension.ts @@ -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 } }; diff --git a/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java b/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java index 05717ef..0e90579 100644 --- a/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java +++ b/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java @@ -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); diff --git a/LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java b/LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java index ec895cb..7625b49 100644 --- a/LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java +++ b/LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java @@ -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, CompletionList>> completion(CompletionParams params) { - return CompletableFuture.completedFuture(Either.forLeft(Collections.emptyList())); + List 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