Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ export class Environment {
}

get client(): LanguageClient | null {
if (!this._client) {
window.showWarningMessage("Semgrep Language Server not active");
}
return this._client;
}

Expand Down
11 changes: 7 additions & 4 deletions src/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
ExecutableOptions,
LanguageClient,
type LanguageClientOptions,
MessageType,

Check warning on line 11 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'MessageType' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 11 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'MessageType' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 11 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'MessageType' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 11 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'MessageType' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 11 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'MessageType' is defined but never used. Allowed unused vars must match /^_/u
type NotificationHandler,

Check warning on line 12 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'NotificationHandler' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 12 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'NotificationHandler' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 12 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'NotificationHandler' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 12 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'NotificationHandler' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 12 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'NotificationHandler' is defined but never used. Allowed unused vars must match /^_/u
NotificationHandler0,
type ServerOptions,
ShowMessageNotification,

Check warning on line 15 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'ShowMessageNotification' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 15 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'ShowMessageNotification' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 15 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'ShowMessageNotification' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 15 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'ShowMessageNotification' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 15 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'ShowMessageNotification' is defined but never used. Allowed unused vars must match /^_/u
ShowMessageParams,

Check warning on line 16 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'ShowMessageParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 16 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'ShowMessageParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 16 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'ShowMessageParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 16 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'ShowMessageParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 16 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'ShowMessageParams' is defined but never used. Allowed unused vars must match /^_/u
TransportKind,

Check warning on line 17 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'TransportKind' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 17 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'TransportKind' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 17 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'TransportKind' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 17 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'TransportKind' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 17 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'TransportKind' is defined but never used. Allowed unused vars must match /^_/u
} from "vscode-languageclient/node";
import which from "which";
import {
Expand All @@ -25,7 +25,7 @@
VERSION_PATH,
} from "./constants";
import type { Environment } from "./env";
import { type LspErrorParams, rulesRefreshed } from "./lspExtensions";

Check warning on line 28 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'LspErrorParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 28 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'LspErrorParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 28 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'LspErrorParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 28 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'LspErrorParams' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 28 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'LspErrorParams' is defined but never used. Allowed unused vars must match /^_/u
import { setupLanguageClientTracing, topLevelSpan } from "./utilities/tracing";

const execShell = (cmd: string, args: string[]) =>
Expand Down Expand Up @@ -76,7 +76,7 @@
if (!env.config.cfg.get("ignoreCliVersion") && serverPath) {
// 'osemgrep --version' fails; not sure how intentional that is.
const version = await execShell(serverPath, ["show", "version"]);
const semVersion = new semver.SemVer(version);

Check warning on line 79 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'semVersion' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 79 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

'semVersion' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 79 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'semVersion' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 79 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

'semVersion' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 79 in src/lsp.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'semVersion' is assigned a value but never used. Allowed unused vars must match /^_/u
env.semgrepVersion = version;
await env.reloadConfig();
}
Expand Down Expand Up @@ -220,6 +220,12 @@
// TODO: Remove when semgrep is no longer experimental on Windows.
if (process.platform === "win32") process.env.SEMGREP_FORCE_INSTALL = "1";

if (env.client) {
env.logger.log("Language client already running, stopping it...");
await env.client.stop();
env.client = null;
}

// Compute LSP server and client options
const [serverOptions, clientOptions] = await lspOptions(env);

Expand Down Expand Up @@ -266,10 +272,7 @@
if (!client) {
return;
}
await client.sendRequest("shutdown");
env?.logger.log("Exiting");
await client.sendNotification("exit");
client.stop();
await client.stop();
env?.logger.log("Language client stopped...");
}

Expand Down
Loading