Add live process management commands to vscode
This commit is contained in:
@@ -4,6 +4,7 @@ import * as VSCode from 'vscode';
|
||||
import {workspace} from 'vscode';
|
||||
|
||||
import * as commons from '@pivotal-tools/commons-vscode';
|
||||
import * as liveHoverUi from './live-hover-connect-ui';
|
||||
|
||||
import {LanguageClient} from "vscode-languageclient";
|
||||
|
||||
@@ -67,5 +68,8 @@ export function activate(context: VSCode.ExtensionContext): Thenable<LanguageCli
|
||||
highlightCodeLensSettingKey: 'boot-java.highlight-codelens.on'
|
||||
};
|
||||
|
||||
return commons.activate(options, context);
|
||||
return commons.activate(options, context).then(client => {
|
||||
liveHoverUi.activate(client, options, context);
|
||||
return client;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
import * as VSCode from 'vscode';
|
||||
import { LanguageClient } from "vscode-languageclient";
|
||||
import { ActivatorOptions } from '@pivotal-tools/commons-vscode';
|
||||
import { stringify } from 'querystring';
|
||||
|
||||
interface ProcessCommandInfo {
|
||||
processKey : string;
|
||||
label: string;
|
||||
action: string
|
||||
}
|
||||
|
||||
async function liveHoverConnectHandler() {
|
||||
|
||||
//sts.vscode-spring-boot.codeAction
|
||||
const processData : ProcessCommandInfo[] = await VSCode.commands.executeCommand('sts/livedata/listProcesses');
|
||||
const choiceMap = new Map<string, ProcessCommandInfo>();
|
||||
const choices : string[] = [];
|
||||
processData.forEach(p => {
|
||||
const slash = p.action.lastIndexOf('/');
|
||||
if (slash>=0) {
|
||||
var actionLabel = p.action.substring(slash+1);
|
||||
actionLabel = actionLabel.substring(0, 1).toUpperCase() + actionLabel.substring(1);
|
||||
const choiceLabel = actionLabel + " " + p.label;
|
||||
choiceMap.set(choiceLabel, p);
|
||||
choices.push(choiceLabel);
|
||||
}
|
||||
});
|
||||
if (choices) {
|
||||
const picked = await VSCode.window.showQuickPick(choices);
|
||||
if (picked) {
|
||||
const chosen = choiceMap.get(picked);
|
||||
await VSCode.commands.executeCommand(chosen.action, chosen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when extension is activated */
|
||||
export function activate(
|
||||
client: LanguageClient,
|
||||
options: ActivatorOptions,
|
||||
context: VSCode.ExtensionContext
|
||||
) {
|
||||
context.subscriptions.push(
|
||||
VSCode.commands.registerCommand('vscode-spring-boot.live-hover.connect', liveHoverConnectHandler)
|
||||
);
|
||||
}
|
||||
@@ -64,6 +64,11 @@
|
||||
"configuration": "./properties-support/language-configuration.json"
|
||||
}
|
||||
],
|
||||
"commands": [ {
|
||||
"command": "vscode-spring-boot.live-hover.connect",
|
||||
"title": "Manage Live Spring Boot Process Connections"
|
||||
}
|
||||
],
|
||||
"configuration": {
|
||||
"type": "object",
|
||||
"title": "Boot-Java Configuration",
|
||||
|
||||
Reference in New Issue
Block a user