Skip to content

Commit

Permalink
Merge pull request #503 from TypeFox/mva-1.79.2
Browse files Browse the repository at this point in the history
Updated to monaco-vscode-api 1.79.2 / monaco-editor 0.39.0
  • Loading branch information
kaisalmen authored Jun 16, 2023
2 parents 376340d + 28105df commit fb941be
Show file tree
Hide file tree
Showing 15 changed files with 327 additions and 189 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Click [here](http://typefox.io/teaching-the-language-server-protocol-to-microsof

### May 2023 (v6.0.0)

Updated to `monaco-vscode-api` `1.78.5` and therefore retired `MonacoServices`. It is replaced by `initServices` that makes configration of services exposed by `monaco-vscode-api` handy and still allows the definition of own services as [outlined here](https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services) and these can be passed as `userServices` in `initServices`.
Updated to `monaco-vscode-api` `1.78.5` and therefore retired `MonacoServices`. It is replaced by `initServices` that makes configuration of services exposed by `monaco-vscode-api` handy and still allows the definition of own services as [outlined here](https://github.com/CodinGame/monaco-vscode-api#monaco-standalone-services) and these can be passed as `userServices` in `initServices`.

### April 2023 (v5.0.0)

Expand Down Expand Up @@ -78,6 +78,7 @@ The following table describes which version of **monaco-languageclient** and **m

| monaco-languageclient | monaco-vscode-api | monaco-editor | comment |
| :---- | :---- | :--- | :--- |
| 6.2.0 | 1.79.3 | 0.39.0 | Released 2023-06-16 |
| 6.1.0 | 1.79.1 | 0.38.0 | Released 2023-06-12 |
| 6.0.3 | 1.78.8 | 0.37.1 | Released 2023-05-31 |
| 6.0.2 | 1.78.6 | 0.37.1 | Released 2023-05-24 |
Expand Down
340 changes: 208 additions & 132 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
"private": true,
"type": "module",
"devDependencies": {
"@types/node": "~18.16.14",
"@types/vscode": "~1.79.0",
"@typescript-eslint/eslint-plugin": "~5.59.8",
"@typescript-eslint/parser": "~5.59.8",
"@types/node": "~18.16.18",
"@types/vscode": "~1.79.1",
"@typescript-eslint/eslint-plugin": "~5.59.11",
"@typescript-eslint/parser": "~5.59.11",
"editorconfig": "~1.0.2",
"eslint": "~8.41.0",
"eslint-config-standard": "~17.0.0",
"eslint": "~8.42.0",
"eslint-config-standard": "~17.1.0",
"eslint-plugin-header": "~3.1.1",
"eslint-plugin-import": "~2.27.5",
"eslint-plugin-promise": "~6.1.1",
"eslint-plugin-unused-imports": "~2.0.0",
"path-browserify": "~1.0.1",
"shx": "~0.3.4",
"tslib": "~2.5.2",
"typescript": "~5.0.4",
"tslib": "~2.5.3",
"typescript": "~5.1.3",
"vite": "~4.3.9"
},
"volta": {
"node": "18.16.0",
"npm": "9.6.6"
"npm": "9.6.7"
},
"scripts": {
"clean": "npm run clean --workspaces",
Expand Down
6 changes: 5 additions & 1 deletion packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

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

## [6.1.0] - 2023-06-0x
## [6.2.0] - 2023-06-16

- Updated `monaco-vscode-api` to version `1.79.3`, `monaco-editor` to version `0.39.0` and `monaco-editor-workers` to version `0.39.1` [#503](https://github.com/TypeFox/monaco-languageclient/pull/503)

## [6.1.0] - 2023-06-12

- Updated to `monaco-vscode-api` version `1.79.0` and `monaco-editor` version `0.38.0` [#493](https://github.com/TypeFox/monaco-languageclient/issues/493)
- Updated to `monaco-vscode-api` version `1.79.1` [#501](https://github.com/TypeFox/monaco-languageclient/pull/501)
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.1.0",
"version": "6.2.0",
"description": "Monaco Language client implementation",
"author": {
"name": "TypeFox GmbH",
Expand Down Expand Up @@ -38,7 +38,7 @@
},
"volta": {
"node": "18.16.0",
"npm": "9.6.6"
"npm": "9.6.7"
},
"files": [
"lib",
Expand All @@ -48,14 +48,14 @@
"License.txt"
],
"dependencies": {
"monaco-editor": "~0.38.0",
"vscode": "npm:@codingame/monaco-vscode-api@~1.79.1",
"monaco-editor": "~0.39.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.79.3",
"vscode-jsonrpc": "~8.1.0",
"vscode-languageclient": "~8.1.0"
},
"peerDependencies": {
"monaco-editor": "~0.38.0",
"vscode": "npm:@codingame/monaco-vscode-api@~1.79.1"
"monaco-editor": "~0.39.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.79.3"
},
"peerDependenciesMeta": {
"monaco-editor": {
Expand Down
83 changes: 65 additions & 18 deletions packages/client/src/monaco-vscode-api-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
* ------------------------------------------------------------------------------------------ */

import { editor, Environment, Uri } from 'monaco-editor/esm/vs/editor/editor.api.js';
import { initialize as initializeMonacoService } from 'vscode/services';
import { ILogService, initialize as initializeMonacoService, LogLevel, StandaloneServices } from 'vscode/services';
import { initialize as initializeVscodeExtensions } from 'vscode/extensions';
import type { OpenEditor } from 'vscode/service-override/editor';
import { ITerminalBackend, SimpleTerminalBackend } from 'vscode/service-override/terminal';

interface MonacoEnvironmentEnhanced extends Environment {
vscodeApiInitialised: boolean;
}

export type InitializeServiceConfig = {
enableFilesService?: boolean;
enableDialogService?: boolean;
enableNotificationService?: boolean;
enableModelService?: boolean;
Expand All @@ -33,8 +35,15 @@ export type InitializeServiceConfig = {
enablePreferencesService?: boolean;
enableSnippetsService?: boolean;
enableQuickaccessService?: boolean;
enableOutputService?: boolean;
configureTerminalServiceConfig?: {
backendImpl: SimpleTerminalBackend | ITerminalBackend
}
enableSearchService?: boolean;
enableMarkersService?: boolean;
userServices?: editor.IEditorOverrideServices;
debugLogging?: boolean;
logLevel?: LogLevel
};

export const wasVscodeApiInitialized = () => {
Expand All @@ -52,7 +61,11 @@ export const initServices = async (config?: InitializeServiceConfig) => {
}

if (!window.MonacoEnvironment) {
window.MonacoEnvironment = {};
window.MonacoEnvironment = {
createTrustedTypesPolicy: (_policyName: string) => {
return undefined;
}
};
}
(window.MonacoEnvironment as MonacoEnvironmentEnhanced).vscodeApiInitialised = true;
};
Expand All @@ -72,9 +85,9 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
serviceNames.push(name);
};

// files service is required
addService('files', import('vscode/service-override/files'));

if (lc.enableFilesService === true) {
addService('files', import('vscode/service-override/files'));
}
if (lc.enableModelService === true) {
addService('model', import('vscode/service-override/model'));
}
Expand All @@ -85,13 +98,6 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
addService('editor', import('vscode/service-override/editor'));
}
}
if (lc.enableQuickaccessService === true) {
// quickaccess requires keybindings
if (lc.enableKeybindingsService === undefined || lc.enableKeybindingsService === false) {
throw new Error('"quickaccess" requires "keybindings" service. Please add it to the "initServices" config.');
}
addService('quickaccess', import('vscode/service-override/quickaccess'));
}
if (lc.configureConfigurationServiceConfig !== undefined) {
addService('configuration', import('vscode/service-override/configuration'));
}
Expand All @@ -102,10 +108,6 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
addService('notifications', import('vscode/service-override/notifications'));
}
if (lc.enableThemeService === true) {
// theme requires textmate
if (lc.enableTextmateService === undefined || lc.enableTextmateService === false) {
throw new Error('"theme" requires "textmate" service. Please add it to the "initServices" config.');
}
addService('theme', import('vscode/service-override/theme'));
}
if (lc.enableTextmateService === true) {
Expand All @@ -129,6 +131,21 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
if (lc.enableSnippetsService === true) {
addService('snippets', import('vscode/service-override/snippets'));
}
if (lc.enableQuickaccessService === true) {
addService('quickaccess', import('vscode/service-override/quickaccess'));
}
if (lc.enableOutputService === true) {
addService('output', import('vscode/service-override/output'));
}
if (lc.configureTerminalServiceConfig !== undefined) {
addService('terminal', import('vscode/service-override/terminal'));
}
if (lc.enableSearchService === true) {
addService('search', import('vscode/service-override/search'));
}
if (lc.enableMarkersService === true) {
addService('markers', import('vscode/service-override/markers'));
}

const reportServiceLoading = (origin: string, services: editor.IEditorOverrideServices, debugLogging: boolean) => {
for (const serviceName of Object.keys(services)) {
Expand All @@ -152,6 +169,27 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
reportServiceLoading('user', userServices, lc.debugLogging === true);
}

// files service is required
if (!serviceNames.includes('files') && !Object.keys(overrideServices).includes('fileService')) {
throw new Error('"files" service was not configured, but it is mandatory. Please add it to the "initServices" config.');
}

// theme requires textmate
if ((serviceNames.includes('theme') || Object.keys(overrideServices).includes('themeService')) &&
!(serviceNames.includes('textmate') || Object.keys(overrideServices).includes('textMateTokenizationFeature'))) {
throw new Error('"theme" requires "textmate" service. Please add it to the "initServices" config.');
}

// quickaccess requires keybindings
if ((serviceNames.includes('quickaccess') || Object.keys(overrideServices).includes('quickInputService')) &&
!(serviceNames.includes('keybindings') || Object.keys(overrideServices).includes('keybindingService'))) {
throw new Error('"quickaccess" requires "keybindings" service. Please add it to the "initServices" config.');
}
if (serviceNames.includes('markers') &&
!(serviceNames.includes('views') || Object.keys(overrideServices).includes('viewsService'))) {
throw new Error('"markers" requires "views" service. Please add it to the "initServices" config.');
}

for (const loadedImport of loadedImports) {
const serviceName = serviceNames[count];
if (lc.debugLogging === true) {
Expand All @@ -170,8 +208,14 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
services = loadedImport.default(lc.configureEditorOrViewsServiceConfig.openEditorFunc);
}
} else if (serviceName === 'configuration') {
const uri = Uri.file(lc.configureConfigurationServiceConfig!.defaultWorkspaceUri);
services = loadedImport.default(uri);
if (lc.configureConfigurationServiceConfig?.defaultWorkspaceUri) {
const uri = Uri.file(lc.configureConfigurationServiceConfig!.defaultWorkspaceUri);
services = loadedImport.default(uri);
}
} else if (serviceName === 'terminal') {
if (lc.configureTerminalServiceConfig?.backendImpl) {
services = loadedImport.default(lc.configureTerminalServiceConfig.backendImpl);
}
} else {
services = loadedImport.default();
}
Expand All @@ -183,4 +227,7 @@ const importAllServices = async (config?: InitializeServiceConfig) => {
}

await initializeMonacoService(overrideServices);
if (lc.logLevel) {
StandaloneServices.get(ILogService).setLevel(lc.logLevel);
}
};
1 change: 1 addition & 0 deletions packages/examples/main/langium_wwls.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<h2>Monaco Language Client & Langium Web Worker Language Server Example</h2>
<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>
<script type="module" src="./src/langium/main.ts"></script>
<div id="panel"></div>
</body>

</html>
6 changes: 3 additions & 3 deletions packages/examples/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"express": "~4.18.2",
"langium": "~1.2.0",
"langium-statemachine-dsl": "~1.2.0",
"monaco-editor-workers": "0.38.0",
"monaco-languageclient": "6.1.0",
"monaco-editor-workers": "0.39.1",
"monaco-languageclient": "6.2.0",
"normalize-url": "~8.0.0",
"react": "~18.2.0",
"react-dom": "~18.2.0",
Expand All @@ -46,7 +46,7 @@
},
"volta": {
"node": "18.16.0",
"npm": "9.6.6"
"npm": "9.6.7"
},
"scripts": {
"clean": "shx rm -fr dist *.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions packages/examples/main/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const createJsonEditor = async (config: {

if (config.init === true) {
await initServices({
enableFilesService: true,
enableThemeService: true,
enableTextmateService: true,
enableModelService: true,
Expand Down
22 changes: 15 additions & 7 deletions packages/examples/main/src/langium/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import { CloseAction, ErrorAction, MessageTransports } from 'vscode-languageclie
import { createConfiguredEditor } from 'vscode/monaco';
import { registerExtension } from 'vscode/extensions';
import { updateUserConfiguration } from 'vscode/service-override/configuration';
import getPreferencesServiceOverride from 'vscode/service-override/preferences';
import getFileServiceOverride from 'vscode/service-override/files';
import { LogLevel } from 'vscode/services';
// import { renderPanelPart } from 'vscode/service-override/views';
import 'vscode/default-extensions/theme-defaults';

import { buildWorkerDefinition } from 'monaco-editor-workers';
Expand Down Expand Up @@ -122,6 +124,9 @@ const run = async () => {

try {
await initServices({
// This should demonstrate that you can chose to not use the built-in loading mechanism,
// but do it manually, see below
enableFilesService: false,
enableThemeService: true,
enableTextmateService: true,
enableModelService: true,
Expand All @@ -138,17 +143,20 @@ try {
enableDebugService: true,
enableDialogService: true,
enableNotificationService: true,
// This should demonstrate that you can chose to not use the built-in loading mechanism,
// but do it manually, see below
enablePreferencesService: false,
enablePreferencesService: true,
enableSnippetsService: true,
enableQuickaccessService: true,
enableOutputService: true,
enableSearchService: true,
enableMarkersService: false,
userServices: {
// manually add the PreferencesService
...getPreferencesServiceOverride()
// manually add the files service
...getFileServiceOverride()
},
debugLogging: true
debugLogging: true,
logLevel: LogLevel.Info
});
// renderPanelPart(document.querySelector<HTMLDivElement>('#panel')!);
await setup();
await run();
} catch (e) {
Expand Down
8 changes: 4 additions & 4 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.1.0",
"monaco-editor": "~0.38.0",
"vscode": "npm:@codingame/monaco-vscode-api@~1.79.1"
"monaco-languageclient": "6.2.0",
"monaco-editor": "~0.39.0",
"vscode": "npm:@codingame/monaco-vscode-api@~1.79.2"
},
"devDependencies": {
"shx": "~0.3.4"
Expand All @@ -16,6 +16,6 @@
},
"volta": {
"node": "18.16.0",
"npm": "9.6.6"
"npm": "9.6.7"
}
}
6 changes: 3 additions & 3 deletions packages/verify/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"type": "module",
"dependencies": {
"monaco-editor-workers": "0.38.0",
"monaco-languageclient": "6.1.0",
"monaco-editor-workers": "0.39.1",
"monaco-languageclient": "6.2.0",
"vscode-ws-jsonrpc": "3.0.0",
"normalize-url": "~8.0.0"
},
Expand All @@ -14,7 +14,7 @@
},
"volta": {
"node": "18.16.0",
"npm": "9.6.6"
"npm": "9.6.7"
},
"scripts": {
"clean": "shx rm -fr dist",
Expand Down
Loading

0 comments on commit fb941be

Please sign in to comment.