html language server breaks js auto completion if imports are used. Fixes #16426

This commit is contained in:
Martin Aeschlimann
2016-12-05 11:18:07 +01:00
parent 724c020583
commit 3b72900e21
2 changed files with 24 additions and 3 deletions

View File

@@ -27,6 +27,20 @@ export function getWordAtText(text: string, offset: number, wordDefinition: RegE
return { start: offset, length: 0 };
}
export function startsWith(haystack: string, needle: string): boolean {
if (haystack.length < needle.length) {
return false;
}
for (let i = 0; i < needle.length; i++) {
if (haystack[i] !== needle[i]) {
return false;
}
}
return true;
}
const CR = '\r'.charCodeAt(0);
const NL = '\n'.charCodeAt(0);