Skip to content

Commit 296bb89

Browse files
authored
Merge pull request #734 from TypeFox/clangd-example
Add Clangd-wasm example, build LS images with GHA
2 parents d60e9fd + 8531e4e commit 296bb89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8039
-13
lines changed

.github/workflows/actions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010
branches:
1111
- main
12+
workflow_dispatch:
1213

1314
jobs:
1415
build:

.github/workflows/ls-clangd.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Clangd LS Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
REPO_NAME: ${{ github.repository }}
9+
PATH_CONTEXT: ./packages/examples/resources/clangd
10+
CONTAINER_NAME_CONFIGURE: clangd-wasm-configure
11+
CONTAINER_NAME_BUILD: clangd-wasm-build
12+
13+
jobs:
14+
images-clangd-wasm:
15+
name: Build & Deploy Clangd LS
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
24+
timeout-minutes: 150
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (configure)
37+
id: meta_configure
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: |
41+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }}
42+
# enforce latest tag for now
43+
tags: |
44+
type=raw,value=latest
45+
46+
- name: Build & Push (configure)
47+
id: push_configure
48+
uses: docker/build-push-action@v6
49+
with:
50+
context: ${{ env.PATH_CONTEXT }}
51+
file: ${{ env.PATH_CONTEXT }}/configure.Dockerfile
52+
push: true
53+
tags: ${{ steps.meta_configure.outputs.tags }}
54+
labels: ${{ steps.meta_configure.outputs.labels }}
55+
56+
- name: Attest (configure)
57+
uses: actions/attest-build-provenance@v1
58+
with:
59+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }}
60+
subject-digest: ${{ steps.push_configure.outputs.digest }}
61+
push-to-registry: true
62+
63+
- name: Extract metadata (build)
64+
id: meta_build
65+
uses: docker/metadata-action@v5
66+
with:
67+
images: |
68+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }}
69+
# enforce latest tag for now
70+
tags: |
71+
type=raw,value=latest
72+
73+
- name: Build & Push (build)
74+
id: push_build
75+
uses: docker/build-push-action@v6
76+
with:
77+
context: ${{ env.PATH_CONTEXT }}
78+
file: ${{ env.PATH_CONTEXT }}/build.Dockerfile
79+
push: true
80+
tags: ${{ steps.meta_build.outputs.tags }}
81+
labels: ${{ steps.meta_build.outputs.labels }}
82+
83+
- name: Attest (build)
84+
uses: actions/attest-build-provenance@v1
85+
with:
86+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }}
87+
subject-digest: ${{ steps.push_build.outputs.digest }}
88+
push-to-registry: true

.github/workflows/ls-eclipsejdt.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Eclipse JDT LS Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
REPO_NAME: ${{ github.repository }}
9+
PATH_CONTEXT: ./packages/examples/resources/eclipse.jdt.ls
10+
CONTAINER_NAME: eclipse.jdt.ls
11+
12+
jobs:
13+
image-eclipsejdtls:
14+
name: Build & Deploy Eclipse JDT LS
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
timeout-minutes: 15
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: |
40+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
41+
# enforce latest tag for now
42+
tags: |
43+
type=raw,value=latest
44+
45+
- name: Build & Push
46+
id: push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
file: ${{ env.PATH_CONTEXT }}/Dockerfile
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
55+
- name: Attest
56+
uses: actions/attest-build-provenance@v1
57+
with:
58+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
59+
subject-digest: ${{ steps.push.outputs.digest }}
60+
push-to-registry: true

