[css] .asar file breaks CSS path completion. Fixes #46638

This commit is contained in:
Martin Aeschlimann
2018-03-28 21:39:44 +02:00
parent 9e0374f29f
commit d9d762d1ce
4 changed files with 34 additions and 4 deletions

View File

@@ -82,7 +82,7 @@ function providePaths(valueBeforeCursor: string, activeDocFsPath: string, root?:
try {
return fs.readdirSync(parentDir).map(f => {
return fs.statSync(path.resolve(parentDir, f)).isDirectory()
return isDir(path.resolve(parentDir, f))
? f + '/'
: f;
});
@@ -91,6 +91,14 @@ function providePaths(valueBeforeCursor: string, activeDocFsPath: string, root?:
}
}
function isDir(p: string) {
try {
return fs.statSync(p).isDirectory();
} catch (e) {
return false;
}
}
function pathToSuggestion(p: string, valueBeforeCursor: string, fullValue: string, range: Range): CompletionItem {
const isDir = p[p.length - 1] === '/';