Skip to content

Commit 5b16bac

Browse files
Double click issue nodes to open the file
1 parent fd46a24 commit 5b16bac

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CodeEdit/Features/LSP/Service/LSPService+Events.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extension LSPService {
4545
// case let .error(error):
4646
// print("Error from EventStream for \(languageClient.languageId.rawValue): \(error)")
4747
default:
48+
// TODO: REMOVE THIS DEFAULT WHEN THE REST ARE IMPLEMENTED
4849
return
4950
}
5051
}
@@ -77,6 +78,7 @@ extension LSPService {
7778
// print("windowWorkDoneProgressCreate: \(params)")
7879
//
7980
// default:
81+
// // TODO: REMOVE THIS DEFAULT WHEN THE REST ARE IMPLEMENTED
8082
// print()
8183
// }
8284
}
@@ -92,7 +94,6 @@ extension LSPService {
9294
// case let .windowShowMessage(params):
9395
// print("windowShowMessage \(params.type)\n```\n\(params.message)\n```\n")
9496
case let .textDocumentPublishDiagnostics(params):
95-
print("textDocumentPublishDiagnostics: \(params.diagnostics)")
9697
languageClient.workspace.issueNavigatorViewModel?
9798
.updateDiagnostics(params: params)
9899
// case let .telemetryEvent(params):
@@ -104,6 +105,7 @@ extension LSPService {
104105
// case let .protocolLogTrace(params):
105106
// print("protocolLogTrace: \(params)")
106107
default:
108+
// TODO: REMOVE THIS DEFAULT WHEN THE REST ARE IMPLEMENTED
107109
return
108110
}
109111
}

CodeEdit/Features/NavigatorArea/IssueNavigator/OutlineView/IssueNavigatorViewController.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ final class IssueNavigatorViewController: NSViewController {
109109
toggleExpansion(of: projectNode)
110110
} else if let fileNode = item as? FileIssueNode {
111111
toggleExpansion(of: fileNode)
112+
openFileTab(fileUri: fileNode.uri)
113+
} else if let diagnosticNode = item as? DiagnosticIssueNode {
114+
openFileTab(fileUri: diagnosticNode.fileUri)
112115
}
113116
}
114117

@@ -121,4 +124,14 @@ final class IssueNavigatorViewController: NSViewController {
121124
outlineView.expandItem(item)
122125
}
123126
}
127+
128+
/// Opens a file as a permanent tab
129+
@inline(__always)
130+
private func openFileTab(fileUri: String) {
131+
guard let fileURL = URL(string: fileUri),
132+
let file = workspace?.workspaceFileManager?.getFile(fileURL.path) else {
133+
return
134+
}
135+
workspace?.editorManager?.activeEditor.openTab(file: file, asTemporary: false)
136+
}
124137
}

0 commit comments

Comments
 (0)