Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ import { DenoServerInfo } from "./server_info";
import * as dotenv from "dotenv";
import * as vscode from "vscode";
import { LanguageClient, ServerOptions } from "vscode-languageclient/node";
import type { Location, Position } from "vscode-languageclient/node";
import type {
Executable,
Location,
Position,
} from "vscode-languageclient/node";
import { getWorkspacesEnabledInfo, isPathEnabled } from "./enable";
import { denoUpgradePromptAndExecute } from "./upgrade";
import * as fs from "fs";
Expand Down Expand Up @@ -164,19 +168,21 @@ export function startLanguageServer(
env["NO_COLOR"] = "1";
env["DENO_V8_FLAGS"] = getV8Flags();

const shell = process.platform === "win32" &&
/\.([Cc][Mm][Dd]|[Bb][Aa][Tt])$/.test(command);
const serverOptions: ServerOptions = {
run: {
command,
args: ["lsp"],
options: { env },
},
options: { env, shell },
} as Executable,
debug: {
command,
// disabled for now, as this gets super chatty during development
// args: ["lsp", "-L", "debug"],
args: ["lsp"],
options: { env },
},
options: { env, shell },
} as Executable,
Comment on lines +178 to +185
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the casts necessary? as Executable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just for typed intellisense so I knew what data type was expected. Without the cast, the structs weren't typed appropriately.

If necessary, I can revert it or use narrowing and type extraction to extract the correct type from the ServerOptions union.

};
const client = new LanguageClient(
LANGUAGE_CLIENT_ID,
Expand Down