Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Updated to [email protected] and @codingame/monaco-vscode-a…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisalmen committed Nov 27, 2023
1 parent cad55b2 commit 39b0af7
Show file tree
Hide file tree
Showing 13 changed files with 467 additions and 396 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Monaco Editor Wrapper and Monaco Editor React Component

This repository started as a Lit component for Monaco Editor, but it has transformed into a wrapper for `monaco-editor`, `monaco-languageclient` and `monaco-vscode-api` and now features a react component (`@typefox/monaco-editor-react`) that encapsulates the `monaco-editor-wrapper`.
This repository started as a Lit component for Monaco Editor, but it has transformed into a wrapper for `monaco-editor`, `monaco-languageclient` and `@codingame/monaco-vscode-api` and now features a react component (`@typefox/monaco-editor-react`) that encapsulates the `monaco-editor-wrapper`.

## Packages

Expand Down
738 changes: 387 additions & 351 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"webdriverio": "~8.24.1"
},
"overrides": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0"
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0"
},
"resolutions": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0"
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0"
},
"volta": {
"node": "18.18.2",
Expand Down
22 changes: 11 additions & 11 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
"version": "3.4.0-next.7",
"type": "module",
"dependencies": {
"@codingame/monaco-vscode-configuration-service-override": "~1.83.7",
"@codingame/monaco-vscode-editor-service-override": "~1.83.7",
"@codingame/monaco-vscode-json-default-extension": "~1.83.7",
"@codingame/monaco-vscode-keybindings-service-override": "~1.83.7",
"@codingame/monaco-vscode-python-default-extension": "~1.83.7",
"@codingame/monaco-vscode-configuration-service-override": "~1.83.12",
"@codingame/monaco-vscode-editor-service-override": "~1.83.12",
"@codingame/monaco-vscode-json-default-extension": "~1.83.12",
"@codingame/monaco-vscode-keybindings-service-override": "~1.83.12",
"@codingame/monaco-vscode-python-default-extension": "~1.83.12",
"@typefox/monaco-editor-react": "~2.4.0-next.7",
"http-server": "~14.1.1",
"langium": "~2.1.3",
"langium-statemachine-dsl": "~2.1.0",
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"monaco-editor-workers": "~0.44.0",
"monaco-editor-wrapper": "~3.4.0-next.7",
"monaco-languageclient": "~7.0.2",
"monaco-languageclient-examples": "~7.0.2",
"monaco-languageclient": "~7.1.0",
"monaco-languageclient-examples": "~7.1.0",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"request-light": "~0.7.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0",
"vscode-uri": "~3.0.8",
"vscode-languageclient": "~9.0.1",
"vscode-languageserver": "~9.0.1",
Expand All @@ -37,8 +37,8 @@
"vscode": "$vscode"
},
"resolutions": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0"
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0"
},
"volta": {
"node": "18.18.2",
Expand Down
15 changes: 13 additions & 2 deletions packages/examples/src/langium/config/wrapperLangiumClassic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@ export const setupLangiumClientClassic = async (): Promise<UserConfig> => {
wrapperConfig: {
serviceConfig: {
userServices: {
...getConfigurationServiceOverride(Uri.file('/workspace')),
...getConfigurationServiceOverride(),
...getEditorServiceOverride(useOpenEditorStub),
...getKeybindingsServiceOverride()
},
debugLogging: true
debugLogging: true,
workspaceConfig: {
workspaceProvider: {
trusted: true,
workspace: {
workspaceUri: Uri.file('/workspace')
},
async open() {
return false;
}
}
}
},
editorAppConfig: {
$type: 'classic',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/verify_alt.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
}
};
await wrapper.start(wrapperConfig, document.getElementById('monaco-editor-root'));
await wrapper.initAndStart(wrapperConfig, document.getElementById('monaco-editor-root'));
console.log('wrapper was started.');
};

Expand Down
2 changes: 1 addition & 1 deletion packages/examples/verify_wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
}
};
await wrapper.start(wrapperConfig, document.getElementById('monaco-editor-root'));
await wrapper.initAndStart(wrapperConfig, document.getElementById('monaco-editor-root'));
console.log('wrapper was started.');
};

Expand Down
4 changes: 3 additions & 1 deletion packages/monaco-editor-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

