@@ -5,7 +5,7 @@ import SuggestionModel
55import XcodeInspector
66import ChatContextCollector
77
8- public struct ActiveDocumentChatContextCollector : ChatContextCollector {
8+ public struct LegacyActiveDocumentChatContextCollector : ChatContextCollector {
99 public init ( ) { }
1010
1111 public func generateContext(
@@ -104,47 +104,4 @@ public struct ActiveDocumentChatContextCollector: ChatContextCollector {
104104 }
105105}
106106
107- extension ActiveDocumentChatContextCollector {
108- struct Information {
109- let editorContent : SourceEditor . Content ?
110- let selectedContent : String
111- let documentURL : URL
112- let projectURL : URL
113- let language : CodeLanguage
114- }
115-
116- func getEditorInformation( ) -> Information {
117- let editorContent = XcodeInspector . shared. focusedEditor? . content
118- let documentURL = XcodeInspector . shared. activeDocumentURL
119- let projectURL = XcodeInspector . shared. activeProjectURL
120- let language = languageIdentifierFromFileURL ( documentURL)
121-
122- if let editorContent, let range = editorContent. selections. first {
123- let startIndex = min (
124- max ( 0 , range. start. line) ,
125- editorContent. lines. endIndex - 1
126- )
127- let endIndex = min (
128- max ( startIndex, range. end. line) ,
129- editorContent. lines. endIndex - 1
130- )
131- let selectedContent = editorContent. lines [ startIndex... endIndex]
132- return . init(
133- editorContent: editorContent,
134- selectedContent: selectedContent. joined ( ) ,
135- documentURL: documentURL,
136- projectURL: projectURL,
137- language: language
138- )
139- }
140-
141- return . init(
142- editorContent: editorContent,
143- selectedContent: " " ,
144- documentURL: documentURL,
145- projectURL: projectURL,
146- language: language
147- )
148- }
149- }
150107
0 commit comments