Skip to content

Commit

Permalink
Port clangd example to use views service (#775)
Browse files Browse the repository at this point in the history
- Clean appPlayground
- Update dependencies
- Update version -next.6
- Stay with on vitest 2.1.3
- No need for mini-coi in dev html
  • Loading branch information
kaisalmen authored Oct 30, 2024
1 parent d79aa86 commit 8d0f3ef
Show file tree
Hide file tree
Showing 27 changed files with 773 additions and 836 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ loader.config({ monaco });
If you use pnpm, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency (you find the [compatibility table here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table), otherwise the installation will fail.

```json
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.1"
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.3"
```

## Licenses
Expand Down
2 changes: 1 addition & 1 deletion docs/versions-and-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following table describes which version of **monaco-languageclient** and **@

| monaco-languageclient | monaco-editor-wrapper | monaco-editor-react | monaco-vscode-api / editor-api | vscode | monaco-editor | release date | comment |
| :---- | :---- | :--- | :--- | :--- | :--- | :--- | :--- |
| 9.0.0-next.5 | 6.0.0-next.5 | 6.0.0-next.5 | 10.1.1 | 1.94.2 | 0.52.0 | 2024-10-23 | |
| 9.0.0-next.6 | 6.0.0-next.6 | 6.0.0-next.6 | 10.1.3 | 1.94.2 | 0.52.0 | 2024-10-30 | |
| 8.8.3 | 5.5.3 | 4.5.3 | 8.0.4 | 1.92.2 | 0.51.0 | 2024-08-26 | |
| 8.8.2 | 5.5.2 | 4.5.2 | 8.0.2 | 1.92.2 | 0.50.0 | 2024-08-21 | |
| 8.8.1 | 5.5.1 | 4.5.1 | 8.0.1 | 1.92.1 | 0.50.0 | 2024-08-12 | |
Expand Down
1,036 changes: 499 additions & 537 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "module",
"devDependencies": {
"@codingame/esbuild-import-meta-url-plugin": "~1.0.2",
"@codingame/monaco-vscode-rollup-vsix-plugin": "~10.1.1",
"@codingame/monaco-vscode-rollup-vsix-plugin": "~10.1.3",
"@eslint/js": "~9.13.0",
"@eslint/eslintrc": "~3.1.0",
"@stylistic/eslint-plugin": "~2.9.0",
Expand All @@ -12,10 +12,10 @@
"@types/react": "~18.3.12",
"@types/react-dom": "~18.3.1",
"@types/vscode": "~1.94.0",
"@typescript-eslint/eslint-plugin": "~8.11.0",
"@typescript-eslint/parser": "~8.11.0",
"@typescript-eslint/eslint-plugin": "~8.12.1",
"@typescript-eslint/parser": "~8.12.1",
"@vitejs/plugin-react": "~4.3.3",
"@vitest/browser": "~2.1.3",
"@vitest/browser": "2.1.3",
"editorconfig": "~2.0.0",
"esbuild": "~0.24.0",
"eslint": "~9.13.0",
Expand All @@ -25,12 +25,12 @@
"globals": "~15.11.0",
"http-server": "~14.1.1",
"minimatch": "~10.0.1",
"playwright": "~1.48.1",
"playwright": "~1.48.2",
"typescript": "~5.6.3",
"vite": "~5.4.10",
"vite-node": "~2.1.3",
"vitest": "~2.1.3",
"webdriverio": "~9.2.1"
"vite-node": "2.1.3",
"vitest": "2.1.3",
"webdriverio": "~9.2.6"
},
"volta": {
"node": "20.18.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

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

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

- Function naming adjustments
- 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)
- Update to monaco-vscode-api 9.0.x [#749](https://github.com/TypeFox/monaco-languageclient/pull/749)
- Updated all `@codingame/monaco-vscode` packages to `10.1.1`.
- Updated all `@codingame/monaco-vscode` packages to `10.1.3`.
- Enhancements to logging
- monaco-languageclient config improvement, wrapper+languageclientwrapper improvements [#741](https://github.com/TypeFox/monaco-languageclient/pull/741)
- Pass MessageTransports directly
Expand Down
20 changes: 10 additions & 10 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaco-languageclient",
"version": "9.0.0-next.5",
"version": "9.0.0-next.6",
"description": "Monaco Language client implementation",
"author": {
"name": "TypeFox GmbH",
Expand Down Expand Up @@ -69,18 +69,18 @@
"LICENSE"
],
"dependencies": {
"@codingame/monaco-vscode-extensions-service-override": "~10.1.1",
"@codingame/monaco-vscode-languages-service-override": "~10.1.1",
"@codingame/monaco-vscode-localization-service-override": "~10.1.1",
"@codingame/monaco-vscode-log-service-override": "~10.1.1",
"@codingame/monaco-vscode-model-service-override": "~10.1.1",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~10.1.1",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.1",
"@codingame/monaco-vscode-extensions-service-override": "~10.1.3",
"@codingame/monaco-vscode-languages-service-override": "~10.1.3",
"@codingame/monaco-vscode-localization-service-override": "~10.1.3",
"@codingame/monaco-vscode-log-service-override": "~10.1.3",
"@codingame/monaco-vscode-model-service-override": "~10.1.3",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~10.1.3",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.3",
"vscode-languageclient": "~9.0.1"
},
"peerDependencies": {
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~10.1.1",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.1"
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~10.1.3",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.3"
},
"peerDependenciesMeta": {
"monaco-editor": {
Expand Down
6 changes: 4 additions & 2 deletions packages/examples/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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

## [2024.10.5] - 2024-10-2x
## [2024.10.5] - 2024-10-30

- Updated to `monaco-languageclient@9.0.0-next.6`, `monaco-editor-wrapper@6.0.0-next.6` and `@typefox/monaco-editor-react@6.0.0-next.6`.
- Updated all `@codingame/monaco-vscode` packages to `10.1.3`.
- Added clangd example.
- Added application playground example featuring the views service override.

Expand All @@ -15,7 +17,7 @@ Updated all `@codingame/monaco-vscode` packages to `10.1.1`.
## [2024.10.3] - 2024-10-21

- Updated to `monaco-languageclient@9.0.0-next.4`, `monaco-editor-wrapper@6.0.0-next.4` and `@typefox/monaco-editor-react@6.0.0-next.4`.
Updated all `@codingame/monaco-vscode` packages to `10.1.`.
Updated all `@codingame/monaco-vscode` packages to `10.1.0`.
- Updated to eslint 9

## [2024.10.2] - 20241-10-11
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/appPlayground.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="./resources/appPlayground/style.css">
<link rel="stylesheet" href="./resources/styles/views.css">
</head>

<body>
Expand Down
9 changes: 2 additions & 7 deletions packages/examples/clangd.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<title>Cpp Language Client & Clangd Language Server (Worker/Wasm)</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="./mini-coi.js" scope="./"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="./resources/styles/views.css">
</head>

<body>
Expand All @@ -15,14 +15,9 @@
<br>
<b>Heads up:</b> This is a prototype and still evolving.<br>
The clangd language server worker has been derived from: <a href="https://github.com/guyutongxue/clangd-in-browser">clangd-in-browser</a><br>
<button type="button" id="button-start">Start</button> </div>
<div id="monaco-editor-root" style="width:800px;height:600px;border:1px solid grey"></div>
<label for="openFiles">Select open file:</label>
<select name="openFiles" id="openFiles">
</select>
</div>
<script type="module">
import { runClangdWrapper } from "./src/clangd/client/main.ts";

runClangdWrapper();
</script>
</body>
Expand Down
8 changes: 2 additions & 6 deletions packages/examples/ghp_clangd.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="./mini-coi.js" scope="./"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="./resources/styles/views.css">
</head>

<body>
Expand All @@ -15,14 +16,9 @@
<br>
<b>Heads up:</b> This is a prototype and still evolving.<br>
The clangd language server worker has been derived from: <a href="https://github.com/guyutongxue/clangd-in-browser">clangd-in-browser</a><br>
<button type="button" id="button-start">Start</button> </div>
<div id="monaco-editor-root" style="width:800px;height:600px;border:1px solid grey"></div>
<label for="openFiles">Select open file:</label>
<select name="openFiles" id="openFiles">
</select>
</div>
<script type="module">
import { runClangdWrapper } from "./src/clangd/client/main.ts";

runClangdWrapper();
</script>
</body>
Expand Down
60 changes: 30 additions & 30 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,42 @@
}
},
"dependencies": {
"@codingame/monaco-vscode-configuration-service-override": "~10.1.1",
"@codingame/monaco-vscode-cpp-default-extension": "~10.1.1",
"@codingame/monaco-vscode-explorer-service-override": "~10.1.1",
"@codingame/monaco-vscode-files-service-override": "~10.1.1",
"@codingame/monaco-vscode-groovy-default-extension": "~10.1.1",
"@codingame/monaco-vscode-keybindings-service-override": "~10.1.1",
"@codingame/monaco-vscode-lifecycle-service-override": "~10.1.1",
"@codingame/monaco-vscode-localization-service-override": "~10.1.1",
"@codingame/monaco-vscode-java-default-extension": "~10.1.1",
"@codingame/monaco-vscode-javascript-default-extension": "~10.1.1",
"@codingame/monaco-vscode-json-default-extension": "~10.1.1",
"@codingame/monaco-vscode-python-default-extension": "~10.1.1",
"@codingame/monaco-vscode-standalone-languages": "~10.1.1",
"@codingame/monaco-vscode-standalone-typescript-language-features": "~10.1.1",
"@codingame/monaco-vscode-standalone-json-language-features": "~10.1.1",
"@codingame/monaco-vscode-textmate-service-override": "~10.1.1",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~10.1.1",
"@codingame/monaco-vscode-theme-service-override": "~10.1.1",
"@codingame/monaco-vscode-typescript-basics-default-extension": "~10.1.1",
"@codingame/monaco-vscode-typescript-language-features-default-extension": "~10.1.1",
"@codingame/monaco-vscode-views-service-override": "~10.1.1",
"@codingame/monaco-vscode-remote-agent-service-override": "~10.1.1",
"@codingame/monaco-vscode-environment-service-override": "~10.1.1",
"@codingame/monaco-vscode-secret-storage-service-override": "~10.1.1",
"@typefox/monaco-editor-react": "~6.0.0-next.5",
"@codingame/monaco-vscode-configuration-service-override": "~10.1.3",
"@codingame/monaco-vscode-cpp-default-extension": "~10.1.3",
"@codingame/monaco-vscode-explorer-service-override": "~10.1.3",
"@codingame/monaco-vscode-files-service-override": "~10.1.3",
"@codingame/monaco-vscode-groovy-default-extension": "~10.1.3",
"@codingame/monaco-vscode-keybindings-service-override": "~10.1.3",
"@codingame/monaco-vscode-lifecycle-service-override": "~10.1.3",
"@codingame/monaco-vscode-localization-service-override": "~10.1.3",
"@codingame/monaco-vscode-java-default-extension": "~10.1.3",
"@codingame/monaco-vscode-javascript-default-extension": "~10.1.3",
"@codingame/monaco-vscode-json-default-extension": "~10.1.3",
"@codingame/monaco-vscode-python-default-extension": "~10.1.3",
"@codingame/monaco-vscode-standalone-languages": "~10.1.3",
"@codingame/monaco-vscode-standalone-typescript-language-features": "~10.1.3",
"@codingame/monaco-vscode-standalone-json-language-features": "~10.1.3",
"@codingame/monaco-vscode-textmate-service-override": "~10.1.3",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~10.1.3",
"@codingame/monaco-vscode-theme-service-override": "~10.1.3",
"@codingame/monaco-vscode-typescript-basics-default-extension": "~10.1.3",
"@codingame/monaco-vscode-typescript-language-features-default-extension": "~10.1.3",
"@codingame/monaco-vscode-views-service-override": "~10.1.3",
"@codingame/monaco-vscode-remote-agent-service-override": "~10.1.3",
"@codingame/monaco-vscode-environment-service-override": "~10.1.3",
"@codingame/monaco-vscode-secret-storage-service-override": "~10.1.3",
"@typefox/monaco-editor-react": "~6.0.0-next.6",
"cors": "^2.8.5",
"express": "~4.21.1",
"langium": "~3.2.0",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~10.1.1",
"monaco-editor-wrapper": "~6.0.0-next.5",
"monaco-languageclient": "~9.0.0-next.5",
"pyright": "~1.1.386",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~10.1.3",
"monaco-editor-wrapper": "~6.0.0-next.6",
"monaco-languageclient": "~9.0.0-next.6",
"pyright": "~1.1.387",
"react": "~18.3.1",
"react-dom": "~18.3.1",
"request-light": "~0.8.0",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.1",
"vscode": "npm:@codingame/monaco-vscode-api@~10.1.3",
"vscode-json-languageservice": "~5.4.1",
"vscode-languageclient": "~9.0.1",
"vscode-languageserver": "~9.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#editors {
position: relative;
min-width: 0;
height: 90vh;
height: 95%;
border: 1px solid var(--vscode-editorWidget-border);
}

Expand Down
54 changes: 12 additions & 42 deletions packages/examples/src/appPlayground/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import * as vscode from 'vscode';
import { LogLevel } from 'vscode/services';
import getConfigurationServiceOverride, { IStoredWorkspace } from '@codingame/monaco-vscode-configuration-service-override';
import getConfigurationServiceOverride from '@codingame/monaco-vscode-configuration-service-override';
import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override';
import getLifecycleServiceOverride from '@codingame/monaco-vscode-lifecycle-service-override';
import getLocalizationServiceOverride from '@codingame/monaco-vscode-localization-service-override';
Expand All @@ -25,17 +25,15 @@ import '../../resources/vsix/open-collaboration-tools.vsix';

import { EditorAppExtended, MonacoEditorLanguageClientWrapper, RegisterLocalProcessExtensionResult, WrapperConfig } from 'monaco-editor-wrapper';
import { createDefaultLocaleConfiguration } from 'monaco-languageclient/vscode/services';
import { configureMonacoWorkers } from '../common/client/utils.js';
import { configureMonacoWorkers, createDefaultWorkspaceFile } from '../common/client/utils.js';
import helloTsCode from '../../resources/appPlayground/hello.ts?raw';
import testerTsCode from '../../resources/appPlayground/tester.ts?raw';
import { defaultViewsHtml, defaultViewsInit } from 'monaco-editor-wrapper/vscode/services';

const wrapper = new MonacoEditorLanguageClientWrapper();

export const runApplicationPlayground = async () => {
const helloTsUri = vscode.Uri.file('/workspace/hello.ts');
const testerTsUri = vscode.Uri.file('/workspace/tester.ts');
const workspaceFile = vscode.Uri.file('/workspace.code-workspace');
const workspaceFile = vscode.Uri.file('/workspace/.vscode/workspace.code-workspace');

const wrapperConfig: WrapperConfig = {
id: 'AAP',
Expand All @@ -62,7 +60,7 @@ export const runApplicationPlayground = async () => {
workspaceConfig: {
enableWorkspaceTrust: true,
windowIndicator: {
label: 'mlc-advanced-example',
label: 'mlc-app-playground',
tooltip: '',
command: ''
},
Expand All @@ -77,19 +75,11 @@ export const runApplicationPlayground = async () => {
}
},
configurationDefaults: {
'window.title': 'mlc-advanced-example${separator}${dirty}${activeEditorShort}'
'window.title': 'mlc-app-playground${separator}${dirty}${activeEditorShort}'
},
productConfiguration: {
nameShort: 'mlc-advanced-example',
nameLong: 'mlc-advanced-example',
extensionsGallery: {
serviceUrl: 'https://open-vsx.org/vscode/gallery',
itemUrl: 'https://open-vsx.org/vscode/item',
resourceUrlTemplate: 'https://open-vsx.org/vscode/unpkg/{publisher}/{name}/{version}/{path}',
controlUrl: '',
nlsBaseUrl: '',
publisherUrl: ''
}
nameShort: 'mlc-app-playground',
nameLong: 'mlc-app-playground'
}
},
userConfiguration: {
Expand All @@ -108,20 +98,14 @@ export const runApplicationPlayground = async () => {
$type: 'extended',
extensions: [{
config: {
name: 'mlc-advanced-example',
name: 'mlc-app-playground',
publisher: 'TypeFox',
version: '1.0.0',
engines: {
vscode: '*'
}
}
}],
codeResources: {
main: {
text: helloTsCode,
uri: '/workspace/hello.ts'
}
},
monacoWorkerFactory: configureMonacoWorkers,
htmlContainer: document.body
}
Expand All @@ -131,30 +115,16 @@ export const runApplicationPlayground = async () => {
htmlContainer.innerHTML = defaultViewsHtml;
document.body.append(htmlContainer);

const helloTsUri = vscode.Uri.file('/workspace/hello.ts');
const testerTsUri = vscode.Uri.file('/workspace/tester.ts');
const fileSystemProvider = new RegisteredFileSystemProvider(false);
fileSystemProvider.registerFile(new RegisteredMemoryFile(helloTsUri, helloTsCode));
fileSystemProvider.registerFile(new RegisteredMemoryFile(testerTsUri, testerTsCode));

fileSystemProvider.registerFile(
new RegisteredMemoryFile(
workspaceFile,
JSON.stringify(
<IStoredWorkspace>{
folders: [
{
path: '/workspace'
}
]
},
null,
2
)
)
);
fileSystemProvider.registerFile(createDefaultWorkspaceFile(workspaceFile, '/workspace'));
registerFileSystemOverlay(1, fileSystemProvider);

await wrapper.init(wrapperConfig);
const result = (wrapper.getMonacoEditorApp() as EditorAppExtended).getExtensionRegisterResult('mlc-advanced-example') as RegisterLocalProcessExtensionResult;
const result = (wrapper.getMonacoEditorApp() as EditorAppExtended).getExtensionRegisterResult('mlc-app-playground') as RegisterLocalProcessExtensionResult;
result.setAsDefaultApi();

await Promise.all([
Expand Down
Loading

0 comments on commit 8d0f3ef

Please sign in to comment.