All notable changes to npm module [@typefox/monaco-editor-react](https://www.npmjs.com/package/@typefox/monaco-editor-react) are documented in this file.

## [2.4.0] - 2023-11-xy
## [2.4.0] - 2023-11-27

- Updated to `monaco-editor-wrapper` `3.4.0`
- Make subclassing MonacoEditorReactComp more easy [#58](https://github.com/TypeFox/monaco-components/issues/58)
- Allow to init and start separately [#59](https://github.com/TypeFox/monaco-components/issues/59)

## [2.3.0] - 2023-10-17

Expand Down
8 changes: 4 additions & 4 deletions packages/monaco-editor-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"npm": "9.9.0"
},
"dependencies": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"monaco-editor-wrapper": "~3.4.0-next.7",
"react": "~18.2.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0"
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0"
},
"peerDependencies": {
"monaco-editor-wrapper": "~3.4.0-next.7"
Expand All @@ -66,8 +66,8 @@
"vscode": "$vscode"
},
"resolutions": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0"
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0"
},
"repository": {
"type": "git",
Expand Down
15 changes: 9 additions & 6 deletions packages/monaco-editor-wrapper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

All notable changes to npm module [monaco-editor-wrapper](https://www.npmjs.com/package/monaco-editor-wrapper) are documented in this file.

## [3.4.0] - 2023-11-xy

- Updated to `monaco-languageclient` `7.0.0`
- The postinstall step is removed. `monaco-languageclient` no longer patches an existing `monaco-editor` instead the package `@codingame/monaco-editor-treemended` is used. This requires that projects using this lib to enforce the correct `monaco-editor` with overrides (npm/pnpm) or resolutions (yarn) in the `package.json`.
- Please see the [following explanation](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md#new-with-v7-treemended-monaco-editor)
- make subclassing MonacoEditorReactComp more easy [#58](https://github.com/TypeFox/monaco-components/issues/58)
## [3.4.0] - 2023-11-27

- Updated to `[email protected]` and `[email protected]`.
- BREAKING: The postinstall step is removed. `monaco-languageclient` no longer patches an existing `monaco-editor` instead the package `@codingame/monaco-editor-treemended` is used. This requires that projects using this lib to enforce the correct `monaco-editor` with overrides (npm/pnpm) or resolutions (yarn) in the `package.json`.
- Please see the [following explanation](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md#new-with-v7-treemended-monaco-editor)
- BREAKING: If you want to use `getConfigurationServiceOverride` you need to provide a `workspaceConfig` along the `userServices` in `initServices`.
- Make subclassing MonacoEditorReactComp more easy [#58](https://github.com/TypeFox/monaco-components/issues/58)
- Allow to init and start separately [#59](https://github.com/TypeFox/monaco-components/issues/59)
- BREAKING: `start` no longer calls `init`. You need to call both or you use `initAndStart`.

## [3.3.0] - 2023-10-17

Expand Down
2 changes: 1 addition & 1 deletion packages/monaco-editor-wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const run = async () => {
};

const htmlElement = document.getElementById('monaco-editor-root');
await wrapper.start(userConfig, htmlElement);
await wrapper.initAndStart(userConfig, htmlElement);
}
```

Expand Down
22 changes: 11 additions & 11 deletions packages/monaco-editor-wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,29 @@
"npm": "9.9.0"
},
"dependencies": {
"@codingame/monaco-vscode-configuration-service-override": "~1.83.7",
"@codingame/monaco-vscode-editor-service-override": "~1.83.7",
"@codingame/monaco-vscode-textmate-service-override": "~1.83.7",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~1.83.7",
"@codingame/monaco-vscode-theme-service-override": "~1.83.7",
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"monaco-languageclient": "~7.0.2",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0",
"@codingame/monaco-vscode-configuration-service-override": "~1.83.12",
"@codingame/monaco-vscode-editor-service-override": "~1.83.12",
"@codingame/monaco-vscode-textmate-service-override": "~1.83.12",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~1.83.12",
"@codingame/monaco-vscode-theme-service-override": "~1.83.12",
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"monaco-languageclient": "~7.1.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0",
"vscode-languageclient": "~9.0.1",
"vscode-languageserver-protocol":"~3.17.5",
"vscode-ws-jsonrpc": "~3.1.0"
},
"peerDependencies": {
"monaco-languageclient": "~7.0.2",
"monaco-languageclient": "~7.1.0",
"vscode-ws-jsonrpc": "~3.1.0"
},
"overrides": {
"monaco-editor": "$monaco-editor",
"vscode": "$vscode"
},
"resolutions": {
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.7 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.7 <1.84.0"
"monaco-editor": "npm:@codingame/monaco-editor-treemended@>=1.83.12 <1.84.0",
"vscode": "npm:@codingame/monaco-vscode-api@>=1.83.12 <1.84.0"
},
"repository": {
"type": "git",
Expand Down
23 changes: 21 additions & 2 deletions packages/monaco-editor-wrapper/src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,32 @@ export class MonacoEditorLanguageClientWrapper {
protected configureServices() {
// always set required services if not configured
this.serviceConfig.userServices = this.serviceConfig.userServices ?? {};
const configureService = this.serviceConfig.userServices.configure ?? undefined;
const configureService = this.serviceConfig.userServices.configurationService ?? undefined;
const workspaceConfig = this.serviceConfig.workspaceConfig ?? undefined;

if (!configureService) {
const mlcDefautServices = {
...getConfigurationServiceOverride(Uri.file('/workspace'))
...getConfigurationServiceOverride()
};
mergeServices(mlcDefautServices, this.serviceConfig.userServices);

if (workspaceConfig) {
throw new Error('You provided a workspaceConfig without using the configurationServiceOverride');
}
}
// adding the default workspace config if not provided
if (!workspaceConfig) {
this.serviceConfig.workspaceConfig = {
workspaceProvider: {
trusted: true,
workspace: {
workspaceUri: Uri.file('/workspace')
},
async open() {
return false;
}
}
};
}
mergeServices(this.editorApp?.specifyServices() ?? {}, this.serviceConfig.userServices);

Expand Down

0 comments on commit 39b0af7

Please sign in to comment.