Skip to content
Open
Changes from all 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
38 changes: 33 additions & 5 deletions src/call.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CallHierarchyItem } from 'vscode'
import * as vscode from 'vscode'
import { CallHierarchyItem } from 'vscode'
import { output } from './extension'

export interface CallHierarchyNode {
Expand All @@ -21,10 +21,38 @@ async function getCallNode(
nodes.add(node)
const calls:
| vscode.CallHierarchyOutgoingCall[]
| vscode.CallHierarchyIncomingCall[] = await vscode.commands.executeCommand(
command,
node.item
)
| vscode.CallHierarchyIncomingCall[] =
await vscode.commands.executeCommand(command, node.item)

const funcBlock = '.func()'
if (calls.length === 0 && node.item.name.length > funcBlock.length) {
const subStr = node.item.name.substring(
node.item.name.length - funcBlock.length
)
if (subStr === funcBlock) {
let exes: any = await vscode.commands.executeCommand(
'vscode.executeDocumentSymbolProvider',
node.item.uri
)
for (const exe of exes) {
if (exe.range.contains(node.item.range)) {
let methods: vscode.CallHierarchyItem[] =
await vscode.commands.executeCommand(
'vscode.prepareCallHierarchy',
node.item.uri,
exe.selectionRange.start
)
if (methods.length > 0) {
const child = { item: methods[0], children: [] }
node.children.push(child)
await insertNode(child)
}
break
}
}
}
}

for (const call of calls) {
const next =
call instanceof vscode.CallHierarchyOutgoingCall
Expand Down