.github/workflows/ls-groovy.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Groovy LS Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
REPO_NAME: ${{ github.repository }}
9+
PATH_CONTEXT: ./packages/examples/resources/groovy
10+
CONTAINER_NAME: groovy.ls
11+
12+
jobs:
13+
image-groovyls:
14+
name: Build & Deploy Groovy LS
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
timeout-minutes: 15
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Login to GitHub Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: |
40+
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
41+
# enforce latest tag for now
42+
tags: |
43+
type=raw,value=latest
44+
45+
- name: Build & Push
46+
id: push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
file: ${{ env.PATH_CONTEXT }}/Dockerfile
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
55+
- name: Attest
56+
uses: actions/attest-build-provenance@v1
57+
with:
58+
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
59+
subject-digest: ${{ steps.push.outputs.digest }}
60+
push-to-registry: true

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Click [here](https://www.typefox.io/blog/teaching-the-language-server-protocol-t
2727
- [Python Language client and pyright language server example (Location)](#python-language-client-and-pyright-language-server-example-location)
2828
- [Groovy Language client and language server example (Location)](#groovy-language-client-and-language-server-example-location)
2929
- [Java Language client and language server example (Location)](#java-language-client-and-language-server-example-location)
30+
- [Cpp / Clangd (Location)](#cpp--clangd-location)
3031
- [Langium grammar DSL (Location)](#langium-grammar-dsl-location)
3132
- [Statemachine DSL (created with Langium) (Location)](#statemachine-dsl-created-with-langium-location)
3233
- [bare monaco-languageclient (Location)](#bare-monaco-languageclient-location)
@@ -138,6 +139,10 @@ The **java-client** contains the [monaco-editor-wrapper app](./packages/examples
138139

139140
Langium examples (here client and server communicate via `vscode-languageserver-protocol/browser` instead of a web socket used in the three examples above
140141

142+
#### Cpp / Clangd ([Location](./packages/examples/src/clangd))
143+
144+
It contains both the [language client](./packages/examples/src/clangd/client/main.ts) and the [langauge server (web worker)](./packages/examples/src/clangd/worker/clangd-server.ts). The clangd language server is compiled to wasm so it can be executed in the browser.
145+
141146
#### Langium grammar DSL ([Location](./packages/examples/src/langium/langium-dsl))
142147

143148
It contains both the [language client](./packages/examples/src/langium/langium-dsl/wrapperLangium.ts) and the [langauge server (web worker)](./packages/examples/src/langium/langium-dsl/worker/langium-server.ts). Here you can chose beforehand if the wrapper should be started in classic or extended mode.
@@ -183,11 +188,11 @@ npm run start:example:server:python
183188

184189
##### Groovy Language Server
185190

186-
For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it.
191+
For the **groovy-client** example you need to ensure the **groovy-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Gradle). From the project root run `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/groovy/docker-compose.yml down` to stop it.
187192

188193
##### Java Language Server
189194

190-
For the **java-client** example you need to ensure the **java-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Eclipse JDT LS). From the project root run `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d`. First start up will take longer as the container is built. Use `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml down` to stop it.
195+
For the **java-client** example you need to ensure the **java-server** example is running. You require **docker-compose** which does not require any manual setup (OpenJDK / Eclipse JDT LS). From the project root run `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml up -d`. First start up will take longer as the container is downloaded from GitHub's container registry. Use `docker-compose -f ./packages/examples/resources/eclipse.jdt.ls/docker-compose.yml down` to stop it.
191196

192197
### Verification Examples & Usage
193198

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ <h3>Groovy</h3>
5454
<a href="./packages/examples/groovy.html">Groovy Language Client & Language Server (Web Socket)</a>
5555
<br>
5656

57+
<h3>Cpp / Clangd</h3>
58+
<a href="./packages/examples/clangd.html">Cpp Language Client & Clangd Language Server (Worker/Wasm)</a>
59+
<br>
60+
5761
<h3>Multiple Languageclients</h3>
5862
Please execute <b><code>npm run start:example:server:python</code></b> and <b><code>npm run start:example:server:json</code></b> beforehand:<br>
5963
<a href="./packages/examples/two_langauge_clients.html">Json & Python Languageclients & Language Server (Web Socket)</a>

package-lock.json

Lines changed: 26 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/client/CHANGELOG.md

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

55
## [9.0.0-next.5] - 2024-10-23
66

7+
- Prototype: File system endpoint.
78
- Added `createUrl` to `monaco-languageclient/tools`. Moved it here from `monaco-editor-wrapper`.
89
- Updated to eslint 9
910
- Support all arguments for monaco-vscode-api `initialize` [#756](https://github.com/TypeFox/monaco-languageclient/pull/756)

packages/client/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
"./vscode/services": {
3232
"types": "./lib/vscode/index.d.ts",
3333
"default": "./lib/vscode/index.js"
34+
},
35+
"./fs": {
36+
"types": "./lib/fs/index.d.ts",
37+
"default": "./lib/fs/index.js"
3438
}
3539
},
3640
"typesVersions": {
@@ -43,6 +47,9 @@
4347
],
4448
"vscode/services": [
4549
"lib/vscode/index"
50+
],
51+
"fs": [
52+
"lib/fs/index"
4653
]
4754
}
4855
},

0 commit comments

Comments
 (0)