Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
01a6f16
Merge tag '0.30.3' into develop
intitni Feb 7, 2024
c3d4dff
Update issue templates
intitni Feb 7, 2024
73cf3ab
Add WindowsController
intitni Feb 13, 2024
78ce489
Make WidgetLocation Equatable
intitni Feb 13, 2024
3c9dfc4
Move windows to WindowsController
intitni Feb 13, 2024
163f8d5
Update the dependency to hold a WindowsController instead
intitni Feb 13, 2024
eabb647
Remove useless actions
intitni Feb 13, 2024
f3275a1
Update windows getter
intitni Feb 13, 2024
e280dbd
Merge branch 'feature/improve-performance-of-widgets' into develop
intitni Feb 14, 2024
098e7e3
Make focusedEditorContent a function marked as expensive
intitni Feb 14, 2024
342ab60
Rename WindowsController to WidgetWindowsController
intitni Feb 14, 2024
6d65d57
Fix that a task is not stored
intitni Feb 14, 2024
a78ed53
Add throttler to RealtimeSuggestionController
intitni Feb 14, 2024
20bdfbd
Throttle location generation
intitni Feb 14, 2024
9a7ce06
Bump version to 0.30.4
intitni Feb 14, 2024
578802a
Merge tag '0.30.4.beta.1' into develop
intitni Feb 14, 2024
250bdf9
Remove scroll event throttle
intitni Feb 15, 2024
10f2a93
Add DebounceFunction and ThrottleFunction
intitni Feb 15, 2024
12ff573
Remove some use of MainActor
intitni Feb 15, 2024
3a1f4c3
Update circular widget implementation
intitni Feb 15, 2024
d480527
Update
intitni Feb 15, 2024
02ab5ca
Update signpost API
intitni Feb 15, 2024
72a8565
Fix dependecy
intitni Feb 15, 2024
7c5c105
Bump build number
intitni Feb 15, 2024
d1d118e
Tweak widget behavior
intitni Feb 15, 2024
060e08c
Make WidgetWindowsController an actor
intitni Feb 15, 2024
df7ad31
Bring back some main actors
intitni Feb 15, 2024
cbe4ec7
Merge tag '0.30.4.beta.2' into develop
intitni Feb 15, 2024
1973c99
Adjust widget transition when switching apps
intitni Feb 16, 2024
919c7ad
Bump version
intitni Feb 17, 2024
653459c
Update appcast.xml
intitni Feb 17, 2024
0cc2e7a
Merge branch 'release/0.30.4'
intitni Feb 17, 2024
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
Prev Previous commit
Next Next commit
Make focusedEditorContent a function marked as expensive
  • Loading branch information
intitni committed Feb 14, 2024
commit 098e7e322a84f2ed78945898ac07dee64b82cb4d
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class OpenAIPromptToCodeService: PromptToCodeServiceType {
return userPreferredLanguage.isEmpty ? "" : " in \(userPreferredLanguage)"
}()

let editor: EditorInformation = XcodeInspector.shared.focusedEditorContent ?? .init(
let editor: EditorInformation = XcodeInspector.shared.getFocusedEditorContent() ?? .init(
editorContent: .init(
content: source.content,
lines: source.lines,
Expand Down
2 changes: 1 addition & 1 deletion Pro
Submodule Pro updated from 405989 to 8c9ccf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import SuggestionModel
import XcodeInspector

func getEditorInformation() -> EditorInformation? {
return XcodeInspector.shared.focusedEditorContent
return XcodeInspector.shared.getFocusedEditorContent()
}

3 changes: 2 additions & 1 deletion Tool/Sources/XcodeInspector/SourceEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class SourceEditor {

/// Get the content of the source editor.
///
/// - note: This method is expensive.
/// - note: This method is expensive. It needs to convert index based ranges to line based
/// ranges.
public func getContent() -> Content {
let content = element.value
let selectionRange = element.selectedTextRange
Expand Down
7 changes: 5 additions & 2 deletions Tool/Sources/XcodeInspector/XcodeInspector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ public final class XcodeInspector: ObservableObject {
@Published public fileprivate(set) var focusedElement: AXUIElement?
@Published public fileprivate(set) var completionPanel: AXUIElement?

#warning("TODO: make it a function and mark it as expensive")
public var focusedEditorContent: EditorInformation? {
/// Get the content of the source editor.
///
/// - note: This method is expensive. It needs to convert index based ranges to line based
/// ranges.
public func getFocusedEditorContent() -> EditorInformation? {
guard let documentURL = XcodeInspector.shared.realtimeActiveDocumentURL,
let workspaceURL = XcodeInspector.shared.realtimeActiveWorkspaceURL,
let projectURL = XcodeInspector.shared.activeProjectRootURL
Expand Down