mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
Addresses concerns in #19624
This commit is contained in:
@@ -94,7 +94,22 @@
|
||||
"fileMatch": "composer.json",
|
||||
"url": "https://getcomposer.org/schema.json"
|
||||
}
|
||||
]
|
||||
],
|
||||
"commands": [
|
||||
{
|
||||
"title": "%command.untrustValidationExecutable%",
|
||||
"category": "%commands.categroy.php%",
|
||||
"command": "php.untrustValidationExecutable"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
"commandPalette": [
|
||||
{
|
||||
"command": "php.untrustValidationExecutable",
|
||||
"when": "php.untrustValidationExecutableContext"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "gulp compile-extension:php",
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
"configuration.validate.enable": "Enable/disable built-in PHP validation.",
|
||||
"configuration.validate.executablePath": "Points to the PHP executable.",
|
||||
"configuration.validate.run": "Whether the linter is run on save or on type.",
|
||||
"configuration.title": "PHP"
|
||||
"configuration.title": "PHP",
|
||||
"commands.categroy.php": "PHP",
|
||||
"command.untrustValidationExecutable": "Don't trust PHP validation executable"
|
||||
}
|
||||
@@ -115,6 +115,7 @@ export default class PHPValidationProvider {
|
||||
this.diagnosticCollection.delete(textDocument.uri);
|
||||
delete this.delayers[textDocument.uri.toString()];
|
||||
}, null, subscriptions);
|
||||
subscriptions.push(vscode.commands.registerCommand('php.untrustValidationExecutable', this.untrustValidationExecutable, this));
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
@@ -140,6 +141,9 @@ export default class PHPValidationProvider {
|
||||
}
|
||||
this.trigger = RunTrigger.from(section.get<string>('validate.run', RunTrigger.strings.onSave));
|
||||
}
|
||||
if (this.executableIsUserDefined !== true && this.workspaceStore.get<string>(CheckedExecutablePath, undefined) !== void 0) {
|
||||
vscode.commands.executeCommand('setContext', 'php.untrustValidationExecutableContext', true);
|
||||
}
|
||||
this.delayers = Object.create(null);
|
||||
if (this.pauseValidation) {
|
||||
this.pauseValidation = oldExecutable === this.executable;
|
||||
@@ -161,6 +165,11 @@ export default class PHPValidationProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private untrustValidationExecutable() {
|
||||
this.workspaceStore.update(CheckedExecutablePath, undefined);
|
||||
vscode.commands.executeCommand('setContext', 'php.untrustValidationExecutableContext', false);
|
||||
}
|
||||
|
||||
private triggerValidate(textDocument: vscode.TextDocument): void {
|
||||
if (textDocument.languageId !== 'php' || this.pauseValidation || !this.validationEnabled) {
|
||||
return;
|
||||
@@ -193,19 +202,14 @@ export default class PHPValidationProvider {
|
||||
title: localize('php.no', 'No'),
|
||||
isCloseAffordance: true,
|
||||
id: 'no'
|
||||
},
|
||||
{
|
||||
title: localize('php.more', 'Learn More'),
|
||||
id: 'more'
|
||||
}
|
||||
).then(selected => {
|
||||
if (!selected || selected.id === 'no') {
|
||||
this.pauseValidation = true;
|
||||
} else if (selected.id === 'yes') {
|
||||
this.workspaceStore.update(CheckedExecutablePath, this.executable);
|
||||
vscode.commands.executeCommand('setContext', 'php.untrustValidationExecutableContext', true);
|
||||
trigger();
|
||||
} else if (selected.id === 'more') {
|
||||
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://go.microsoft.com/fwlink/?linkid=839878'));
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user