fixes #3815: [php] autocomplete is not showing user variables

This commit is contained in:
Martin Aeschlimann
2016-03-16 13:07:46 +01:00
parent 4a51ef0742
commit 72e4ba9ae2

View File

@@ -33,7 +33,7 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
};
var matches = (name:string) => {
return prefix.length === 0 || name.length > prefix.length && name.substr(0, prefix.length) === prefix;
return prefix.length === 0 || name.length >= prefix.length && name.substr(0, prefix.length) === prefix;
};
for (var name in phpGlobals.globalvariables) {
@@ -62,7 +62,7 @@ export default class PHPCompletionItemProvider implements CompletionItemProvider
}
var text = document.getText();
if (matches('$')) {
if (prefix[0] === '$') {
var variableMatch = /\$([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/g;
var match : RegExpExecArray = null;
while (match = variableMatch.exec(text)) {