use workspace root as project root when possible
This commit is contained in:
parent
b1fcf886cc
commit
ed95234b22
1 changed files with 1 additions and 0 deletions
|
@ -815,6 +815,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
|||
public getProjectRootPath(uri: string): string {
|
||||
let u = Uri.parse(uri)
|
||||
if (u.scheme != 'file') return workspace.root
|
||||
if (u.fsPath.startsWith(workspace.root)) return workspace.root
|
||||
let res = findUp.sync(['package.json', 'tsconfig.json', 'jsconfig.json'], { cwd: path.dirname(u.fsPath) })
|
||||
return res ? path.dirname(res) : workspace.rootPath
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue