Skip to content

Commit

Permalink
Updated to monaco-vscode-api 1.83.3
Browse files Browse the repository at this point in the history
Add localization support to statemachine example
  • Loading branch information
kaisalmen committed Oct 20, 2023
1 parent e914733 commit c49fccd
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 100 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ The following table describes which version of **monaco-languageclient** and **@

| monaco-languageclient | @codingame/monaco-vscode-api | monaco-editor | comment |
| :---- | :---- | :--- | :--- |
| 6.6.1 | 1.83.3 | 0.44.0 | Released 2023-10-20 |
| 6.6.0 | 1.83.2 | 0.44.0 | Released 2023-10-16 |
| 6.5.3 | 1.82.5 | 0.43.0 | Released 2023-10-11 |
| 6.5.2 | 1.82.4 | 0.43.0 | Released 2023-10-07 |
Expand Down Expand Up @@ -326,7 +327,7 @@ loader.config({ monaco });
If you use pnpm, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency (see the [following table](#monaco-editor--codingamemonaco-vscode-api-compatibility-table)), otherwise the installation will fail.

```json
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.2 <1.84.0"
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.3 <1.84.0"
```

## Changelogs
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ <h3>Python language client and language server</h3>
Please execute <b><code>npm run start:example:server:python</code></b> beforehand:<br>
<a href="packages/examples/python.html">Client for Python Pyright Language Server</a>
<h3>Langium client and language server</h3>
<a href="packages/examples/statemachine_client.html">Client & Statemachine LS (Web Worker)</a>
<a href="packages/examples/statemachine_client.html">Client & Statemachine LS (Web Worker)</a><br>
Localizations: <a href="packages/examples/statemachine_client.html?locale=de">German</a> <a href="packages/examples/statemachine_client.html?locale=es">French</a> and <a href="packages/examples/statemachine_client.html?locale=fr">Spanish</a><br>
<h3>Other examples</h3>
<a href="packages/examples/browser.html">Browser Example</a>
<br><br>
Expand Down
164 changes: 96 additions & 68 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this npm module are documented in this file.

## [6.6.1] - 2023-10-20

- Updated to `monaco-vscode-api` `1.83.3` which adds l10n suppport.

## [6.6.0] - 2023-10-16

- Updated to `monaco-editor` `0.44.0` and `monaco-vscode-api` `1.83.2`.
Expand Down
12 changes: 6 additions & 6 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaco-languageclient",
"version": "6.6.0",
"version": "6.6.1",
"description": "Monaco Language client implementation",
"author": {
"name": "TypeFox GmbH",
Expand Down Expand Up @@ -48,16 +48,16 @@
"License.txt"
],
"dependencies": {
"@codingame/monaco-vscode-editor-service-override": "~1.83.3",
"@codingame/monaco-vscode-languages-service-override": "~1.83.3",
"@codingame/monaco-vscode-model-service-override": "~1.83.3",
"monaco-editor": "~0.44.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.2 <1.84.0",
"@codingame/monaco-vscode-editor-service-override": "~1.83.2",
"@codingame/monaco-vscode-languages-service-override": "~1.83.2",
"@codingame/monaco-vscode-model-service-override": "~1.83.2",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.3 <1.84.0",
"vscode-languageclient": "~8.1.0"
},
"peerDependencies": {
"monaco-editor": "~0.44.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.2 <1.84.0"
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.3 <1.84.0"
},
"peerDependenciesMeta": {
"monaco-editor": {
Expand Down
4 changes: 0 additions & 4 deletions packages/client/src/monaco-language-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ export class MonacoLanguageClient extends BaseLanguageClient {
protected override createMessageTransports(encoding: string): Promise<MessageTransports> {
return this.connectionProvider.get(encoding);
}

protected override getLocale(): string {
return super.getLocale() || 'en-US';
}
}
26 changes: 15 additions & 11 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaco-languageclient-examples",
"version": "6.6.0",
"version": "6.6.1",
"description": "Monaco Language client examples",
"author": {
"name": "TypeFox GmbH",
Expand Down Expand Up @@ -43,24 +43,28 @@
}
},
"dependencies": {
"@codingame/monaco-vscode-configuration-service-override": "~1.83.2",
"@codingame/monaco-vscode-editor-service-override": "~1.83.2",
"@codingame/monaco-vscode-files-service-override": "~1.83.2",
"@codingame/monaco-vscode-json-default-extension": "~1.83.2",
"@codingame/monaco-vscode-keybindings-service-override": "~1.83.2",
"@codingame/monaco-vscode-python-default-extension": "~1.83.2",
"@codingame/monaco-vscode-textmate-service-override": "~1.83.2",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~1.83.2",
"@codingame/monaco-vscode-theme-service-override": "~1.83.2",
"@codingame/monaco-vscode-configuration-service-override": "~1.83.3",
"@codingame/monaco-vscode-editor-service-override": "~1.83.3",
"@codingame/monaco-vscode-files-service-override": "~1.83.3",
"@codingame/monaco-vscode-json-default-extension": "~1.83.3",
"@codingame/monaco-vscode-keybindings-service-override": "~1.83.3",
"@codingame/monaco-vscode-python-default-extension": "~1.83.3",
"@codingame/monaco-vscode-textmate-service-override": "~1.83.3",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~1.83.3",
"@codingame/monaco-vscode-theme-service-override": "~1.83.3",
"@codingame/monaco-vscode-language-pack-de": "~1.83.3",
"@codingame/monaco-vscode-language-pack-es": "~1.83.3",
"@codingame/monaco-vscode-language-pack-fr": "~1.83.3",
"express": "~4.18.2",
"langium": "~2.0.2",
"langium-statemachine-dsl": "~2.0.0",
"monaco-editor-workers": "~0.44.0",
"monaco-languageclient": "~6.6.0",
"monaco-languageclient": "~6.6.1",
"pyright": "~1.1.330",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"request-light": "~0.7.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.3 <1.84.0",
"vscode-json-languageservice": "~5.3.7",
"vscode-languageserver": "~8.1.0",
"vscode-uri": "~3.0.8",
Expand Down
28 changes: 28 additions & 0 deletions packages/examples/src/langium/localeLoader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* --------------------------------------------------------------------------------------------
* Copyright (c) 2018-2022 TypeFox GmbH (http://www.typefox.io). All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

export const loadLocales = async () => {
const locale = new URLSearchParams(window.location.search).get('locale');
const localeLoader: Partial<Record<string, () => Promise<void>>> = {
de: async () => {
await import('@codingame/monaco-vscode-language-pack-de');
},
es: async () => {
await import('@codingame/monaco-vscode-language-pack-es');
},
fr: async () => {
await import('@codingame/monaco-vscode-language-pack-fr');
}
};

if (locale != null) {
const loader = localeLoader[locale];
if (loader != null) {
await loader();
} else {
console.error(`Unknown locale ${locale}`);
}
}
};
6 changes: 4 additions & 2 deletions packages/examples/statemachine_client.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
<h2>Client & Statemachine DSL Web Worker Language Server Example</h2>
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<script type="module">
import { startStatemachineClient } from "./src/langium/statemachineClient.ts";
startStatemachineClient();
import { loadLocales } from "./src/langium/localeLoader.ts";
await loadLocales();
const { startStatemachineClient } = await import("./src/langium/statemachineClient.ts");
await startStatemachineClient();
</script>
</body>

Expand Down
4 changes: 2 additions & 2 deletions packages/verify/pnpm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.0.0",
"private": "true",
"dependencies": {
"monaco-languageclient": "~6.6.0",
"monaco-languageclient": "~6.6.1",
"monaco-editor": "~0.44.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.2 <1.84.0"
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.3 <1.84.0"
},
"devDependencies": {
"shx": "~0.3.4"
Expand Down
4 changes: 2 additions & 2 deletions packages/verify/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"dependencies": {
"monaco-editor-workers": "~0.44.0",
"monaco-languageclient": "~6.6.0",
"monaco-languageclient-examples": "~6.6.0",
"monaco-languageclient": "~6.6.1",
"monaco-languageclient-examples": "~6.6.1",
"vscode-ws-jsonrpc": "~3.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/verify/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"type": "module",
"dependencies": {
"monaco-editor-workers": "~0.44.0",
"monaco-languageclient": "~6.6.0",
"monaco-languageclient-examples": "~6.6.0",
"monaco-languageclient": "~6.6.1",
"monaco-languageclient-examples": "~6.6.1",
"vscode-ws-jsonrpc": "~3.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/verify/yarn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": "true",
"dependencies": {
"monaco-languageclient": "~6.6.0"
"monaco-languageclient": "~6.6.1"
},
"devDependencies": {
"shx": "~0.3.4"
Expand Down

0 comments on commit c49fccd

Please sign in to comment.