Skip to content

Commit cf2c367

Browse files
committed
IDE: Don't rely on current working directory
1 parent 786788b commit cf2c367

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

vscode-dotty/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let sbtStatusBar: vscode.StatusBarItem
3131

3232
const sbtVersion = "1.2.3"
3333
const sbtArtifact = `org.scala-sbt:sbt-launch:${sbtVersion}`
34-
const workspaceRoot = `${vscode.workspace.rootPath}`
34+
export const workspaceRoot = `${vscode.workspace.rootPath}`
3535
const disableDottyIDEFile = path.join(workspaceRoot, ".dotty-ide-disabled")
3636
const sbtProjectDir = path.join(workspaceRoot, "project")
3737
const sbtPluginFile = path.join(sbtProjectDir, "dotty-plugin.sbt")

vscode-dotty/src/sbt-server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import * as rpc from 'vscode-jsonrpc'
1818

1919
import * as vscode from 'vscode'
2020

21+
import { workspaceRoot } from './extension'
22+
2123
/** The result of successful `sbt/exec` call. */
2224
export interface ExecResult {
2325
status: string
@@ -89,7 +91,7 @@ function connectSocket(socket: net.Socket): net.Socket {
8991

9092
// the port file is hardcoded to a particular location relative to the build.
9193
function discoverUrl(): url.Url {
92-
let pf = path.join(process.cwd(), 'project', 'target', 'active.json');
94+
let pf = path.join(workspaceRoot, 'project', 'target', 'active.json');
9395
let portfile = JSON.parse(fs.readFileSync(pf).toString());
9496
return url.parse(portfile.uri);
9597
}

0 commit comments

Comments
 (0)