JavaTXLanguageServer

This Repo contains the LanguageServer for JavaTX as well as various Clients to use it.
It uses the LSP4J Framework in Version 0.23.1.

Functionality

Currently the Language Server has the following functionalities:

  • Syntax-Check
  • Autocomplete for ForLoops and Main Method.
  • Basic Autoformatting (removing every Space at the End of the Line)
  • Display Type of Methods and Parameters with TypeInference
  • Select Type of typinfered Type and replace it (including Generics)
  • Give Hint of all possible Types to Select from (including Generics)
  • Compile Bytecode in /out Folder

Project Structure

.
├── Client/
│   ├── VisualStudioCode                       -> Containing the Client for VS Code. In this Case a Extension. 
│   ├── Emacs
│   ├── Intellij
│   └── ...
└── LanguageServer/
    └── src/main/java/de/dhbw/
        ├── compiler/                           -> Containing the JavaTX Compiler
        │   └── ... 
        ├── model/
        │   └── parseError/
        │       └── ...                         -> Containing Custom Parse-Errors.
        ├── parser/
        │   └── ...                             -> Containing an the JavaTX ANTLR Parser for Syntax-Checks.
        ├── helper/
        │   └── ...                             -> Containing Helper-Classes for the Language Server.
        ├── JavaTXLanguageServer.java           -> Orchestrator of the Language Server
        ├── JavaTXLanguageServerLauncher.java   -> Class to start the Language Server.
        ├── JavaTXTextDocumentService.java      -> Language-Server Features for a Single File
        └── JavaTXWorkspaceService.java         -> Language-Server Features for the Workspace

If you want to bundle and build the extension by yourself

To bundle and build the extension you can follow these steps:

  1. Package the LanguageServer with maven:package.
  2. Open the VS-Code Client and run npm install.
  3. run npm run compile
  4. install vsce npm install -g @vscode/vsce
  5. run vsce package and use the .vsix File as Extension in VS Code

Known Problems and what to do

  1. Currently the import statement after a selection of a type is not added. Please add it by yourself.

Logic

The Language Server in itself can be used for any Client. The Clients task is to start the Langauge Server and handle the Communication with it.

Diagram

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:

  1. package the JavaTX Compiler
  2. take the Jar-File and copy it into the /lib Folder
  3. execute this Maven command to add the Jar in your local Repository: mvn install:install-file -Dfile=lib/JavaTXcompiler-0.1-jar-with-dependencies.jar -DgroupId=de.dhbwstuttgart -DartifactId=JavaTXcompiler -Dversion=0.1 -Dpackaging=jar
  4. run maven clean, validate and install to load the new Dependency
  5. you can now package the Language Server or change the code accordingly.
Description
Language Server for JavaTX including various Clients.
Readme 526 MiB
2025-06-05 12:51:51 +00:00
Languages
Java 95%
TypeScript 4.2%
JavaScript 0.8%