Skip to content

Commit e2a0c49

Browse files
committed
Merge branch 'python-in-extension' into release-0.0.5
2 parents b283057 + dab12cd commit e2a0c49

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/vscode/extension.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Graphviz } from "@hpcc-js/wasm-graphviz";
66
import { graphToDot } from "../control-flow/render";
77
import { simplifyCFG, trimFor } from "../control-flow/graph-ops";
88
import { newCFGBuilder, type Language } from "../control-flow/cfg";
9+
import { mergeNodeAttrs } from "../control-flow/cfg-defs";
910

1011
let graphviz: Graphviz;
1112
interface SupportedLanguage {
@@ -24,11 +25,17 @@ const supportedLanguages: SupportedLanguage[] = [
2425
language: "Go" as Language,
2526
parserName: "tree-sitter-go.wasm",
2627
},
28+
{
29+
languageId: "python",
30+
language: "Python" as Language,
31+
parserName: "tree-sitter-python.wasm",
32+
},
2733
];
2834

2935
const functionNodeTypes: { [key: string]: string[] } = {
3036
go: ["function_declaration", "method_declaration", "func_literal"],
3137
c: ["function_definition"],
38+
python: ["function_definition"],
3239
};
3340

3441
const supportedLanguageIds = supportedLanguages.map((lang) => lang.languageId);
@@ -176,7 +183,7 @@ export async function activate(context: vscode.ExtensionContext) {
176183
.getConfiguration("functionGraphOverview")
177184
.get("simplify")
178185
) {
179-
cfg = simplifyCFG(cfg);
186+
cfg = simplifyCFG(cfg, mergeNodeAttrs);
180187
}
181188
const dot = graphToDot(cfg);
182189
const svg = graphviz.dot(dot);
@@ -189,7 +196,7 @@ export async function activate(context: vscode.ExtensionContext) {
189196
}
190197

191198
// This method is called when your extension is deactivated
192-
export function deactivate() {}
199+
export function deactivate() { }
193200

194201
//------------------------------------------------
195202

@@ -198,7 +205,7 @@ class OverviewViewProvider implements vscode.WebviewViewProvider {
198205

199206
private _view?: vscode.WebviewView;
200207

201-
constructor(private readonly _extensionUri: vscode.Uri) {}
208+
constructor(private readonly _extensionUri: vscode.Uri) { }
202209

203210
public setSVG(svg: string) {
204211
if (this._view) {

0 commit comments

Comments
 (0)