diff --git a/LanguageServer/pom.xml b/LanguageServer/pom.xml index 76ded4f..81bfb00 100644 --- a/LanguageServer/pom.xml +++ b/LanguageServer/pom.xml @@ -53,7 +53,7 @@ - com.example.MyLanguageServerLauncher + com.dhbw.JavaTXLanguageServerLauncher diff --git a/LanguageServer/src/main/java/com/example/MyLanguageServer.java b/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java similarity index 85% rename from LanguageServer/src/main/java/com/example/MyLanguageServer.java rename to LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java index 2464bbd..05717ef 100644 --- a/LanguageServer/src/main/java/com/example/MyLanguageServer.java +++ b/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServer.java @@ -1,4 +1,4 @@ -package com.example; +package com.dhbw; import org.eclipse.lsp4j.*; import org.eclipse.lsp4j.services.LanguageClient; @@ -9,7 +9,7 @@ import org.eclipse.lsp4j.services.LanguageServer; import java.util.List; import java.util.concurrent.CompletableFuture; -public class MyLanguageServer implements LanguageServer { +public class JavaTXLanguageServer implements LanguageServer { private LanguageClient client; public void connect(LanguageClient client) { @@ -18,8 +18,8 @@ public class MyLanguageServer implements LanguageServer { } - private final MyTextDocumentService textDocumentService = new MyTextDocumentService(); - private final MyWorkspaceService workspaceService = new MyWorkspaceService(); + private final JavaTXTextDocumentService textDocumentService = new JavaTXTextDocumentService(); + private final JavaTXWorkspaceService workspaceService = new JavaTXWorkspaceService(); @Override public CompletableFuture initialize(InitializeParams params) { diff --git a/LanguageServer/src/main/java/com/example/MyLanguageServerLauncher.java b/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServerLauncher.java similarity index 74% rename from LanguageServer/src/main/java/com/example/MyLanguageServerLauncher.java rename to LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServerLauncher.java index 6d096b0..3a49e8d 100644 --- a/LanguageServer/src/main/java/com/example/MyLanguageServerLauncher.java +++ b/LanguageServer/src/main/java/com/dhbw/JavaTXLanguageServerLauncher.java @@ -1,15 +1,14 @@ -package com.example; +package com.dhbw; import org.eclipse.lsp4j.launch.LSPLauncher; -import org.eclipse.lsp4j.jsonrpc.Launcher; import org.eclipse.lsp4j.services.LanguageClient; -public class MyLanguageServerLauncher { +public class JavaTXLanguageServerLauncher { public static void main(String[] args) { try { - MyLanguageServer server = new MyLanguageServer(); + JavaTXLanguageServer server = new JavaTXLanguageServer(); var launcher = LSPLauncher.createServerLauncher(server, System.in, System.out); diff --git a/LanguageServer/src/main/java/com/example/MyTextDocumentService.java b/LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java similarity index 92% rename from LanguageServer/src/main/java/com/example/MyTextDocumentService.java rename to LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java index a634f72..ec895cb 100644 --- a/LanguageServer/src/main/java/com/example/MyTextDocumentService.java +++ b/LanguageServer/src/main/java/com/dhbw/JavaTXTextDocumentService.java @@ -1,22 +1,17 @@ -package com.example; +package com.dhbw; -import com.example.model.ParseError.CustomErrorListener; -import com.example.model.ParseError.ParseException; -import com.example.parser.ErrorListener; -import com.example.parser.Java17Lexer; -import com.example.parser.Java17Parser; -import com.example.parser.Java17ParserBaseListener; +import com.dhbw.model.ParseError.DiagnoseErrorListener; +import com.dhbw.parser.Java17Lexer; +import com.dhbw.parser.Java17Parser; +import com.dhbw.parser.Java17ParserBaseListener; import org.eclipse.lsp4j.*; import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.eclipse.lsp4j.jsonrpc.messages.Message; import org.eclipse.lsp4j.services.LanguageClient; -import org.eclipse.lsp4j.services.LanguageServer; import org.eclipse.lsp4j.services.TextDocumentService; import java.util.Collections; import java.util.concurrent.CompletableFuture; import java.util.List; -import java.util.ArrayList; import java.util.concurrent.atomic.AtomicReference; import org.antlr.v4.runtime.CharStreams; @@ -25,7 +20,7 @@ import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; -public class MyTextDocumentService implements org.eclipse.lsp4j.services.TextDocumentService { +public class JavaTXTextDocumentService implements org.eclipse.lsp4j.services.TextDocumentService { LanguageClient client; public void setClient(LanguageClient client) { @@ -47,7 +42,7 @@ public class MyTextDocumentService implements org.eclipse.lsp4j.services.TextDoc AtomicReference summedUp = new AtomicReference<>(""); params.getContentChanges().forEach(el -> summedUp.set(summedUp.get() + el.getText())); - CustomErrorListener errorListener = new CustomErrorListener(); + DiagnoseErrorListener errorListener = new DiagnoseErrorListener(); String input = summedUp.get(); CharStream charStream = CharStreams.fromString(input); diff --git a/LanguageServer/src/main/java/com/example/MyWorkspaceService.java b/LanguageServer/src/main/java/com/dhbw/JavaTXWorkspaceService.java similarity index 65% rename from LanguageServer/src/main/java/com/example/MyWorkspaceService.java rename to LanguageServer/src/main/java/com/dhbw/JavaTXWorkspaceService.java index 2063377..4c782b0 100644 --- a/LanguageServer/src/main/java/com/example/MyWorkspaceService.java +++ b/LanguageServer/src/main/java/com/dhbw/JavaTXWorkspaceService.java @@ -1,16 +1,10 @@ -package com.example; +package com.dhbw; import org.eclipse.lsp4j.DidChangeConfigurationParams; -import org.eclipse.lsp4j.WorkspaceSymbolParams; -import org.eclipse.lsp4j.SymbolInformation; import org.eclipse.lsp4j.services.WorkspaceService; import org.eclipse.lsp4j.DidChangeWatchedFilesParams; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.ArrayList; - -public class MyWorkspaceService implements WorkspaceService { +public class JavaTXWorkspaceService implements WorkspaceService { @Override diff --git a/LanguageServer/src/main/java/com/example/model/ParseError/CustomErrorListener.java b/LanguageServer/src/main/java/com/dhbw/model/ParseError/DiagnoseErrorListener.java similarity index 85% rename from LanguageServer/src/main/java/com/example/model/ParseError/CustomErrorListener.java rename to LanguageServer/src/main/java/com/dhbw/model/ParseError/DiagnoseErrorListener.java index 53126c5..66c0d2f 100644 --- a/LanguageServer/src/main/java/com/example/model/ParseError/CustomErrorListener.java +++ b/LanguageServer/src/main/java/com/dhbw/model/ParseError/DiagnoseErrorListener.java @@ -1,19 +1,15 @@ -package com.example.model.ParseError; +package com.dhbw.model.ParseError; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.ATNConfigSet; import org.antlr.v4.runtime.dfa.DFA; import org.eclipse.lsp4j.*; -import org.eclipse.lsp4j.jsonrpc.messages.Either; -import org.eclipse.lsp4j.services.LanguageClient; -import org.eclipse.lsp4j.services.LanguageServer; -import org.eclipse.lsp4j.services.TextDocumentService; import java.util.ArrayList; import java.util.BitSet; import java.util.List; -public class CustomErrorListener implements ANTLRErrorListener { +public class DiagnoseErrorListener implements ANTLRErrorListener { private final List errorMessages = new ArrayList<>(); @Override public void syntaxError(Recognizer recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { diff --git a/LanguageServer/src/main/java/com/example/parser/Java17Lexer.interp b/LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.interp similarity index 100% rename from LanguageServer/src/main/java/com/example/parser/Java17Lexer.interp rename to LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.interp diff --git a/LanguageServer/src/main/java/com/example/parser/Java17Lexer.java b/LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.java similarity index 99% rename from LanguageServer/src/main/java/com/example/parser/Java17Lexer.java rename to LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.java index eb91ab0..98b200c 100644 --- a/LanguageServer/src/main/java/com/example/parser/Java17Lexer.java +++ b/LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.java @@ -1,12 +1,9 @@ -package com.example.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 by ANTLR 4.13.1 +package com.dhbw.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Lexer.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.Token; -import org.antlr.v4.runtime.TokenStream; import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.misc.*; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) public class Java17Lexer extends Lexer { diff --git a/LanguageServer/src/main/java/com/example/parser/Java17Lexer.tokens b/LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.tokens similarity index 100% rename from LanguageServer/src/main/java/com/example/parser/Java17Lexer.tokens rename to LanguageServer/src/main/java/com/dhbw/parser/Java17Lexer.tokens diff --git a/LanguageServer/src/main/java/com/example/parser/Java17Parser.interp b/LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.interp similarity index 100% rename from LanguageServer/src/main/java/com/example/parser/Java17Parser.interp rename to LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.interp diff --git a/LanguageServer/src/main/java/com/example/parser/Java17Parser.java b/LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.java similarity index 99% rename from LanguageServer/src/main/java/com/example/parser/Java17Parser.java rename to LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.java index ca18007..9ef5484 100644 --- a/LanguageServer/src/main/java/com/example/parser/Java17Parser.java +++ b/LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.java @@ -1,12 +1,9 @@ -package com.example.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 +package com.dhbw.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; import org.antlr.v4.runtime.tree.*; import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) public class Java17Parser extends Parser { diff --git a/LanguageServer/src/main/java/com/example/parser/Java17Parser.tokens b/LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.tokens similarity index 100% rename from LanguageServer/src/main/java/com/example/parser/Java17Parser.tokens rename to LanguageServer/src/main/java/com/dhbw/parser/Java17Parser.tokens diff --git a/LanguageServer/src/main/java/com/example/parser/Java17ParserBaseListener.java b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserBaseListener.java similarity index 99% rename from LanguageServer/src/main/java/com/example/parser/Java17ParserBaseListener.java rename to LanguageServer/src/main/java/com/dhbw/parser/Java17ParserBaseListener.java index 1bf47e0..e5aedd8 100644 --- a/LanguageServer/src/main/java/com/example/parser/Java17ParserBaseListener.java +++ b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserBaseListener.java @@ -1,4 +1,4 @@ -package com.example.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 +package com.dhbw.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.ErrorNode; diff --git a/LanguageServer/src/main/java/com/example/parser/Java17ParserBaseVisitor.java b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserBaseVisitor.java similarity index 99% rename from LanguageServer/src/main/java/com/example/parser/Java17ParserBaseVisitor.java rename to LanguageServer/src/main/java/com/dhbw/parser/Java17ParserBaseVisitor.java index 6411aef..3c07412 100644 --- a/LanguageServer/src/main/java/com/example/parser/Java17ParserBaseVisitor.java +++ b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserBaseVisitor.java @@ -1,4 +1,4 @@ -package com.example.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 +package com.dhbw.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor; /** diff --git a/LanguageServer/src/main/java/com/example/parser/Java17ParserListener.java b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserListener.java similarity index 99% rename from LanguageServer/src/main/java/com/example/parser/Java17ParserListener.java rename to LanguageServer/src/main/java/com/dhbw/parser/Java17ParserListener.java index 23646ef..8f82bbd 100644 --- a/LanguageServer/src/main/java/com/example/parser/Java17ParserListener.java +++ b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserListener.java @@ -1,4 +1,4 @@ -package com.example.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 +package com.dhbw.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.tree.ParseTreeListener; /** diff --git a/LanguageServer/src/main/java/com/example/parser/Java17ParserVisitor.java b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserVisitor.java similarity index 99% rename from LanguageServer/src/main/java/com/example/parser/Java17ParserVisitor.java rename to LanguageServer/src/main/java/com/dhbw/parser/Java17ParserVisitor.java index d0a763e..93ebd2a 100644 --- a/LanguageServer/src/main/java/com/example/parser/Java17ParserVisitor.java +++ b/LanguageServer/src/main/java/com/dhbw/parser/Java17ParserVisitor.java @@ -1,4 +1,4 @@ -package com.example.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 +package com.dhbw.parser;// Generated from /home/ruben/Documents/JavaCompilerCore/src/main/antlr4/de/dhbwstuttgart/parser/antlr/Java17Parser.g4 by ANTLR 4.13.1 import org.antlr.v4.runtime.tree.ParseTreeVisitor; /** diff --git a/LanguageServer/src/main/java/com/example/model/ParseError/ParseError.java b/LanguageServer/src/main/java/com/example/model/ParseError/ParseError.java deleted file mode 100644 index 985d4e2..0000000 --- a/LanguageServer/src/main/java/com/example/model/ParseError/ParseError.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.example.model.ParseError; - -public class ParseError { - private String message; - private int line; - private int charposition; - - public ParseError(int line, int charPositionInLine, String msg) { - } -} diff --git a/LanguageServer/src/main/java/com/example/model/ParseError/ParseException.java b/LanguageServer/src/main/java/com/example/model/ParseError/ParseException.java deleted file mode 100644 index f141ecd..0000000 --- a/LanguageServer/src/main/java/com/example/model/ParseError/ParseException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.model.ParseError; - -public class ParseException extends RuntimeException { - - private int line; - private int charposition; - public ParseException(String message, int line, int charposition) { - super(message); - this.line = line; - this.charposition = charposition; - } - - public int getLine() {return line;} - public int getCharposition() {return charposition;} -} diff --git a/LanguageServer/src/main/java/com/example/parser/ErrorListener.java b/LanguageServer/src/main/java/com/example/parser/ErrorListener.java deleted file mode 100644 index 09b33fd..0000000 --- a/LanguageServer/src/main/java/com/example/parser/ErrorListener.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.example.parser; - -import com.example.model.ParseError.ParseError; -import com.example.model.ParseError.ParseException; -import org.antlr.v4.runtime.BaseErrorListener; -import org.antlr.v4.runtime.RecognitionException; -import org.antlr.v4.runtime.Recognizer; - -public class ErrorListener extends BaseErrorListener { - @Override - public void syntaxError(Recognizer recognizer, - Object offendingSymbol, - int line, int charPositionInLine, - String msg, - RecognitionException e) { - throw new ParseException(msg, line, charPositionInLine); - } -}