Skip to content

Commit

Permalink
Introduce ruff.printDebugInformation command (#495)
Browse files Browse the repository at this point in the history
## Summary

Introduces a command to print debug information. It should look like
this in the Output window:

<img width="632" alt="Screenshot 2024-06-10 at 12 21 07 PM"
src="https://github.com/astral-sh/ruff-vscode/assets/19577865/671c38a0-00f6-4fd1-a4e6-824cc788b54f">

## Test Plan

See astral-sh/ruff#11831 for testing
information.
  • Loading branch information
snowsignal authored Jun 13, 2024
1 parent 3d6100f commit c522868
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,11 @@
"category": "Ruff",
"command": "ruff.executeOrganizeImports"
},
{
"title": "Print debug information (native server only)",
"category": "Ruff",
"command": "ruff.debugInformation"
},
{
"title": "Restart Server",
"category": "Ruff",
Expand Down
16 changes: 16 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
});
}),
registerCommand(`${serverId}.executeFormat`, async () => {
// let configuration = getConfiguration(serverId) as ISettings;

if (!lsClient) {
return;
}
Expand Down Expand Up @@ -240,6 +242,20 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
);
});
}),
registerCommand(`${serverId}.debugInformation`, async () => {
let configuration = getConfiguration(serverId) as unknown as ISettings;
if (!lsClient || !configuration.nativeServer) {
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`),
);

Expand Down

0 comments on commit c522868

Please sign in to comment.