Compare commits
7 Commits
ed26f869c3
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
254edf25af | ||
|
fc628f7547 | ||
|
33d5fbb01d | ||
|
6332daf2ad | ||
|
01616ee985 | ||
|
29f0e6a05a | ||
|
7bc07d9ac1 |
Binary file not shown.
@@ -1,3 +1,3 @@
|
||||
# lspclient README
|
||||
# Java-TX Language Server
|
||||
|
||||
This is the README for the Java-TX LSP Client.
|
||||
This is the official Plugin for Java-TX.
|
@@ -3,7 +3,7 @@
|
||||
"name": "java-tx-language-extension",
|
||||
"displayName": "Java-TX Language Extension",
|
||||
"description": "The Language Extension for Java-TX with Typehints and Syntax Checks",
|
||||
"version": "0.0.7",
|
||||
"version": "0.0.9",
|
||||
"engines": {
|
||||
"vscode": "^1.94.0"
|
||||
},
|
||||
|
@@ -13,12 +13,12 @@ function createClient(context: vscode.ExtensionContext): LanguageClient {
|
||||
const serverOptions: ServerOptions = {
|
||||
run: {
|
||||
command: 'java',
|
||||
args: ['-Xss2m', '-jar', workspaceFolder + "/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"],
|
||||
args: ['-Xss10m', '-jar', workspaceFolder + "/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar"],
|
||||
},
|
||||
debug: {
|
||||
command: 'java',
|
||||
args: [
|
||||
'-Xss2m',
|
||||
'-Xss10m',
|
||||
'-jar',
|
||||
workspaceFolder + '/JavaTXLanguageServer-1.0-SNAPSHOT-jar-with-dependencies.jar',
|
||||
],
|
||||
@@ -26,7 +26,7 @@ function createClient(context: vscode.ExtensionContext): LanguageClient {
|
||||
};
|
||||
|
||||
const clientOptions: LanguageClientOptions = {
|
||||
documentSelector: [{ scheme: 'file', language: 'java' }],
|
||||
documentSelector: [{ scheme: 'file', pattern: '**/*.jav' }],
|
||||
synchronize: {
|
||||
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.jav')
|
||||
},
|
||||
|
Binary file not shown.
@@ -13,6 +13,8 @@ import org.eclipse.lsp4j.*;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -154,14 +156,15 @@ public class ChangeHandler {
|
||||
|
||||
try {
|
||||
try {
|
||||
File tempDir2 = new File(System.getProperty("java.io.tmpdir"));
|
||||
File tempFile2 = File.createTempFile("newText", ".tmp", tempDir2);
|
||||
File tempDir2 = Path.of(new URI(params.getTextDocument().getUri())).getParent().toFile();
|
||||
File tempFile2 = File.createTempFile("jtx_temp", ".tmp", tempDir2);
|
||||
FileWriter fileWriter = new FileWriter(tempFile2, true);
|
||||
BufferedWriter bw = new BufferedWriter(fileWriter);
|
||||
bw.write(input);
|
||||
bw.close();
|
||||
|
||||
ArrayList<LSPVariable> variables = typeResolver.infereInput(tempFile2.toURI().toString(), input, false);
|
||||
try {
|
||||
ArrayList<LSPVariable> variables = typeResolver.infereInput(tempFile2.toURI().toString(), input, true);
|
||||
cacheService.setVariables(variables);
|
||||
|
||||
DiagnosticsAndTypehints diagnosticsAndTypehints = conversionHelper.variablesToDiagnosticsAndTypehintsWithInput(variables, input);
|
||||
@@ -175,7 +178,15 @@ public class ChangeHandler {
|
||||
allDiagnostics.addAll(parserService.getDiagnosticsOfErrors(input, params.getTextDocument().getUri()));
|
||||
|
||||
clientService.publishDiagnostics(params.getTextDocument().getUri(), allDiagnostics);
|
||||
} catch (Exception f) {
|
||||
logService.log("[didSave] Error trying to get Inlay-Hints and Diagnostics for Client: " + f.getMessage(), MessageType.Error);
|
||||
|
||||
for (StackTraceElement elem : f.getStackTrace()) {
|
||||
logService.log(elem.toString());
|
||||
}
|
||||
clientService.showMessage(MessageType.Error, f.getMessage() == null ? "null" : f.getMessage());
|
||||
cacheService.updateGlobalMaps(new ArrayList<>(), new ArrayList<>(), params.getTextDocument().getUri());
|
||||
}
|
||||
tempFile2.delete();
|
||||
} catch (Exception e) {
|
||||
logService.log("[didSave] Error trying to get Inlay-Hints and Diagnostics for Client: " + e.getMessage(), MessageType.Error);
|
||||
|
@@ -42,6 +42,11 @@ public class PlaceholderPoint {
|
||||
return point.getStartIndex() + extraOffset;
|
||||
}
|
||||
|
||||
|
||||
public PlaceholderType getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return this == obj;
|
||||
/*
|
||||
|
@@ -13,7 +13,6 @@ public class PlaceholderVariable {
|
||||
ResultPair<?, ?> resultPair;
|
||||
|
||||
|
||||
|
||||
public PlaceholderVariable(PlaceholderPoint point, Set<PlaceholderPoint> additionalPoints, ResultPair<?, ?> resultPair) {
|
||||
this.point = point;
|
||||
inserts = additionalPoints;
|
||||
@@ -26,7 +25,10 @@ public class PlaceholderVariable {
|
||||
|
||||
List<PlaceholderPoint> insertsSorted = new ArrayList<>();
|
||||
insertsSorted.add(point);
|
||||
|
||||
if (!point.getInsertString().contains("void")) {
|
||||
insertsSorted.addAll(inserts);
|
||||
}
|
||||
Collections.sort(insertsSorted, new PlaceholderPoint.TypeInsertPointPositionComparator().reversed());
|
||||
|
||||
for (PlaceholderPoint insertPoint : insertsSorted) {
|
||||
@@ -40,7 +42,8 @@ public class PlaceholderVariable {
|
||||
return point.getInsertString();
|
||||
}
|
||||
|
||||
public void reducePackage(){point.setInsertString(point.getInsertString().replaceAll("java\\.lang\\.", "").replaceAll("java\\.util\\.", ""));
|
||||
public void reducePackage() {
|
||||
point.setInsertString(point.getInsertString().replaceAll("java\\.lang\\.", "").replaceAll("java\\.util\\.", ""));
|
||||
}
|
||||
|
||||
public ResultPair<?, ?> getResultPair() {
|
||||
|
@@ -55,6 +55,10 @@ The Language Server in itself can be used for any Client. The Clients task is to
|
||||
|
||||

|
||||
|
||||
## Additional Information
|
||||
|
||||
- Uses the [LSP-Interface](https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/src/branch/LSP-Interface) Branch of the Java-TX Compiler Repository
|
||||
|
||||
## Update JavaTX Compiler Dependency as Maven Package
|
||||
If you make changes in the Compiler Interface, you have to change the jar and therefore the Dependency in the Java TX Language Server
|
||||
You can follow this steps:
|
||||
|
Reference in New Issue
Block a user