Reprioritize cross-project module specifier suggestions for auto-import (#40253)

* Add test

* Suggest `paths` module specifiers even when a node_modules path was available

* Fix some tests

* Fix remaining tests

* Add comments
This commit is contained in:
Andrew Branch
2020-09-03 14:00:06 -07:00
committed by GitHub
parent db5f519514
commit 8ffb7f083d
11 changed files with 444 additions and 44 deletions
+8
View File
@@ -68,6 +68,14 @@ namespace ts {
return /^\.\.?($|[\\/])/.test(path);
}
/**
* Determines whether a path is neither relative nor absolute, e.g. "path/to/file".
* Also known misleadingly as "non-relative".
*/
export function pathIsBareSpecifier(path: string): boolean {
return !pathIsAbsolute(path) && !pathIsRelative(path);
}
export function hasExtension(fileName: string): boolean {
return stringContains(getBaseFileName(fileName), ".");
}