Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { MonacoToProtocolConverter, ProtocolToMonacoConverter } from './converter';
import { Workspace, TextDocumentDidChangeEvent, TextDocument, Event, Emitter } from 'vscode-base-languageclient/lib/services';
import { Workspace, TextDocumentDidChangeEvent, TextDocument, Event, Emitter, WorkspaceClientCapabilites } from 'vscode-base-languageclient/lib/services';
import { WorkspaceEdit } from 'vscode-base-languageclient/lib/base';
import IModel = monaco.editor.IModel;
import IResourceEdit = monaco.languages.IResourceEdit;

export class MonacoWorkspace implements Workspace {

public readonly capabilities: WorkspaceClientCapabilites = {
applyEdit: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch! I think documentChanges are covered by applyEdit as well. Could you add them to capabilities please:

    applyEdit: true,
    workspaceEdit: {
        documentChanges: true
    }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akosyakov Actually, the documentChanges support isn't perfect right now.

if (item.documentChanges) {
for (const change of item.documentChanges) {
const resource = monaco.Uri.parse(change.textDocument.uri);
edits.push(...this.asResourceEdits(resource, change.edits));
}
} else if (item.changes) {

We just convert them into IResourceEdits without checking if the version from the language server matches what's in the Monaco Editor. I am planning to address this (as well as updating the capabilities) in a separate pull request.

};
protected readonly documents = new Map<string, TextDocument>();
protected readonly onDidOpenTextDocumentEmitter = new Emitter<TextDocument>();
protected readonly onDidCloseTextDocumentEmitter = new Emitter<TextDocument>();
Expand Down