diff --git a/index.html b/index.html index ee11923aa..90a68733a 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@

Python language client and language server

Client for Python Pyright Language Server

Groovy language client and language server

Please execute npm run start:example:server:groovy beforehand:
- Client for Node.js Language Server + Client for Groovy Language Server

Langium client and language server

Client & Statemachine LS (Web Worker)
Localizations: German French and Spanish
diff --git a/packages/examples/.gitignore b/packages/examples/.gitignore index 0388e142d..3d9c982b2 100644 --- a/packages/examples/.gitignore +++ b/packages/examples/.gitignore @@ -1 +1,2 @@ resources/themes +src/groovy/server/groovy-language-server-all.jar diff --git a/packages/examples/src/common/model.ts b/packages/examples/src/common/model.ts index caaaab0d4..ce910feca 100644 --- a/packages/examples/src/common/model.ts +++ b/packages/examples/src/common/model.ts @@ -4,11 +4,18 @@ * ------------------------------------------------------------------------------------------ */ import * as cp from 'child_process'; import { ServerOptions } from 'ws'; + +export enum LanguageCli { + /** https://nodejs.org/api/cli.html */ + node = 'node', + /** https://docs.oracle.com/en/java/javase/21/docs/specs/man/java.html */ + java = 'java' +} export interface LanguageServerRunConfig { serverName: string; pathName: string; serverPort: number; - runCommand: string; // 'node', 'java' , etc. + runCommand: LanguageCli; runCommandArgs: string[]; wsServerOptions: ServerOptions, spawnOptions?: cp.SpawnOptions; diff --git a/packages/examples/src/groovy/config.ts b/packages/examples/src/groovy/config.ts index 2b8e17289..6e5a7f7e6 100644 --- a/packages/examples/src/groovy/config.ts +++ b/packages/examples/src/groovy/config.ts @@ -4,6 +4,6 @@ * ------------------------------------------------------------------------------------------ */ export const groovyConfig = { - port: 3001, + port: 3002, path: '/groovy' }; diff --git a/packages/examples/src/groovy/server/main.ts b/packages/examples/src/groovy/server/main.ts index 733ee8d32..672333588 100644 --- a/packages/examples/src/groovy/server/main.ts +++ b/packages/examples/src/groovy/server/main.ts @@ -6,13 +6,14 @@ import { runLanguageServer } from '../../common/language-server-runner.js'; import { resolve } from 'path'; import { groovyConfig } from '../config.js'; +import { LanguageCli } from '../../common/model.js'; export const runGroovyLanguageServer = (baseDir: string, relativeDir: string) => { const processRunPath = resolve(baseDir, relativeDir); runLanguageServer({ serverName: 'GROOVY', pathName: groovyConfig.path, serverPort: groovyConfig.port, - runCommand: 'java', + runCommand: LanguageCli.java, runCommandArgs: [ '-jar', processRunPath diff --git a/packages/examples/src/json/server/main.ts b/packages/examples/src/json/server/main.ts index 738927af8..0b2b86c82 100644 --- a/packages/examples/src/json/server/main.ts +++ b/packages/examples/src/json/server/main.ts @@ -4,6 +4,7 @@ * ------------------------------------------------------------------------------------------ */ import { runLanguageServer } from '../../common/language-server-runner.js'; import { resolve } from 'path'; +import { LanguageCli } from '../../common/model.js'; export const runJsonServer = (baseDir: string, relativeDir: string) => { const processRunPath = resolve(baseDir, relativeDir); @@ -11,7 +12,7 @@ export const runJsonServer = (baseDir: string, relativeDir: string) => { serverName: 'JSON', pathName: '/sampleServer', serverPort: 30000, - runCommand: 'node', + runCommand: LanguageCli.node, runCommandArgs: [ processRunPath, '--stdio' diff --git a/packages/examples/src/python/server/main.ts b/packages/examples/src/python/server/main.ts index d88304e3c..13b9d0e02 100644 --- a/packages/examples/src/python/server/main.ts +++ b/packages/examples/src/python/server/main.ts @@ -6,6 +6,7 @@ import { resolve } from 'path'; import { runLanguageServer } from '../../common/language-server-runner.js'; import { IncomingMessage } from 'http'; +import { LanguageCli } from '../../common/model.js'; export const runPythonServer = (baseDir: string, relativeDir: string) => { const processRunPath = resolve(baseDir, relativeDir); @@ -13,7 +14,7 @@ export const runPythonServer = (baseDir: string, relativeDir: string) => { serverName: 'PYRIGHT', pathName: '/pyright', serverPort: 30001, - runCommand: 'node', + runCommand: LanguageCli.node, runCommandArgs: [ processRunPath, '--stdio'