forked from CodeEditApp/CodeEditSourceEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMockJumpToDefinitionDelegate.swift
More file actions
34 lines (31 loc) · 1.02 KB
/
MockJumpToDefinitionDelegate.swift
File metadata and controls
34 lines (31 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// MockJumpToDefinitionDelegate.swift
// CodeEditSourceEditorExample
//
// Created by Khan Winter on 7/24/25.
//
import AppKit
import CodeEditSourceEditor
final class MockJumpToDefinitionDelegate: JumpToDefinitionDelegate, ObservableObject {
func queryLinks(forRange range: NSRange, textView: TextViewController) async -> [JumpToDefinitionLink]? {
[
JumpToDefinitionLink(
url: nil,
targetRange: CursorPosition(line: 0, column: 10),
typeName: "Start of Document",
sourcePreview: "// Comment at start"
),
JumpToDefinitionLink(
url: URL(string: "https://codeedit.app/"),
targetRange: CursorPosition(line: 1024, column: 10),
typeName: "CodeEdit Website",
sourcePreview: "https://codeedit.app/"
)
]
}
func openLink(link: JumpToDefinitionLink) {
if let url = link.url {
NSWorkspace.shared.open(url)
}
}
}