Skip to content

Commit 67b49fd

Browse files
committed
Don't pass output channel everywhere
1 parent 5a1a15e commit 67b49fd

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

vscode-dotty/src/extension.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function connectToSbt(coursierPath: string): Thenable<rpc.MessageConnection> {
104104
sbtStatusBar.show()
105105

106106
return offeringToRetry(() => {
107-
return withSbtInstance(outputChannel, coursierPath).then(connection => {
107+
return withSbtInstance(coursierPath).then(connection => {
108108
markSbtUp()
109109
const interval = setInterval(() => checkSbt(interval, connection, coursierPath), sbtCheckIntervalMs)
110110
return connection
@@ -216,7 +216,7 @@ function runLanguageServer(coursierPath: string, languageServerArtifactFile: str
216216
})
217217
}
218218

219-
function startNewSbtInstance(log: vscode.OutputChannel, coursierPath: string) {
219+
function startNewSbtInstance(coursierPath: string) {
220220
fetchWithCoursier(coursierPath, sbtArtifact).then((sbtClasspath) => {
221221
sbtProcess = cpp.spawn("java", [
222222
"-Dsbt.log.noformat=true",
@@ -229,25 +229,25 @@ function startNewSbtInstance(log: vscode.OutputChannel, coursierPath: string) {
229229
sbtProcess.stdin.end()
230230

231231
sbtProcess.stdout.on('data', data => {
232-
log.append(data.toString())
232+
outputChannel.append(data.toString())
233233
})
234234
sbtProcess.stderr.on('data', data => {
235-
log.append(data.toString())
235+
outputChannel.append(data.toString())
236236
})
237237
})
238238
}
239239

240240
/**
241241
* Connects to an existing sbt server, or boots up one instance and connects to it.
242242
*/
243-
function withSbtInstance(log: vscode.OutputChannel, coursierPath: string): Thenable<rpc.MessageConnection> {
243+
function withSbtInstance(coursierPath: string): Thenable<rpc.MessageConnection> {
244244
const serverSocketInfo = path.join(workspaceRoot, "project", "target", "active.json")
245245

246246
if (!fs.existsSync(serverSocketInfo)) {
247-
startNewSbtInstance(log, coursierPath)
247+
startNewSbtInstance(coursierPath)
248248
}
249249

250-
return sbtserver.connectToSbtServer(log)
250+
return sbtserver.connectToSbtServer(outputChannel)
251251
}
252252

253253
function fetchWithCoursier(coursierPath: string, artifact: string, extra: string[] = []) {
@@ -305,8 +305,6 @@ function run(serverOptions: ServerOptions) {
305305
revealOutputChannelOn: RevealOutputChannelOn.Never
306306
}
307307

308-
// outputChannel.dispose()
309-
310308
const client = new LanguageClient('dotty', 'Dotty Language Server', serverOptions, clientOptions);
311309

312310
// Push the disposable to the context's subscriptions so that the

0 commit comments

Comments
 (0)