Skip to content

Code Action Resolve callback accepts wrong type #1478

@Mehgugs

Description

@Mehgugs

if (this.settings.isCodeActionResolveSupported("edit")) {
this.connection.onRequest(
CodeActionResolveRequest.method,
(codeAction: IRefactorCodeAction) => {
if (!codeAction.data.uri) {
return codeAction;
}
return new ElmWorkspaceMatcher((codeAction: IRefactorCodeAction) =>
URI.parse(codeAction.data.uri),
).handleResolve((codeAction, program, sourceFile) =>
this.onCodeActionResolve(codeAction, program, sourceFile),
)(codeAction);
},
);
}

In this snippet the callback takes an IRefactorCodeAction; and I believe typescript decides to remove the check on line 117 because IRefactorCodeAction has it defined to be a string. If would probably be better to accept a CodeAction and cast to IRefactorCodeAction as appropriate.

Here is the equivalent part of the js from the installed package:

        if (this.settings.isCodeActionResolveSupported("edit")) {
            this.connection.onRequest(vscode_languageserver_1.CodeActionResolveRequest.method, new elmWorkspaceMatcher_1.ElmWorkspaceMatcher((codeAction) => vscode_uri_1.URI.parse(codeAction.data.uri)).handleResolve((codeAction, program, sourceFile) => this.onCodeActionResolve(codeAction, program, sourceFile)));
        }

Currently this seems to cause most of the code actions I try to run to fail when using zed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions