提交 ef47354d 编写于 作者: M Martin Aeschlimann 提交者: GitHub

Merge pull request #19015 from mousetraps/9003

#9003 Provide temporary option to disable the built-in PHP completion provider
......@@ -39,6 +39,11 @@
"type": "object",
"order": 20,
"properties": {
"php.builtInCompletions.enable": {
"type": "boolean",
"default": true,
"description": "%configuration.builtInCompletions.enable%"
},
"php.validate.enable": {
"type": "boolean",
"default": true,
......
{
"configuration.validate.enable": "Whether php validation is enabled or not.",
"configuration.validate.executablePath": "Points to the php executable.",
"configuration.builtInCompletions.enable": "Enable/disable built-in PHP completions.",
"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"
}
\ No newline at end of file
......@@ -5,7 +5,7 @@
'use strict';
import { CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Position, Range, TextEdit } from 'vscode';
import { CompletionItemProvider, CompletionItem, CompletionItemKind, CancellationToken, TextDocument, Position, Range, TextEdit, workspace } from 'vscode';
import phpGlobals = require('./phpGlobals');
export default class PHPCompletionItemProvider implements CompletionItemProvider {
......@@ -14,6 +14,12 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): Promise<CompletionItem[]> {
let result: CompletionItem[] = [];
let shouldProvideCompletionItems = workspace.getConfiguration('php').get<boolean>('builtInCompletions.enable', true);
if (!shouldProvideCompletionItems) {
return Promise.resolve(result);
}
var range = document.getWordRangeAtPosition(position);
var prefix = range ? document.getText(range) : '';
if (!range) {
......
......@@ -211,7 +211,6 @@ const configurationValueWhitelist = [
'editor.snippetSuggestions',
'editor.selectionHighlight',
'editor.glyphMargin',
'php.validate.run',
'editor.wordSeparators',
'editor.mouseWheelScrollSensitivity',
'editor.suggestOnTriggerCharacters',
......@@ -224,7 +223,9 @@ const configurationValueWhitelist = [
'editor.trimAutoWhitespace',
'editor.folding',
'workbench.editor.enablePreviewFromQuickOpen',
'php.builtInCompletions.enable',
'php.validate.enable',
'php.validate.run',
'editor.parameterHints',
];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册