Skip to content

Commit 298264c

Browse files
author
Chouzz
authored
Rename call hierarchy to code graph (#15)
1 parent 052a739 commit 298264c

File tree

5 files changed

+63
-19
lines changed

5 files changed

+63
-19
lines changed

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
],
3030
"activationEvents": [
3131
"onStartupFinished",
32-
"onView:codeGraph.callHierarch.view"
32+
"onView:codeGraph.view"
3333
],
3434
"main": "./dist/extension.js",
3535
"contributes": {
@@ -40,11 +40,11 @@
4040
}
4141
],
4242
"views": {
43-
"callHierarchyPanel": [
43+
"codeGraphPanel": [
4444
{
4545
"type": "webview",
46-
"id": "codeGraph.callHierarch.view",
47-
"name": "Call Hierarchy",
46+
"id": "codeGraph.view",
47+
"name": "Code Graph",
4848
"icon": "$(references)",
4949
"visibility": "hidden"
5050
}
@@ -53,8 +53,8 @@
5353
"viewsContainers": {
5454
"panel": [
5555
{
56-
"id": "callHierarchyPanel",
57-
"title": "Call Hierarchy",
56+
"id": "codeGraphPanel",
57+
"title": "Code Graph",
5858
"icon": "$(references)"
5959
}
6060
]

src/extension.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
import * as vscode from 'vscode';
3-
import * as callHierarchyPanel from './webview/callHierarchyWebview';
3+
import * as CodeGraphWebview from './webview/codeGraphWebview';
44

55
export let extensionContext: vscode.ExtensionContext;
66

77
export function activate(context: vscode.ExtensionContext) {
88
extensionContext = context;
9-
callHierarchyPanel.activate(context);
9+
CodeGraphWebview.activate(context);
1010
}
1111

1212
export function deactivate() {}

src/webview/callHierarchyWebview.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
import * as vscode from 'vscode';
22
import {
3-
callHierarchyGotoItemsCommandType,
4-
callHierarchyInitItemsCommandType,
5-
callHierarchyOnHoverCommandType,
3+
gotoItemsCommandType,
4+
initItemsCommandType,
5+
onHoverCommandType,
66
IpcMessage,
77
State,
88
} from './protocol';
99

1010
import { WebviewViewBase } from './webviewBase';
1111

12-
export class CallHierarchyWebview extends WebviewViewBase<State> {
12+
export class CodeGraphWebview extends WebviewViewBase<State> {
1313
constructor() {
1414
super('codeGraph.callHierarch.view', 'index.html', 'Call Hierarchy');
1515
}
1616

1717
protected onMessageReceived(e: IpcMessage): void {
1818
switch (e.method) {
19-
case callHierarchyGotoItemsCommandType.method:
19+
case gotoItemsCommandType.method:
2020
this.onGotoItem(e.params);
2121
break;
22-
case callHierarchyInitItemsCommandType.method:
22+
case initItemsCommandType.method:
2323
this.onInitItem(e.params);
2424
break;
2525

26-
case callHierarchyOnHoverCommandType.method:
26+
case onHoverCommandType.method:
2727
this.onHoverItem(e.params);
2828
break;
2929
default:
@@ -39,6 +39,6 @@ export class CallHierarchyWebview extends WebviewViewBase<State> {
3939
}
4040

4141
export function activate(context: vscode.ExtensionContext){
42-
const webview = new CallHierarchyWebview();
42+
const webview = new CodeGraphWebview();
4343
context.subscriptions.push(webview);
4444
}

src/webview/codeGraphWebview.ts

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import * as vscode from 'vscode';
2+
import {
3+
gotoItemsCommandType,
4+
initItemsCommandType,
5+
onHoverCommandType,
6+
IpcMessage,
7+
State,
8+
} from './protocol';
9+
10+
import { WebviewViewBase } from './webviewBase';
11+
12+
export class CodeGraphWebview extends WebviewViewBase<State> {
13+
constructor() {
14+
super('codeGraph.view', 'index.html', 'Code Graph');
15+
}
16+
17+
protected onMessageReceived(e: IpcMessage): void {
18+
switch (e.method) {
19+
case gotoItemsCommandType.method:
20+
this.onGotoItem(e.params);
21+
break;
22+
case initItemsCommandType.method:
23+
this.onInitItem(e.params);
24+
break;
25+
26+
case onHoverCommandType.method:
27+
this.onHoverItem(e.params);
28+
break;
29+
default:
30+
break;
31+
}
32+
}
33+
34+
private onGotoItem(params: any) {}
35+
36+
private onInitItem(params: any) {}
37+
38+
private onHoverItem(params: any) {}
39+
}
40+
41+
export function activate(context: vscode.ExtensionContext){
42+
const webview = new CodeGraphWebview();
43+
context.subscriptions.push(webview);
44+
}

src/webview/protocol.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export interface State {
3838
// COMMANDS
3939

4040
export const webviewReadyCommandType = new IpcCommandType('webview/ready');
41-
export const callHierarchyInitItemsCommandType = new IpcCommandType('callHierarchy/initItems');
42-
export const callHierarchyGotoItemsCommandType = new IpcCommandType('callHierarchy/gotoItem');
43-
export const callHierarchyOnHoverCommandType = new IpcCommandType('callHierarchy/onHover');
41+
export const initItemsCommandType = new IpcCommandType('codeGraph/initItems');
42+
export const gotoItemsCommandType = new IpcCommandType('codeGraph/gotoItem');
43+
export const onHoverCommandType = new IpcCommandType('codeGraph/onHover');
4444

4545
export interface WebviewFocusChangedParams {
4646
focused: boolean;

0 commit comments

Comments
 (0)