use workspace.cwd when config file not resolved
This commit is contained in:
parent
da9f6cc3bd
commit
0473880f30
2 changed files with 4 additions and 3 deletions
|
@ -101,7 +101,8 @@ export default class BufferSyncSupport {
|
|||
}
|
||||
}
|
||||
if (this.client.apiVersion.gte(API.v230)) {
|
||||
args.projectRootPath = this.client.getProjectRootPath(document.uri)
|
||||
let root = this.client.getProjectRootPath(document.uri)
|
||||
if (root) args.projectRootPath = root
|
||||
}
|
||||
|
||||
this.client.execute('open', args, false) // tslint:disable-line
|
||||
|
|
|
@ -816,8 +816,8 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
|
|||
let u = Uri.parse(uri)
|
||||
if (u.scheme != 'file') return workspace.cwd
|
||||
if (u.fsPath.startsWith(workspace.root) && workspace.root != os.homedir()) return workspace.cwd
|
||||
let res = findUp.sync(['package.json', 'tsconfig.json', 'jsconfig.json'], { cwd: path.dirname(u.fsPath) })
|
||||
return res ? path.dirname(res) : workspace.rootPath
|
||||
let res = findUp.sync(['tsconfig.json', 'jsconfig.json'], { cwd: path.dirname(u.fsPath) })
|
||||
return res ? path.dirname(res) : workspace.cwd
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue