Skip to content

Commit

Permalink
Harmonize groovy and eclipse.jdt.ls setup and how the server is executed
Browse files Browse the repository at this point in the history
- use vite-node for all servers
- disable wordBasedSuggestions for all client with external servers
  • Loading branch information
kaisalmen committed Jul 12, 2024
1 parent a381495 commit 07af662
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 75 deletions.
9 changes: 0 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
## Linked packages are problematic during build, npm i during start will fix it
#node_modules/@typefox/monaco-editor-react
#node_modules/example-client-vite
#node_modules/example-client-webpack
#node_modules/monaco-languageclient
#node_modules/monaco-editor-wrapper
#node_modules/monaco-languageclient-examples
#node_modules/vscode-ws-jsonrpc

node_modules
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
}

}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h3>Python</h3>
Please execute <b><code>npm run start:example:server:python</code></b> beforehand:<br>
<a href="./packages/examples/python.html">Python Language Client & Pyright Language Server (Web Socket)</a><br>

<h3>Java</h3>
<h3>Java / Eclipse JDS LS</h3>
Requires docker. Please execute <b><code>docker compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d</code></b> beforehand:<br>
<a href="./packages/examples/eclipse.jdt.ls.html">Java Language Client & Language Server (Web Socket)</a>
<br>
Expand Down
2 changes: 1 addition & 1 deletion packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this npm module are documented in this file.

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

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

## [8.6.0] - 2024-06-29
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this npm module are documented in this file.

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

