Skip to content

Commit 66050c4

Browse files
committed
Harmonize groovy and eclipse.jdt.ls setup and how the server is executed
- use vite-node for all servers - disable wordBasedSuggestions for all client with external servers
1 parent a381495 commit 66050c4

File tree

20 files changed

+71
-78
lines changed

20 files changed

+71
-78
lines changed

.dockerignore

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1 @@
1-
## Linked packages are problematic during build, npm i during start will fix it
2-
#node_modules/@typefox/monaco-editor-react
3-
#node_modules/example-client-vite
4-
#node_modules/example-client-webpack
5-
#node_modules/monaco-languageclient
6-
#node_modules/monaco-editor-wrapper
7-
#node_modules/monaco-languageclient-examples
8-
#node_modules/vscode-ws-jsonrpc
9-
101
node_modules

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@
2020
"[json]": {
2121
"editor.defaultFormatter": "vscode.json-language-features"
2222
}
23-
2423
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h3>Python</h3>
4444
Please execute <b><code>npm run start:example:server:python</code></b> beforehand:<br>
4545
<a href="./packages/examples/python.html">Python Language Client & Pyright Language Server (Web Socket)</a><br>
4646

47-
<h3>Java</h3>
47+
<h3>Java / Eclipse JDS LS</h3>
4848
Requires docker. Please execute <b><code>docker compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d</code></b> beforehand:<br>
4949
<a href="./packages/examples/eclipse.jdt.ls.html">Java Language Client & Language Server (Web Socket)</a>
5050
<br>

packages/client/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this npm module are documented in this file.
44

55
## [8.7.0] - 2024-07-1x
66

