Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Clangd-wasm example, build LS images with GHA #734

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
build:
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/ls-clangd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Clangd LS Image

on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
REPO_NAME: ${{ github.repository }}
PATH_CONTEXT: ./packages/examples/resources/clangd
CONTAINER_NAME_CONFIGURE: clangd-wasm-configure
CONTAINER_NAME_BUILD: clangd-wasm-build

jobs:
images-clangd-wasm:
name: Build & Deploy Clangd LS
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

timeout-minutes: 150
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (configure)
id: meta_configure
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }}
# enforce latest tag for now
tags: |
type=raw,value=latest

- name: Build & Push (configure)
id: push_configure
uses: docker/build-push-action@v6
with:
context: ${{ env.PATH_CONTEXT }}
file: ${{ env.PATH_CONTEXT }}/configure.Dockerfile
push: true
tags: ${{ steps.meta_configure.outputs.tags }}
labels: ${{ steps.meta_configure.outputs.labels }}

- name: Attest (configure)
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_CONFIGURE }}
subject-digest: ${{ steps.push_configure.outputs.digest }}
push-to-registry: true

- name: Extract metadata (build)
id: meta_build
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }}
# enforce latest tag for now
tags: |
type=raw,value=latest

- name: Build & Push (build)
id: push_build
uses: docker/build-push-action@v6
with:
context: ${{ env.PATH_CONTEXT }}
file: ${{ env.PATH_CONTEXT }}/build.Dockerfile
push: true
tags: ${{ steps.meta_build.outputs.tags }}
labels: ${{ steps.meta_build.outputs.labels }}

- name: Attest (build)
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME_BUILD }}
subject-digest: ${{ steps.push_build.outputs.digest }}
push-to-registry: true
60 changes: 60 additions & 0 deletions .github/workflows/ls-eclipsejdt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Eclipse JDT LS Image

on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
REPO_NAME: ${{ github.repository }}
PATH_CONTEXT: ./packages/examples/resources/eclipse.jdt.ls
CONTAINER_NAME: eclipse.jdt.ls

jobs:
image-eclipsejdtls:
name: Build & Deploy Eclipse JDT LS
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
# enforce latest tag for now
tags: |
type=raw,value=latest

- name: Build & Push
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.PATH_CONTEXT }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
60 changes: 60 additions & 0 deletions .github/workflows/ls-groovy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Groovy LS Image

on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
REPO_NAME: ${{ github.repository }}
PATH_CONTEXT: ./packages/examples/resources/groovy
CONTAINER_NAME: groovy.ls

jobs:
image-groovyls:
name: Build & Deploy Groovy LS
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
# enforce latest tag for now
tags: |
type=raw,value=latest

- name: Build & Push
id: push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ env.PATH_CONTEXT }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ env.CONTAINER_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Click [here](https://www.typefox.io/blog/teaching-the-language-server-protocol-t
- [Python Language client and pyright language server example (Location)](#python-language-client-and-pyright-language-server-example-location)
- [Groovy Language client and language server example (Location)](#groovy-language-client-and-language-server-example-location)
- [Java Language client and language server example (Location)](#java-language-client-and-language-server-example-location)
- [Cpp / Clangd (Location)](#cpp--clangd-location)
- [Langium grammar DSL (Location)](#langium-grammar-dsl-location)
- [Statemachine DSL (created with Langium) (Location)](#statemachine-dsl-created-with-langium-location)
- [bare monaco-languageclient (Location)](#bare-monaco-languageclient-location)
Expand Down Expand Up @@ -138,6 +139,10 @@ The **java-client** contains the [monaco-editor-wrapper app](./packages/examples

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

#### Cpp / Clangd ([Location](./packages/examples/src/clangd))

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.

#### Langium grammar DSL ([Location](./packages/examples/src/langium/langium-dsl))

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.
Expand Down Expand Up @@ -183,11 +188,11 @@ npm run start:example:server:python

##### Groovy Language Server

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.
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.

##### Java Language Server

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.
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.

### Verification Examples & Usage

Expand Down
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ <h3>Groovy</h3>
<a href="./packages/examples/groovy.html">Groovy Language Client & Language Server (Web Socket)</a>
<br>

<h3>Cpp / Clangd</h3>
<a href="./packages/examples/clangd.html">Cpp Language Client & Clangd Language Server (Worker/Wasm)</a>
<br>

<h3>Multiple Languageclients</h3>
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>
<a href="./packages/examples/two_langauge_clients.html">Json & Python Languageclients & Language Server (Web Socket)</a>
Expand Down
27 changes: 26 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this npm module are documented in this file.

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

- Prototype: File system endpoint.
- Added `createUrl` to `monaco-languageclient/tools`. Moved it here from `monaco-editor-wrapper`.
- Updated to eslint 9
- Support all arguments for monaco-vscode-api `initialize` [#756](https://github.com/TypeFox/monaco-languageclient/pull/756)
Expand Down
7 changes: 7 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"./vscode/services": {
"types": "./lib/vscode/index.d.ts",
"default": "./lib/vscode/index.js"
},
"./fs": {
"types": "./lib/fs/index.d.ts",
"default": "./lib/fs/index.js"
}
},
"typesVersions": {
Expand All @@ -43,6 +47,9 @@
],
"vscode/services": [
"lib/vscode/index"
],
"fs": [
"lib/fs/index"
]
}
},
Expand Down
Loading