5 Commits

Author SHA1 Message Date
Ruben
254edf25af feat: update jar and Version 2025-09-19 19:20:16 +02:00
RubenKraft
fc628f7547 Update README.md 2025-09-18 16:05:45 +00:00
Ruben
33d5fbb01d feat: update jar and Version 2025-09-18 17:55:45 +02:00
Ruben
6332daf2ad feat: update Compiler Jar 2025-09-18 17:54:17 +02:00
Ruben
01616ee985 feat: update vscode client 2025-09-17 19:11:55 +02:00
9 changed files with 42 additions and 19 deletions

View File

@@ -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.

View File

@@ -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"
},

View File

@@ -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')
},

View File

@@ -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);

View File

@@ -42,6 +42,11 @@ public class PlaceholderPoint {
return point.getStartIndex() + extraOffset;
}
public PlaceholderType getKind() {
return kind;
}
public boolean equals(Object obj) {
return this == obj;
/*

View File

@@ -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() {

View File

@@ -55,6 +55,10 @@ The Language Server in itself can be used for any Client. The Clients task is to
![Diagram](docs/diagram.png)
## 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: