提交 0106868e 编写于 作者: D Dirk Baeumer

Show user path if no workspace path exists when editing the php path

上级 42e938f9
......@@ -86,7 +86,7 @@ export function activate(context: vscode.ExtensionContext): any {
}
function updateStatusBarItem(context: vscode.ExtensionContext, editor: vscode.TextEditor = vscode.window.activeTextEditor): void {
statusBarItem.tooltip = context.workspaceState.get<string>(PathKey, undefined) || vscode.workspace.getConfiguration('php.validate').get('executablePath', undefined);
statusBarItem.tooltip = getExecutablePath(context);
if (editor && editor.document && editor.document.languageId === 'php') {
statusBarItem.show();
} else {
......@@ -95,7 +95,7 @@ function updateStatusBarItem(context: vscode.ExtensionContext, editor: vscode.Te
}
function onPathClicked(context: vscode.ExtensionContext, validator: PHPValidationProvider) {
let value = context.workspaceState.get<string>(PathKey);
let value = getExecutablePath(context);
vscode.window.showInputBox({ prompt: localize('php.enterPath', 'The path to the PHP executable'), value: value || '' }).then(value => {
if (!value) {
// User pressed Escape
......@@ -108,6 +108,18 @@ function onPathClicked(context: vscode.ExtensionContext, validator: PHPValidatio
});
}
function getExecutablePath(context: vscode.ExtensionContext): string {
let result = context.workspaceState.get<string>(PathKey, undefined);
if (result) {
return result;
}
let section = vscode.workspace.getConfiguration('php.validate');
if (section) {
return section.get('executablePath', undefined);
}
return undefined;
}
function migrateExecutablePath(settingsExecutablePath: string): Thenable<string> {
return vscode.window.showInputBox(
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册