Skip to content

Commit 60e51c2

Browse files
ayame113aminya
andauthored
feat: add call-hierarchy.d.ts (#82)
Co-authored-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>
1 parent 3b7e672 commit 60e51c2

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

types-packages/call-hierarchy.d.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type * as Atom from "atom"
2+
import type { IdeUri } from "./uri"
3+
4+
export type CallHierarchyType = "incoming" | "outgoing"
5+
6+
export interface CallHierarchyProvider {
7+
name: string
8+
priority: number
9+
grammarScopes: ReadonlyArray<string>
10+
getIncomingCallHierarchy(editor: Atom.TextEditor, point: Atom.Point): Promise<CallHierarchy<"incoming"> | null>
11+
getOutgoingCallHierarchy(editor: Atom.TextEditor, point: Atom.Point): Promise<CallHierarchy<"outgoing"> | null>
12+
}
13+
14+
interface CallHierarchy<T extends CallHierarchyType> {
15+
type: T
16+
data: CallHierarchyItem[]
17+
/** Returns CallHierarchy data about the i-th CallHierarchyItem. */
18+
itemAt(i: number): Promise<CallHierarchy<T>>
19+
}
20+
21+
interface CallHierarchyItem {
22+
path: IdeUri
23+
name: string
24+
/** Same as the icon of outline.d.ts */
25+
icon?: string
26+
tags: SymbolTagKind[]
27+
detail?: string
28+
range: Atom.Range
29+
selectionRange: Atom.Range
30+
}
31+
32+
/**
33+
* Kind of symbol tag - matches the names from the Language Server Protocol. LSP specification:
34+
* https://microsoft.github.io/language-server-protocol/specifications/specification-current/#symbolTag
35+
*/
36+
export type SymbolTagKind = "deprecated" // currently no other type

types-packages/main.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
export * from "./uri"
77
export * from "./busy-signal"
8+
export * from "./call-hierarchy"
89
export * from "./code-actions"
910
export * from "./code-highlight"
1011
export * from "./datatip"
@@ -20,6 +21,7 @@ export * from "./refactor"
2021
export * from "./console"
2122

2223
import { BusySignalProvider } from "./busy-signal.d"
24+
import { CallHierarchyProvider } from "./call-hierarchy"
2325
import { CodeActionProvider } from "./code-actions"
2426
import { CodeHighlightProvider } from "./code-highlight"
2527
import { AnyDatatipProvider } from "./datatip"
@@ -39,6 +41,7 @@ export interface ProviderCommon {
3941
export type Provider =
4042
| ProviderCommon
4143
| BusySignalProvider
44+
| CallHierarchyProvider
4245
| CodeActionProvider
4346
| CodeHighlightProvider
4447
| AnyDatatipProvider

0 commit comments

Comments
 (0)