Add quickfix for missing properties in concourse editor
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
|
||||
"stopOnEntry": false,
|
||||
"stopOnEntry": true,
|
||||
"sourceMaps": true,
|
||||
"outDir": "${workspaceRoot}/out/lib",
|
||||
"preLaunchTask": "npm"
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
"onLanguage:concourse-task-yaml"
|
||||
],
|
||||
"contributes": {
|
||||
"commands": [
|
||||
{
|
||||
"command": "mycommand.sayHello",
|
||||
"title": "Say Hello"
|
||||
}
|
||||
],
|
||||
"languages": [
|
||||
{
|
||||
"id": "concourse-pipeline-yaml",
|
||||
@@ -84,7 +90,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"vsce": "^1.17.0",
|
||||
"typescript": "^2.0.x",
|
||||
"typescript": "^2.2.x",
|
||||
"@types/node": "^6.0.40",
|
||||
"vscode": "^1.0.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user