This is an experimental implementation of LSP based project intended to provide support for a DRL text editor.
It is composed of 2 parts: the server containing the actual LSP implementation and the client which is a VSCode extension consuming the services provided by the server.
The server is a plain Java/Maven project. Executing a mvn clean package
in its folder will generate a jar file that will be automatically linked and consumed by the client when executed as a VSCode extension.
The server part is composed of three modules:
- drools-parser
- drools-completion
- drools-lsp-server
drools-parser is responsible for actual drl-syntax parsing, eventually invoking a JAVA-LSP engine to read the RHS
content (that is plain Java code); it depends on org.drools:drools-drl-ast
drools-completion is used to provide completion suggestion using the C3 engine; it depends on com.vmware.antlr4-c3:antlr4-c3
and on drools-parser
drools-lsp-server is the "gateway" between the client and the parsing/completion logic; by itself it should not implement any business logic, but should be concerned only with communication; it depends directly on drools-completion
Precompiled-server - no debug
- package server side code with
mvn clean package
- goto
client
directory - issue
npm install
- issue
code .
to start VSCODE in that directory - inside VSCODE, select
Run and Debug
(Ctrl+Shift+D) and then startRun Extension
- a new
Extension Development Host
window will appear, withdrl
extension enabled - to "debug" server-side event, add
server.getClient().showMessage(new MessageParams(MessageType.Info, {text}));
in server-side code
Connected remote server - debug
- package server side code with
mvn clean package
- start server with
DroolsLspTCPLauncher
from IDE on debug mode; this will start the LSP-server listening on port9925
- goto
client
directory - issue
npm install
- issue
code .
to start VSCODE in that directory - inside VSCODE, select
Run and Debug
(Ctrl+Shift+D) and then startDebug Extension
- the extensions will establish a connection to the server running at port
9925
- a new
Extension Development Host
window will appear, withdrl
extension enabled - to "debug" server-side event, add breakpoints in server-side code