From 9dfb9574821229d158454126a5b3c6ddcf90db37 Mon Sep 17 00:00:00 2001 From: Jane Lewis Date: Mon, 10 Jun 2024 14:01:28 -0700 Subject: [PATCH 1/2] Introduce debug command --- package.json | 5 +++++ src/extension.ts | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/package.json b/package.json index 8e9a72e..22f1776 100644 --- a/package.json +++ b/package.json @@ -365,6 +365,11 @@ "category": "Ruff", "command": "ruff.executeOrganizeImports" }, + { + "title": "Print debug information", + "category": "Ruff", + "command": "ruff.printDebugInformation" + }, { "title": "Restart Server", "category": "Ruff", diff --git a/src/extension.ts b/src/extension.ts index 598a7e6..c98f09c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -240,6 +240,19 @@ export async function activate(context: vscode.ExtensionContext): Promise ); }); }), + registerCommand(`${serverId}.printDebugInformation`, async () => { + if (!lsClient) { + return; + } + + const params = { + command: `${serverId}.printDebugInformation`, + }; + + await lsClient.sendRequest(ExecuteCommandRequest.type, params).then(undefined, async () => { + await vscode.window.showErrorMessage("Failed to print debug information."); + }); + }), registerLanguageStatusItem(serverId, serverName, `${serverId}.showLogs`), ); From 52fec4f25c9f674f2851ba48c156915b5ca1bf6b Mon Sep 17 00:00:00 2001 From: Jane Lewis Date: Thu, 13 Jun 2024 12:28:37 -0700 Subject: [PATCH 2/2] Don't ask for debug information from ruff-lsp --- package.json | 4 ++-- src/extension.ts | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 22f1776..3b12ac9 100644 --- a/package.json +++ b/package.json @@ -366,9 +366,9 @@ "command": "ruff.executeOrganizeImports" }, { - "title": "Print debug information", + "title": "Print debug information (native server only)", "category": "Ruff", - "command": "ruff.printDebugInformation" + "command": "ruff.debugInformation" }, { "title": "Restart Server", diff --git a/src/extension.ts b/src/extension.ts index c98f09c..e8bcdc2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -191,6 +191,8 @@ export async function activate(context: vscode.ExtensionContext): Promise }); }), registerCommand(`${serverId}.executeFormat`, async () => { + // let configuration = getConfiguration(serverId) as ISettings; + if (!lsClient) { return; } @@ -240,8 +242,9 @@ export async function activate(context: vscode.ExtensionContext): Promise ); }); }), - registerCommand(`${serverId}.printDebugInformation`, async () => { - if (!lsClient) { + registerCommand(`${serverId}.debugInformation`, async () => { + let configuration = getConfiguration(serverId) as unknown as ISettings; + if (!lsClient || !configuration.nativeServer) { return; }