7-
- Update to latest monaco-vscode-api [#7xx](https://github.com/TypeFox/monaco-languageclient/pull/7xx)
7+
- Update to latest monaco-vscode-api [#707](https://github.com/TypeFox/monaco-languageclient/pull/7xx)
88
- Updated to version `7.0.3` of `@codingame/monaco-vscode` packages
99

1010
## [8.6.0] - 2024-06-29

packages/examples/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to this npm module are documented in this file.
44

55
## [2024.7.3] - 2024-07-1x
66

7-
- Update to latest monaco-vscode-api [#7xx](https://github.com/TypeFox/monaco-languageclient/pull/7xx)
7+
- Update to latest monaco-vscode-api [#707](https://github.com/TypeFox/monaco-languageclient/pull/707)
88
- Updated to `[email protected]`, `[email protected]` and `@typefox/[email protected]`. Updated all `@codingame/monaco-vscode` packages to `7.0.3`.
99

1010
## [2024.7.2] - 2024-07-02

packages/examples/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@
117117
"build:msg": "echo Building main examples:",
118118
"build": "npm run build:msg && npm run clean && npm run resources:download && npm run compile",
119119
"build:bundle": "vite --config vite.bundle.config.ts build",
120-
"start:server:json": "node --loader ts-node/esm src/json/server/direct.ts",
121-
"start:server:python": "node --loader ts-node/esm src/python/server/direct.ts",
122-
"start:server:groovy": "node --watch --loader ts-node/esm src/groovy/server/direct.ts",
120+
"start:server:json": "vite-node src/json/server/direct.ts",
121+
"start:server:python": "vite-node src/python/server/direct.ts",
122+
"start:server:groovy": "vite-node src/groovy/server/direct.ts",
123123
"start:server:jdtls": "vite-node src/eclipse.jdt.ls/server/direct.ts",
124124
"langium:generate": "langium generate --file ./src/langium/statemachine/config/langium-config.json"
125125
}
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM eclipse-temurin:17-jdk
22

3-
ARG MLC_PATH=/home/mlc
4-
ARG ECLIPSE_JDT_PATH=${MLC_PATH}/packages/examples/resources/eclipse.jdt.ls/ls
3+
ARG PATH_MLC=/home/mlc
4+
ARG PATH_ECLIPSE_JDT=${PATH_MLC}/packages/examples/resources/eclipse.jdt.ls/ls
55
ARG JDT_TAR_URL=https://download.eclipse.org/jdtls/milestones/1.37.0/jdt-language-server-1.37.0-202406271335.tar.gz
66
ARG JDT_TAR_LOCAL=eclipse.jdt.ls.tar.gz
77

@@ -15,15 +15,18 @@ ENV VOLTA_HOME "/root/.volta"
1515
ENV PATH "$VOLTA_HOME/bin:$PATH"
1616
RUN volta install node@20
1717

18-
RUN mkdir -p ${MLC_PATH}
18+
# prepare
19+
RUN mkdir -p ${PATH_MLC}
1920

20-
COPY ./ ${MLC_PATH}
21+
# copy repo content
22+
COPY ./ ${PATH_MLC}
2123

22-
RUN mkdir -p ${ECLIPSE_JDT_PATH} \
23-
&& cd ${ECLIPSE_JDT_PATH} \
24+
# download and extract Eclipse JDT LS in target folder
25+
RUN mkdir -p ${PATH_ECLIPSE_JDT} \
26+
&& cd ${PATH_ECLIPSE_JDT} \
2427
&& wget -O ${JDT_TAR_LOCAL} ${JDT_TAR_URL} \
2528
&& tar -xzf ${JDT_TAR_LOCAL}
2629

27-
WORKDIR ${MLC_PATH}
30+
WORKDIR ${PATH_MLC}
2831

2932
CMD ["/bin/bash", "npm i && npm run start:example:server:jdtls"]

packages/examples/resources/eclipse.jdt.ls/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
dockerfile: ./packages/examples/resources/eclipse.jdt.ls/Dockerfile
55
context: ../../../..
66
environment:
7-
- MLC_PATH=/home/mlc
7+
- PATH_MLC=/home/mlc
88
- JDT_TAR_URL=https://download.eclipse.org/jdtls/milestones/1.37.0/jdt-language-server-1.37.0-202406271335.tar.gz
99
- JDT_TAR_LOCAL=eclipse.jdt.ls.tar.gz
1010
command: [
Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
11
FROM gradle:7-jdk17-focal
22

3-
ARG MLC_PATH=/home/gradle/mlc
3+
ARG HOME_DIR=/home/gradle
4+
ARG PATH_MLC=${HOME_DIR}/mlc
5+
ARG PATH_GLS=${HOME_DIR}/groovy-language-server
6+
ARG PATH_GROOVY_JAR=${PATH_MLC}/packages/examples/resources/groovy/lib
47

58
RUN apt update \
6-
&& apt upgrade -y \
7-
&& apt install -y ca-certificates curl gnupg unzip
9+
&& apt upgrade -y
10+
RUN apt install -y curl
811

912
RUN curl https://get.volta.sh | bash
1013
ENV VOLTA_FEATURE_PNPM=1
1114
ENV VOLTA_HOME "/root/.volta"
1215
ENV PATH "$VOLTA_HOME/bin:$PATH"
1316
RUN volta install node@20
1417

15-
RUN git clone https://github.com/GroovyLanguageServer/groovy-language-server \
16-
&& cd groovy-language-server \
18+
# prepare
19+
RUN cd ${HOME_DIR} \
20+
&& mkdir -p ${PATH_MLC}
21+
22+
# build groovy language server
23+
RUN cd ${HOME_DIR} \
24+
&& git clone https://github.com/GroovyLanguageServer/groovy-language-server \
25+
&& cd ${PATH_GLS} \
1726
&& ./gradlew build \
18-
&& cd ..
27+
&& cd ${HOME_DIR}
28+
29+
# copy repo content
30+
COPY ./ ${PATH_MLC}
1931

20-
RUN mkdir -p ${MLC_PATH}
32+
# copy language server to target
33+
RUN mkdir -p ${PATH_GROOVY_JAR} \
34+
&& cp ${PATH_GLS}/build/libs/groovy-language-server-all.jar ${PATH_GROOVY_JAR}
2135

22-
COPY ./ ${MLC_PATH}
36+
WORKDIR ${PATH_MLC}
2337

24-
WORKDIR ${MLC_PATH}
38+
CMD ["/bin/bash", "npm i && npm run start:example:server:groovy"]

packages/examples/resources/groovy/docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ services:
44
dockerfile: ./packages/examples/resources/groovy/Dockerfile
55
context: ../../../..
66
environment:
7-
- LANG_SERVER_JAR_PATH=/home/gradle/groovy-language-server/build/libs/groovy-language-server-all.jar
7+
- HOME_DIR=/home/gradle
8+
- PATH_MLC=/home/gradle/mlc
9+
- PATH_GLS=/home/gradle/groovy-language-server
10+
- PATH_GROOVY_JAR=/home/gradle/mlc/packages/examples/resources/groovy/lib
811
command: [
912
"bash", "-c", "npm i && npm run start:example:server:groovy"
1013
]

packages/examples/src/eclipse.jdt.ls/client/main.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-
99
import '@codingame/monaco-vscode-java-default-extension';
1010
import { MonacoEditorLanguageClientWrapper, UserConfig } from 'monaco-editor-wrapper';
1111
import { useWorkerFactory } from 'monaco-editor-wrapper/workerFactory';
12-
import { RegisteredFileSystemProvider, RegisteredMemoryFile } from '@codingame/monaco-vscode-files-service-override';
13-
import helloJavaCode from '../../../resources/eclipse.jdt.ls/workspace/hello.java?raw';
12+
import { RegisteredFileSystemProvider, RegisteredMemoryFile, registerFileSystemOverlay } from '@codingame/monaco-vscode-files-service-override';
1413
import { eclipseJdtLsConfig } from '../config';
14+
import helloJavaCode from '../../../resources/eclipse.jdt.ls/workspace/hello.java?raw';
1515

1616
export const configureMonacoWorkers = () => {
1717
useWorkerFactory({
@@ -26,6 +26,7 @@ export const runEclipseJdtLsClient = () => {
2626
const helloJavaUri = vscode.Uri.file(`${eclipseJdtLsConfig.basePath}/workspace/hello.java`);
2727
const fileSystemProvider = new RegisteredFileSystemProvider(false);
2828
fileSystemProvider.registerFile(new RegisteredMemoryFile(helloJavaUri, helloJavaCode));
29+
registerFileSystemOverlay(1, fileSystemProvider);
2930

3031
const userConfig: UserConfig = {
3132
wrapperConfig: {
@@ -47,7 +48,8 @@ export const runEclipseJdtLsClient = () => {
4748
userConfiguration: {
4849
json: JSON.stringify({
4950
'workbench.colorTheme': 'Default Dark Modern',
50-
'editor.guides.bracketPairsHorizontal': 'active'
51+
'editor.guides.bracketPairsHorizontal': 'active',
52+
'editor.wordBasedSuggestions': 'off'
5153
})
5254
}
5355
}
@@ -75,7 +77,12 @@ export const runEclipseJdtLsClient = () => {
7577
try {
7678
document.querySelector('#button-start')?.addEventListener('click', async () => {
7779
await wrapper.dispose();
78-
await wrapper.initAndStart(userConfig, htmlElement);
80+
await wrapper.init(userConfig);
81+
82+
// open files, so the LS can pick it up
83+
await vscode.workspace.openTextDocument(helloJavaUri);
84+
85+
await wrapper.start(htmlElement);
7986
});
8087
document.querySelector('#button-dispose')?.addEventListener('click', async () => {
8188
await wrapper.dispose();

packages/examples/src/groovy/client/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ const userConfig: UserConfig = {
4444
userConfiguration: {
4545
json: JSON.stringify({
4646
'workbench.colorTheme': 'Default Dark Modern',
47-
'editor.guides.bracketPairsHorizontal': 'active'
47+
'editor.guides.bracketPairsHorizontal': 'active',
48+
'editor.wordBasedSuggestions': 'off'
4849
})
4950
}
5051
}

packages/examples/src/groovy/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
* ------------------------------------------------------------------------------------------ */
55
export const groovyConfig = {
66
port: 30002,
7-
path: '/groovy'
7+
path: '/groovy',
8+
basePath: '/home/gradle/mlc/packages/examples/resources/groovy'
89
};

packages/examples/src/groovy/server/README.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/examples/src/groovy/server/direct.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@
33
* Licensed under the MIT License. See LICENSE in the package root for license information.
44
* ------------------------------------------------------------------------------------------ */
55

6-
import { resolve } from 'node:path';
76
import { runGroovyLanguageServer } from './main.js';
8-
import { getLocalDirectory } from '../../common/node/server-commons.js';
97

10-
const baseDir = resolve(getLocalDirectory(import.meta.url));
11-
const groovyJar = resolve(baseDir, '../../../resources/groovy/external/groovy-language-server-all.jar');
12-
const relativeDir = process.env.LANG_SERVER_JAR_PATH ?? groovyJar;
13-
console.log(`basedir: ${baseDir}`);
14-
console.log(`groovyJar: ${groovyJar}`);
15-
console.log(`LANG_SERVER_JAR_PATH: ${process.env.LANG_SERVER_JAR_PATH}`);
16-
console.log(`relativeDir: ${relativeDir}`);
17-
18-
runGroovyLanguageServer(baseDir, relativeDir);
8+
runGroovyLanguageServer();

packages/examples/src/groovy/server/main.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
* Licensed under the MIT License. See LICENSE in the package root for license information.
44
* ------------------------------------------------------------------------------------------ */
55

6-
import { resolve } from 'node:path';
76
import { runLanguageServer } from '../../common/node/language-server-runner.js';
87
import { LanguageName } from '../../common/node/server-commons.js';
98
import { groovyConfig } from '../config.js';
109

11-
export const runGroovyLanguageServer = (baseDir: string, relativeDir: string) => {
12-
const processRunPath = resolve(baseDir, relativeDir);
10+
export const runGroovyLanguageServer = () => {
1311
runLanguageServer({
1412
serverName: 'GROOVY',
1513
pathName: groovyConfig.path,
1614
serverPort: groovyConfig.port,
1715
runCommand: LanguageName.java,
1816
runCommandArgs: [
1917
'-jar',
20-
processRunPath
18+
`${groovyConfig.basePath}/lib/groovy-language-server-all.jar`
2119
],
2220
wsServerOptions: {
2321
noServer: true,

packages/examples/src/json/client/wrapperWs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export const jsonClientUserConfig: UserConfig = {
4545
json: JSON.stringify({
4646
'workbench.colorTheme': 'Default Dark Modern',
4747
'editor.guides.bracketPairsHorizontal': 'active',
48-
'editor.lightbulb.enabled': 'On'
48+
'editor.lightbulb.enabled': 'On',
49+
'editor.wordBasedSuggestions': 'off'
4950
})
5051
}
5152
}

packages/examples/src/python/client/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export const createUserConfig = (workspaceRoot: string, code: string, codeUri: s
6565
},
6666
userConfiguration: {
6767
json: JSON.stringify({
68-
'workbench.colorTheme': 'Default Dark Modern'
68+
'workbench.colorTheme': 'Default Dark Modern',
69+
'editor.guides.bracketPairsHorizontal': 'active',
70+
'editor.wordBasedSuggestions': 'off'
6971
})
7072
},
7173
useDiffEditor: false

packages/wrapper-react/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ All notable changes to npm module [@typefox/monaco-editor-react](https://www.npm
44

55
## [4.4.0] - 2024-07-1x
66

7-
- Update to latest monaco-vscode-api [#7xx](https://github.com/TypeFox/monaco-languageclient/pull/7xx)
7+
- Update to latest monaco-vscode-api [#707](https://github.com/TypeFox/monaco-languageclient/pull/707)
88
- Updated to `[email protected]`, `[email protected]` and version `7.0.3` of `@codingame/monaco-vscode` packages
99

1010
## [4.3.2] - 2024-07-02

packages/wrapper/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ All notable changes to npm module [monaco-editor-wrapper](https://www.npmjs.com/
44

55
## [5.4.0] - 2024-07-1x
66

7-
- Update to latest monaco-vscode-api [#7xx](https://github.com/TypeFox/monaco-languageclient/pull/7x)
7+
- Update to latest monaco-vscode-api [#707](https://github.com/TypeFox/monaco-languageclient/pull/707)
88
- Updated to `[email protected]`, `7.0.3` of `@codingame/monaco-vscode` packages
9+
- Add Eclipse JDT Language Server example [#708](https://github.com/TypeFox/monaco-languageclient/pull/708)
10+
- Harmonize the Groovy Language Server configuration and execution, both are container based
911

1012
## [5.3.1] - 2024-07-02
1113

0 commit comments

Comments
 (0)