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.
- Give Hint of all possible Types to Select from
- import Type when Type is selected and not yet imported
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
Usage
To use this Language Server you have to follow this steps:
- Package the LanguageServer with
maven:package
. - Open the VS-Code Client and run
npm install
. - run
npm run compile
- Go to Debug and Run the Extension.
- Press F1 and execute the Hello World Command.
- You can create .java Files which will be analysed by the Language Server.
Known Problems and what to do
- If the TypeInference does not display any Typehints or Typeselection, restart the IDE including the Extension thus deleting the Cache.
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.
Description
Languages
Java
99.8%
TypeScript
0.2%