- Update to latest monaco-vscode-api [#7xx](https://github.com/TypeFox/monaco-languageclient/pull/7xx)
- Update to latest monaco-vscode-api [#707](https://github.com/TypeFox/monaco-languageclient/pull/707)
- Updated to `monaco-languageclient@8.7.0`, `monaco-editor-wrapper@5.4.0` and `@typefox/monaco-editor-react@4.4.0`. Updated all `@codingame/monaco-vscode` packages to `7.0.3`.

## [2024.7.2] - 2024-07-02
Expand Down
6 changes: 3 additions & 3 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
"build:msg": "echo Building main examples:",
"build": "npm run build:msg && npm run clean && npm run resources:download && npm run compile",
"build:bundle": "vite --config vite.bundle.config.ts build",
"start:server:json": "node --loader ts-node/esm src/json/server/direct.ts",
"start:server:python": "node --loader ts-node/esm src/python/server/direct.ts",
"start:server:groovy": "node --watch --loader ts-node/esm src/groovy/server/direct.ts",
"start:server:json": "vite-node src/json/server/direct.ts",
"start:server:python": "vite-node src/python/server/direct.ts",
"start:server:groovy": "vite-node src/groovy/server/direct.ts",
"start:server:jdtls": "vite-node src/eclipse.jdt.ls/server/direct.ts",
"langium:generate": "langium generate --file ./src/langium/statemachine/config/langium-config.json"
}
Expand Down
17 changes: 10 additions & 7 deletions packages/examples/resources/eclipse.jdt.ls/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM eclipse-temurin:17-jdk

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

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

RUN mkdir -p ${MLC_PATH}
# prepare
RUN mkdir -p ${PATH_MLC}

COPY ./ ${MLC_PATH}
# copy repo content
COPY ./ ${PATH_MLC}

RUN mkdir -p ${ECLIPSE_JDT_PATH} \
&& cd ${ECLIPSE_JDT_PATH} \
# download and extract Eclipse JDT LS in target folder
RUN mkdir -p ${PATH_ECLIPSE_JDT} \
&& cd ${PATH_ECLIPSE_JDT} \
&& wget -O ${JDT_TAR_LOCAL} ${JDT_TAR_URL} \
&& tar -xzf ${JDT_TAR_LOCAL}

WORKDIR ${MLC_PATH}
WORKDIR ${PATH_MLC}

CMD ["/bin/bash", "npm i && npm run start:example:server:jdtls"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
dockerfile: ./packages/examples/resources/eclipse.jdt.ls/Dockerfile
context: ../../../..
environment:
- MLC_PATH=/home/mlc
- PATH_MLC=/home/mlc
- JDT_TAR_URL=https://download.eclipse.org/jdtls/milestones/1.37.0/jdt-language-server-1.37.0-202406271335.tar.gz
- JDT_TAR_LOCAL=eclipse.jdt.ls.tar.gz
command: [
Expand Down
32 changes: 23 additions & 9 deletions packages/examples/resources/groovy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
FROM gradle:7-jdk17-focal

ARG MLC_PATH=/home/gradle/mlc
ARG HOME_DIR=/home/gradle
ARG PATH_MLC=${HOME_DIR}/mlc
ARG PATH_GLS=${HOME_DIR}/groovy-language-server
ARG PATH_GROOVY_JAR=${PATH_MLC}/packages/examples/resources/groovy/lib

RUN apt update \
&& apt upgrade -y \
&& apt install -y ca-certificates curl gnupg unzip
&& apt upgrade -y
RUN apt install -y curl

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

RUN git clone https://github.com/GroovyLanguageServer/groovy-language-server \
&& cd groovy-language-server \
# prepare
RUN cd ${HOME_DIR} \
&& mkdir -p ${PATH_MLC}

# build groovy language server
RUN cd ${HOME_DIR} \
&& git clone https://github.com/GroovyLanguageServer/groovy-language-server \
&& cd ${PATH_GLS} \
&& ./gradlew build \
&& cd ..
&& cd ${HOME_DIR}

# copy repo content
COPY ./ ${PATH_MLC}

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

COPY ./ ${MLC_PATH}
WORKDIR ${PATH_MLC}

WORKDIR ${MLC_PATH}
CMD ["/bin/bash", "npm i && npm run start:example:server:groovy"]
5 changes: 4 additions & 1 deletion packages/examples/resources/groovy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ services:
dockerfile: ./packages/examples/resources/groovy/Dockerfile
context: ../../../..
environment:
- LANG_SERVER_JAR_PATH=/home/gradle/groovy-language-server/build/libs/groovy-language-server-all.jar
- HOME_DIR=/home/gradle
- PATH_MLC=/home/gradle/mlc
- PATH_GLS=/home/gradle/groovy-language-server
- PATH_GROOVY_JAR=/home/gradle/mlc/packages/examples/resources/groovy/lib
command: [
"bash", "-c", "npm i && npm run start:example:server:groovy"
]
Expand Down
3 changes: 2 additions & 1 deletion packages/examples/src/eclipse.jdt.ls/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const runEclipseJdtLsClient = () => {
userConfiguration: {
json: JSON.stringify({
'workbench.colorTheme': 'Default Dark Modern',
'editor.guides.bracketPairsHorizontal': 'active'
'editor.guides.bracketPairsHorizontal': 'active',
'editor.wordBasedSuggestions': 'off'
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/examples/src/groovy/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const userConfig: UserConfig = {
userConfiguration: {
json: JSON.stringify({
'workbench.colorTheme': 'Default Dark Modern',
'editor.guides.bracketPairsHorizontal': 'active'
'editor.guides.bracketPairsHorizontal': 'active',
'editor.wordBasedSuggestions': 'off'
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/examples/src/groovy/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
* ------------------------------------------------------------------------------------------ */
export const groovyConfig = {
port: 30002,
path: '/groovy'
path: '/groovy',
basePath: '/home/gradle/mlc/packages/examples/resources/groovy'
};
19 changes: 0 additions & 19 deletions packages/examples/src/groovy/server/README.md

This file was deleted.

12 changes: 1 addition & 11 deletions packages/examples/src/groovy/server/direct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */

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

const baseDir = resolve(getLocalDirectory(import.meta.url));
const groovyJar = resolve(baseDir, '../../../resources/groovy/external/groovy-language-server-all.jar');
const relativeDir = process.env.LANG_SERVER_JAR_PATH ?? groovyJar;
console.log(`basedir: ${baseDir}`);
console.log(`groovyJar: ${groovyJar}`);
console.log(`LANG_SERVER_JAR_PATH: ${process.env.LANG_SERVER_JAR_PATH}`);
console.log(`relativeDir: ${relativeDir}`);

runGroovyLanguageServer(baseDir, relativeDir);
runGroovyLanguageServer();
6 changes: 2 additions & 4 deletions packages/examples/src/groovy/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */

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

export const runGroovyLanguageServer = (baseDir: string, relativeDir: string) => {
const processRunPath = resolve(baseDir, relativeDir);
export const runGroovyLanguageServer = () => {
runLanguageServer({
serverName: 'GROOVY',
pathName: groovyConfig.path,
serverPort: groovyConfig.port,
runCommand: LanguageName.java,
runCommandArgs: [
'-jar',
processRunPath
`${groovyConfig.basePath}/lib/groovy-language-server-all.jar`
],
wsServerOptions: {
noServer: true,
Expand Down
3 changes: 2 additions & 1 deletion packages/examples/src/json/client/wrapperWs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const jsonClientUserConfig: UserConfig = {
json: JSON.stringify({
'workbench.colorTheme': 'Default Dark Modern',
'editor.guides.bracketPairsHorizontal': 'active',
'editor.lightbulb.enabled': 'On'
'editor.lightbulb.enabled': 'On',
'editor.wordBasedSuggestions': 'off'
})
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/examples/src/python/client/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export const createUserConfig = (workspaceRoot: string, code: string, codeUri: s
},
userConfiguration: {
json: JSON.stringify({
'workbench.colorTheme': 'Default Dark Modern'
'workbench.colorTheme': 'Default Dark Modern',
'editor.guides.bracketPairsHorizontal': 'active',
'editor.wordBasedSuggestions': 'off'
})
},
useDiffEditor: false
Expand Down
2 changes: 1 addition & 1 deletion packages/wrapper-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to npm module [@typefox/monaco-editor-react](https://www.npm

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

- Update to latest monaco-vscode-api [#7xx](https://github.com/TypeFox/monaco-languageclient/pull/7xx)
- Update to latest monaco-vscode-api [#707](https://github.com/TypeFox/monaco-languageclient/pull/707)
- Updated to `monaco-editor-wrapper@5.4.0`, `monaco-languageclient@8.7.0` and version `7.0.3` of `@codingame/monaco-vscode` packages

## [4.3.2] - 2024-07-02
Expand Down
4 changes: 3 additions & 1 deletion packages/wrapper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ All notable changes to npm module [monaco-editor-wrapper](https://www.npmjs.com/

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

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

## [5.3.1] - 2024-07-02

Expand Down

0 comments on commit 07af662

Please sign in to comment.