Add quickfix for missing properties in concourse editor
This commit is contained in:
@@ -8,8 +8,10 @@ import * as Path from 'path';
|
||||
import * as FS from 'fs';
|
||||
import * as Net from 'net';
|
||||
import * as ChildProcess from 'child_process';
|
||||
import {LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, StreamInfo} from 'vscode-languageclient';
|
||||
import {LanguageClient, RequestType, LanguageClientOptions, SettingMonitor, ServerOptions, StreamInfo} from 'vscode-languageclient';
|
||||
import {TextDocument, OutputChannel} from 'vscode';
|
||||
import {WorkspaceEdit} from 'vscode-languageserver-types';
|
||||
import * as p2c from 'vscode-languageclient/lib/protocolConverter';
|
||||
|
||||
var log_output : OutputChannel = null;
|
||||
|
||||
@@ -28,8 +30,14 @@ function error(msg : string) {
|
||||
}
|
||||
}
|
||||
|
||||
interface QuickfixRequest {
|
||||
type: string;
|
||||
params: any;
|
||||
}
|
||||
|
||||
/** Called when extension is activated */
|
||||
export function activate(context: VSCode.ExtensionContext) {
|
||||
let commands = VSCode.commands
|
||||
let options : commons.ActivatorOptions = {
|
||||
DEBUG : false,
|
||||
CONNECT_TO_LS: false,
|
||||
@@ -47,6 +55,21 @@ export function activate(context: VSCode.ExtensionContext) {
|
||||
}
|
||||
}
|
||||
};
|
||||
commons.activate(options, context);
|
||||
let clientPromise = commons.activate(options, context);
|
||||
commands.registerCommand("sts.quickfix", (fixType, fixParams) => {
|
||||
return clientPromise.then(client => {
|
||||
let type : RequestType<QuickfixRequest, WorkspaceEdit, void> = {method : "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)
|
||||
}
|
||||
);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user