Skip to content

State that the WorkspaceClientCapabilites's applyEdit capability is enabled - #55

Merged
rcjsuen merged 1 commit into
TypeFox:masterfrom
rcjsuen:applyEdit
Feb 12, 2018
Merged

State that the WorkspaceClientCapabilites's applyEdit capability is enabled#55
rcjsuen merged 1 commit into
TypeFox:masterfrom
rcjsuen:applyEdit

Conversation

@rcjsuen

@rcjsuen rcjsuen commented Feb 11, 2018

Copy link
Copy Markdown
Contributor

In #21 support for the workspace/applyEdit request was added so the client should state this fact in its WorkspaceClientCapabilites.

My language server will only provide code actions if the client supports workspace/applyEdit requests so I need this to be enabled correctly so that my language server will work with this editor.

Comment thread src/workspace.ts
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.

@akosyakov akosyakov left a comment

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.

LGTM

Pull request TypeFox#21 added support for the workspace/applyEdit capability
so it should be stated as such in the WorkspaceClientCapabilities.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants