Cleanup/remove custom protocol bits used by quickfixes

Make use of proper LSP V3 apis: `client/registerCapability`, `workspace/executeCommand` and `workspace/applyEdit` instead.
This commit is contained in:
Kris De Volder
2017-04-20 10:21:57 -07:00
parent 6b0fc18b11
commit 954041182b
8 changed files with 170 additions and 76 deletions

View File

@@ -32,33 +32,7 @@ export interface ActivatorOptions {
jvmHeap?: string;
}
interface QuickfixRequest {
type: string;
params: any;
}
export function activate(options: ActivatorOptions, context: VSCode.ExtensionContext): Promise<LanguageClient> {
let clientPromise = _activate(options, context);
let commands = VSCode.commands;
commands.registerCommand("sts.quickfix."+options.extensionId, (fixType, fixParams) => {
return clientPromise.then(client => {
let type = new RequestType<QuickfixRequest, WorkspaceEdit, any, void>("sts/quickfix");
let params : QuickfixRequest = {type: fixType, params: fixParams};
return client.sendRequest(type, params)
.then(
(edit) => {
return VSCode.workspace.applyEdit(p2c.asWorkspaceEdit(edit))
},
(error) => {
return VSCode.window.showErrorMessage(""+error)
}
);
})
});
return clientPromise;
}
function _activate(options: ActivatorOptions, context: VSCode.ExtensionContext): Promise<LanguageClient> {
let DEBUG = options.DEBUG;
let jvmHeap = options.jvmHeap;
if (options.CONNECT_TO_LS) {