Skip to content

Commit

Permalink
Fix LSP on Windows (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiribenes committed Sep 29, 2024
1 parent b7551fb commit 71ae96e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import * as vscode from 'vscode';
import { LanguageClient, LanguageClientOptions, ServerOptions, ExecuteCommandRequest, StreamInfo } from 'vscode-languageclient';
import { LanguageClient, LanguageClientOptions, ServerOptions, ExecuteCommandRequest, StreamInfo, ExecutableOptions } from 'vscode-languageclient';
import { EffektManager } from './effektManager';
import { Monto } from './monto';

Expand Down Expand Up @@ -49,9 +49,18 @@ export async function activate(context: vscode.ExtensionContext) {
} else {
const effektExecutable = await effektManager.locateEffektExecutable();
const args = effektManager.getEffektArgs();

/* > Node.js will now error with EINVAL if a .bat or .cmd file is passed to child_process.spawn and child_process.spawnSync without the shell option set.
* > If the input to spawn/spawnSync is sanitized, users can now pass { shell: true } as an option to prevent the occurrence of EINVALs errors.
*
* https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
*/
const isWindows = process.platform === 'win32';
const execOptions: ExecutableOptions = { shell: isWindows };

serverOptions = {
run: { command: effektExecutable.path, args },
debug: { command: effektExecutable.path, args }
run: { command: effektExecutable.path, args, options: execOptions },
debug: { command: effektExecutable.path, args, options: execOptions }
};
}

Expand Down

0 comments on commit 71ae96e

Please sign in to comment.