Address feedback

This commit is contained in:
Pine Wu 2018-02-23 14:13:22 -08:00
parent 16af175b3a
commit 6936409a1f
3 changed files with 9 additions and 5 deletions

View file

@ -64,12 +64,17 @@ export function providePathSuggestions(value: string, activeDocFsPath: string, r
return [];
}
const valueAfterLastSlash = value.slice(value.lastIndexOf('/') + 1);
const valueBeforeLastSlash = value.slice(0, value.lastIndexOf('/') + 1);
const lastIndexOfSlash = value.lastIndexOf('/');
const valueAfterLastSlash = value.slice(lastIndexOfSlash + 1);
const valueBeforeLastSlash = value.slice(0, lastIndexOfSlash + 1);
const parentDir = startsWith(value, '/')
? path.resolve(root, '.' + valueBeforeLastSlash)
: path.resolve(activeDocFsPath, '..', valueBeforeLastSlash);
if (!fs.existsSync(parentDir)) {
return [];
}
return fs.readdirSync(parentDir).map(f => {
return {
label: f,

View file

@ -1,4 +1,3 @@
--ui tdd
--useColors true
./out/test
./out/test/pathCompletion
./out/test

View file

@ -6,7 +6,7 @@
"noUnusedLocals": true,
"sourceMap": true,
"lib": [
"es5", "es2015.promise", "dom"
"es5", "es2015.promise"
]
}
}