Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## Removed

- Removed the "Show AST" comands from right-click

## 1.14.0 - 2025-08-22

## Fixed
Expand Down
21 changes: 0 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@
"command": "semgrep.refreshRules",
"title": "Semgrep: Update rules"
},
{
"command": "semgrep.showAst",
"title": "Semgrep: Show AST"
},
{
"command": "semgrep.showAstNamed",
"title": "Semgrep: Show named AST",
"when": "semgrep.cli.minor >= 36 || config.semgrep.ignoreCliVersion"
},
{
"command": "semgrep.search",
"title": "Semgrep: Search by pattern",
Expand Down Expand Up @@ -236,18 +227,6 @@
]
},
"menus": {
"editor/context": [
{
"command": "semgrep.showAst",
"when": "editorTextFocus",
"group": "navigation"
},
{
"command": "semgrep.showAstNamed",
"when": "editorTextFocus",
"group": "navigation"
}
],
"commandPalette": [
{
"command": "semgrep.login",
Expand Down
38 changes: 0 additions & 38 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
logout,
refreshRules,
scanWorkspace,
showAst,

Check warning on line 13 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 13 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 13 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 13 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 13 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'showAst' is defined but never used. Allowed unused vars must match /^_/u
} from "./lspExtensions";
import { handleSearch } from "./search";
import { encodeUri } from "./showAstDocument";

Check warning on line 16 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 16 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 16 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 16 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 16 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'encodeUri' is defined but never used. Allowed unused vars must match /^_/u
import { applyFixAndSave, isRealFileEditor, replaceAll } from "./utils";

Check warning on line 17 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 17 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 17 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 17 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 17 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'isRealFileEditor' is defined but never used. Allowed unused vars must match /^_/u
import type { ViewResults } from "./webviews/types/results";
import { setupMcp } from "./mcp";
import fs from "fs";
Expand All @@ -39,7 +39,7 @@

// We need to do this, or openTextDocument will open the same text document, if previously
// opened. This means that running showAst twice will always show the same thing.
async function replaceAndOpenUriContent(

Check warning on line 42 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 42 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (ubuntu-latest)

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

Check warning on line 42 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 42 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test (macos-latest)

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

Check warning on line 42 in src/commands.ts

View workflow job for this annotation

GitHub Actions / vsce-test-windows

'replaceAndOpenUriContent' is defined but never used. Allowed unused vars must match /^_/u
uri: vscode.Uri,
content: string,
active_editor: vscode.TextEditor,
Expand Down Expand Up @@ -178,44 +178,6 @@
return "Refreshed rules";
}),

/************/
/* SHOW AST */
/************/

vscode.commands.registerCommand("semgrep.showAstNamed", async () => {
if (
!isRealFileEditor(vscode.window.activeTextEditor) ||
!vscode.window.activeTextEditor
) {
return;
}
if (env.client) {
const ast_text = await env.client.sendRequest(showAst, {
named: true,
uri: vscode.window.activeTextEditor?.document.uri.fsPath,
});
const uri = encodeUri(vscode.window.activeTextEditor.document.uri);

replaceAndOpenUriContent(uri, ast_text, vscode.window.activeTextEditor);
}
}),
vscode.commands.registerCommand("semgrep.showAst", async () => {
if (
!isRealFileEditor(vscode.window.activeTextEditor) ||
!vscode.window.activeTextEditor
) {
return;
}
if (env.client) {
const ast_text = await env.client.sendRequest(showAst, {
named: false,
uri: vscode.window.activeTextEditor?.document.uri.fsPath,
});
const uri = encodeUri(vscode.window.activeTextEditor.document.uri);
replaceAndOpenUriContent(uri, ast_text, vscode.window.activeTextEditor);
}
}),

/**********/
/* SEARCH */
/**********/
Expand Down
Loading