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

Update to monaco-editor 0.40.0 and monaco-vscode-api 1.80.2 #513

Merged
merged 6 commits into from
Aug 4, 2023
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
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.3.0 | 1.80.2 | 0.40.0 | Released 2023-08-0x |
| 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 |
Expand Down Expand Up @@ -250,7 +251,7 @@ loader.config({ monaco });
If you use pnpm, you have to add `vscode` / `monaco-vscode-api` as direct dependency (see the [following table](#monaco-editor--monaco-vscode-api-compatibility-table)), otherwise the installation will fail.

```json
"vscode": "npm:@codingame/monaco-vscode-api@~1.78.8"
"vscode": "npm:@codingame/monaco-vscode-api@~1.80.2"
```

## Licenses
Expand Down
1,110 changes: 579 additions & 531 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
"private": true,
"type": "module",
"devDependencies": {
"@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.42.0",
"@types/node": "~18.16.19",
"@types/vscode": "~1.80.0",
"@typescript-eslint/eslint-plugin": "~6.1.0",
"@typescript-eslint/parser": "~6.1.0",
"editorconfig": "~2.0.0",
"eslint": "~8.45.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",
"eslint-plugin-unused-imports": "~3.0.0",
"path-browserify": "~1.0.1",
"shx": "~0.3.4",
"tslib": "~2.5.3",
"typescript": "~5.1.3",
"vite": "~4.3.9"
"tslib": "~2.6.0",
"typescript": "~5.1.6",
"vite": "~4.4.6"
},
"volta": {
"node": "18.16.0",
"node": "18.17.0",
"npm": "9.6.7"
},
"scripts": {
Expand Down
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.3.0] - 2023-08-0x

- Update to `monaco-editor` `0.40.0` and `monaco-vscode-api` `1.80.2` [#513](https://github.com/TypeFox/monaco-languageclient/pull/513)

## [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)
Expand Down
1 change: 0 additions & 1 deletion packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ See [here](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md)

## History


For the history please see the [README](https://github.com/TypeFox/monaco-languageclient/blob/main/README.md#latest-important-project-changes) and [CHANGELOG](https://github.com/TypeFox/monaco-languageclient/blob/main/CHANGELOG.md).

## License
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.2.0",
"version": "6.3.0-next.2",
"description": "Monaco Language client implementation",
"author": {
"name": "TypeFox GmbH",
Expand Down Expand Up @@ -37,7 +37,7 @@
"npm": ">=9.0.0"
},
"volta": {
"node": "18.16.0",
"node": "18.17.0",
"npm": "9.6.7"
},
"files": [
Expand All @@ -48,14 +48,14 @@
"License.txt"
],
"dependencies": {
"monaco-editor": "~0.39.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.79.3",
"monaco-editor": "~0.40.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.80.2",
"vscode-jsonrpc": "~8.1.0",
"vscode-languageclient": "~8.1.0"
},
"peerDependencies": {
"monaco-editor": "~0.39.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.79.3"
"monaco-editor": "~0.40.0",
"vscode": "npm:@codingame/monaco-vscode-api@1.80.2"
},
"peerDependenciesMeta": {
"monaco-editor": {
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

export type { IConnectionProvider, MonacoLanguageClientOptions } from './monaco-language-client.js';
export * from './monaco-language-client.js';
export * from './monaco-vscode-api-services.js';
141 changes: 9 additions & 132 deletions packages/client/src/monaco-language-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,155 +3,32 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

/* eslint-disable @typescript-eslint/dot-notation */

import { BaseLanguageClient, MessageTransports, LanguageClientOptions } from 'vscode-languageclient/lib/common/client.js';
import { ConfigurationFeature, SyncConfigurationFeature } from 'vscode-languageclient/lib/common/configuration.js';
import { DidChangeTextDocumentFeature, DidCloseTextDocumentFeature, DidOpenTextDocumentFeature, DidSaveTextDocumentFeature, WillSaveFeature, WillSaveWaitUntilFeature } from 'vscode-languageclient/lib/common/textSynchronization.js';
import { CompletionItemFeature } from 'vscode-languageclient/lib/common/completion.js';
import { HoverFeature } from 'vscode-languageclient/lib/common/hover.js';
import { SignatureHelpFeature } from 'vscode-languageclient/lib/common/signatureHelp.js';
import { DefinitionFeature } from 'vscode-languageclient/lib/common/definition.js';
import { ReferencesFeature } from 'vscode-languageclient/lib/common/reference.js';
import { DocumentHighlightFeature } from 'vscode-languageclient/lib/common/documentHighlight.js';
import { DocumentSymbolFeature } from 'vscode-languageclient/lib/common/documentSymbol.js';
import { CodeActionFeature } from 'vscode-languageclient/lib/common/codeAction.js';
import { CodeLensFeature } from 'vscode-languageclient/lib/common/codeLens.js';
import { DocumentFormattingFeature, DocumentOnTypeFormattingFeature, DocumentRangeFormattingFeature } from 'vscode-languageclient/lib/common/formatting.js';
import { RenameFeature } from 'vscode-languageclient/lib/common/rename.js';
import { DocumentLinkFeature } from 'vscode-languageclient/lib/common/documentLink.js';
import { ExecuteCommandFeature } from 'vscode-languageclient/lib/common/executeCommand.js';
import { TypeDefinitionFeature } from 'vscode-languageclient/lib/common/typeDefinition.js';
import { ImplementationFeature } from 'vscode-languageclient/lib/common/implementation.js';
import { ColorProviderFeature } from 'vscode-languageclient/lib/common/colorProvider.js';
import { WorkspaceFoldersFeature } from 'vscode-languageclient/lib/common/workspaceFolder.js';
import { FoldingRangeFeature } from 'vscode-languageclient/lib/common/foldingRange.js';
import { DeclarationFeature } from 'vscode-languageclient/lib/common/declaration.js';
import { SelectionRangeFeature } from 'vscode-languageclient/lib/common/selectionRange.js';
import { SemanticTokensFeature } from 'vscode-languageclient/lib/common/semanticTokens.js';
import { LinkedEditingFeature } from 'vscode-languageclient/lib/common/linkedEditingRange.js';
import { InlayHintsFeature } from 'vscode-languageclient/lib/common/inlayHint.js';
import { DiagnosticFeature } from 'vscode-languageclient/lib/common/diagnostic.js';
import { ProgressFeature } from 'vscode-languageclient/lib/common/progress.js';
import { RegistrationParams, UnregistrationParams } from 'vscode-languageclient';
import { TextDocument } from 'vscode';
import { WorkspaceSymbolFeature } from 'vscode-languageclient/lib/common/workspaceSymbol.js';
import { CallHierarchyFeature } from 'vscode-languageclient/lib/common/callHierarchy.js';
import { DidCreateFilesFeature, DidDeleteFilesFeature, DidRenameFilesFeature, WillCreateFilesFeature, WillDeleteFilesFeature, WillRenameFilesFeature } from 'vscode-languageclient/lib/common/fileOperations.js';
import { TypeHierarchyFeature } from 'vscode-languageclient/lib/common/typeHierarchy.js';
import { InlineValueFeature } from 'vscode-languageclient/lib/common/inlineValue.js';
import { NotebookDocumentSyncFeature } from 'vscode-languageclient/lib/common/notebook.js';

export interface IConnectionProvider {
get(encoding: string): Promise<MessageTransports>;
}

export type MonacoLanguageClientOptions = {
name: string;
id?: string;
clientOptions: LanguageClientOptions;
connectionProvider: IConnectionProvider;
}

export class MonacoLanguageClient extends BaseLanguageClient {
protected readonly connectionProvider: IConnectionProvider;

constructor({ id, name, clientOptions, connectionProvider }: MonacoLanguageClient.Options) {
constructor({ id, name, clientOptions, connectionProvider }: MonacoLanguageClientOptions) {
super(id || name.toLowerCase(), name, clientOptions);
this.connectionProvider = connectionProvider;

// Hack because vscode-language client rejects the whole registration block if one capability registration has no associated client feature registered
// Some language servers still send the registration even though the client says it doesn't support it
const originalHandleRegistrationRequest: (params: RegistrationParams) => Promise<void> = this['handleRegistrationRequest'].bind(this);
this['handleRegistrationRequest'] = (params: RegistrationParams) => {
originalHandleRegistrationRequest({
...params,
registrations: params.registrations.filter(registration => this.getFeature(<any>registration.method) != null)
});
};
const originalHandleUnregistrationRequest: (params: UnregistrationParams) => Promise<void> = this['handleUnregistrationRequest'].bind(this);
this['handleUnregistrationRequest'] = (params: UnregistrationParams) => {
originalHandleUnregistrationRequest({
...params,
unregisterations: params.unregisterations.filter(unregistration => this.getFeature(<any>unregistration.method) != null)
});
};
}

protected createMessageTransports(encoding: string): Promise<MessageTransports> {
return this.connectionProvider.get(encoding);
}

protected override getLocale(): string {
return navigator.language || 'en-US';
}

protected override registerBuiltinFeatures() {
const pendingFullTextDocumentChanges: Map<string, TextDocument> = new Map();
this.registerFeature(new ConfigurationFeature(this));
this.registerFeature(new DidOpenTextDocumentFeature(this, this['_syncedDocuments']));
this['_didChangeTextDocumentFeature'] = new DidChangeTextDocumentFeature(this, pendingFullTextDocumentChanges);
this['_didChangeTextDocumentFeature'].onPendingChangeAdded(() => {
this['triggerPendingChangeDelivery']();
});
this.registerFeature(this['_didChangeTextDocumentFeature']);
this.registerFeature(new DidCloseTextDocumentFeature(this, this['_syncedDocuments'], pendingFullTextDocumentChanges));
this.registerFeature(new CompletionItemFeature(this));
this.registerFeature(new HoverFeature(this));
this.registerFeature(new SignatureHelpFeature(this));
this.registerFeature(new DefinitionFeature(this));
this.registerFeature(new ReferencesFeature(this));
this.registerFeature(new DocumentHighlightFeature(this));
this.registerFeature(new DocumentSymbolFeature(this));
this.registerFeature(new CodeActionFeature(this));
this.registerFeature(new CodeLensFeature(this));
this.registerFeature(new DocumentFormattingFeature(this));
this.registerFeature(new DocumentRangeFormattingFeature(this));
this.registerFeature(new DocumentOnTypeFormattingFeature(this));
this.registerFeature(new RenameFeature(this));
this.registerFeature(new DocumentLinkFeature(this));
this.registerFeature(new ExecuteCommandFeature(this));
this.registerFeature(new SyncConfigurationFeature(this));
this.registerFeature(new TypeDefinitionFeature(this));
this.registerFeature(new ImplementationFeature(this));
this.registerFeature(new ColorProviderFeature(this));
// We only register the workspace folder feature if the client is not locked
// to a specific workspace folder.
if (this.clientOptions.workspaceFolder === undefined) {
this.registerFeature(new WorkspaceFoldersFeature(this));
}
this.registerFeature(new FoldingRangeFeature(this));
this.registerFeature(new DeclarationFeature(this));
this.registerFeature(new SelectionRangeFeature(this));
this.registerFeature(new SemanticTokensFeature(this));
this.registerFeature(new LinkedEditingFeature(this));
this.registerFeature(new InlayHintsFeature(this));
this.registerFeature(new DiagnosticFeature(this));
// enabled since monaco-vscode-api 1.78.5 (PR https://github.com/CodinGame/monaco-vscode-api/pull/109)
this.registerFeature(new WillSaveFeature(this));
this.registerFeature(new WillSaveWaitUntilFeature(this));
this.registerFeature(new DidSaveTextDocumentFeature(this));
// enabled since monaco-vscode-api 1.79.0 (PR https://github.com/CodinGame/monaco-vscode-api/pull/110)
this.registerFeature(new WorkspaceSymbolFeature(this));
this.registerFeature(new DidCreateFilesFeature(this));
this.registerFeature(new DidRenameFilesFeature(this));
this.registerFeature(new DidDeleteFilesFeature(this));
this.registerFeature(new WillCreateFilesFeature(this));
this.registerFeature(new WillRenameFilesFeature(this));
this.registerFeature(new WillDeleteFilesFeature(this));
this.registerFeature(new CallHierarchyFeature(this));
this.registerFeature(new TypeHierarchyFeature(this));
this.registerFeature(new InlineValueFeature(this));
}

/**
* These are all contained in BaseLanguageClient#registerBuiltinFeatures but not registered
* in MonacoLanguageClient. This method is not called!
*/
public registerNotUsedFeatures() {
// these will stay unsupported for now
this.registerFeature(new ProgressFeature(this));
this.registerFeature(new NotebookDocumentSyncFeature(this));
}
}
export namespace MonacoLanguageClient {
export interface Options {
name: string;
id?: string;
clientOptions: LanguageClientOptions;
connectionProvider: IConnectionProvider;
return super.getLocale() || 'en-US';
}
}
Loading