Skip to content

Commit 610e8b2

Browse files
authored
Merge pull request #252 from bubba/fix-debug-run-launch
Make the arguments to run + debug the same
2 parents df1eb41 + 86f47d9 commit 610e8b2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/extension.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,17 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
171171
return;
172172
}
173173

174-
const runArgs: string[] = ['--lsp'];
175-
let debugArgs: string[] = ['--lsp'];
174+
let args: string[] = ['--lsp'];
176175

177176
const serverVariant = workspace.getConfiguration('haskell', uri).languageServerVariant;
178177
// ghcide does not accept -d and -l params
179178
if (serverVariant !== 'ghcide') {
180179
if (logLevel === 'messages') {
181-
debugArgs = debugArgs.concat(['-d']);
180+
args = args.concat(['-d']);
182181
}
183182

184183
if (logFile !== '') {
185-
debugArgs = debugArgs.concat(['-l', logFile]);
184+
args = args.concat(['-l', logFile]);
186185
}
187186
}
188187

@@ -193,18 +192,18 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
193192
cwd: folder ? undefined : path.dirname(uri.fsPath),
194193
};
195194

196-
// If the VS Code extension is launched in debug mode then the debug server
197-
// options are used, otherwise the run options are used.
195+
// For our intents and purposes, the server should be launched the same way in
196+
// both debug and run mode.
198197
const serverOptions: ServerOptions = {
199-
run: { command: serverExecutable, transport: TransportKind.stdio, args: runArgs, options: exeOptions },
200-
debug: { command: serverExecutable, transport: TransportKind.stdio, args: debugArgs, options: exeOptions },
198+
run: { command: serverExecutable, transport: TransportKind.stdio, args, options: exeOptions },
199+
debug: { command: serverExecutable, transport: TransportKind.stdio, args, options: exeOptions },
201200
};
202201

203202
// Set a unique name per workspace folder (useful for multi-root workspaces).
204203
const langName = 'Haskell' + (folder ? ` (${folder.name})` : '');
205204
const outputChannel: OutputChannel = window.createOutputChannel(langName);
206-
outputChannel.appendLine('[client] run command: "' + serverExecutable + ' ' + runArgs.join(' ') + '"');
207-
outputChannel.appendLine('[client] debug command: "' + serverExecutable + ' ' + debugArgs.join(' ') + '"');
205+
outputChannel.appendLine('[client] run command: "' + serverExecutable + ' ' + args.join(' ') + '"');
206+
outputChannel.appendLine('[client] debug command: "' + serverExecutable + ' ' + args.join(' ') + '"');
208207

209208
outputChannel.appendLine(`[client] server cwd: ${exeOptions.cwd}`);
210209

0 commit comments

Comments
 (0)