[css] path completion sometimes only works for one folder level. Fixes #46722

This commit is contained in:
Martin Aeschlimann
2018-03-29 15:20:30 +02:00
parent f50b6d7f13
commit 11f5d549db
5 changed files with 94 additions and 25 deletions

View File

@@ -54,16 +54,11 @@ export function providePathSuggestions(value: string, range: Range, activeDocFsP
replaceRange = getReplaceRange(range, valueAfterLastSlash);
}
let parentDir: string;
if (lastIndexOfSlash === -1) {
parentDir = path.resolve(root);
} else {
const valueBeforeLastSlash = value.slice(0, lastIndexOfSlash + 1);
const valueBeforeLastSlash = value.slice(0, lastIndexOfSlash + 1);
parentDir = startsWith(value, '/')
? path.resolve(root, '.' + valueBeforeLastSlash)
: path.resolve(activeDocFsPath, '..', valueBeforeLastSlash);
}
const parentDir = startsWith(value, '/')
? path.resolve(root, '.' + valueBeforeLastSlash)
: path.resolve(activeDocFsPath, '..', valueBeforeLastSlash);
try {
return fs.readdirSync(parentDir).map(f => {