Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
bb5d1fd
Merge tag '0.33.4' into develop
intitni Jun 18, 2024
f90f0dc
Prevent re-parsing markdown on scroll
intitni Jun 19, 2024
2a44f1f
Merge branch 'feature/prevent-reevaluating-md-content' into develop
intitni Jun 19, 2024
6b58a40
Bump Copilot.vim to 1.37.0
intitni Jun 22, 2024
1779634
Merge branch 'feature/fix-github-copilot-signout' into develop
intitni Jun 22, 2024
d456d58
Update CopilotForXcodeKit
intitni Jun 22, 2024
e0b2687
Support presenting suggestion error when needed
intitni Jun 22, 2024
1c7bf5e
Merge branch 'feature/present-suggestion-service-errors' into develop
intitni Jun 22, 2024
404c64b
Expose the error
intitni Jun 28, 2024
9a52e0d
Bump version to 0.33.5
intitni Jun 28, 2024
ecd711f
Rename TMPDIR to RELEASEDIR to avoid conflict
intitni Jun 28, 2024
1926da3
Update appcast file location
intitni Jun 28, 2024
38de4bc
Remove unused content
intitni Jun 28, 2024
9fd0312
Add extension identifier to builtin extensions
intitni May 30, 2024
8f94fd6
Add naive implementation of GitHubCopilotChatService
intitni Jun 27, 2024
f7c0cc0
Move chat related models to ChatBasic
intitni Jun 28, 2024
6101a44
Bump CopilotForXcodeKit to 0.7.2
intitni Jun 30, 2024
d8c5797
Add ServerNotificationHandler to handle notifications
intitni Jun 30, 2024
5475981
Support injecting notification handler from everywhere
intitni Jun 30, 2024
ae0f411
Add new request types
intitni Jun 30, 2024
250c54b
Add GitHubCopilotChatService
intitni Jun 30, 2024
4fdb4e5
Hack ChatGPTService to support GitHub copilot chat
intitni Jun 30, 2024
b2bcfc7
Add settings for GitHub Copilot chat
intitni Jun 30, 2024
6c03a20
Fix that the request may timeout too soon
intitni Jun 30, 2024
a7335af
Fix unit tests
intitni Jun 30, 2024
a315321
Merge branch 'feature/github-copilot-chat-experiments' into develop
intitni Jun 30, 2024
74eec7a
Added Indexing Changes for Codeium
RoshanNagaram-eng Jun 24, 2024
1e0ed33
Update preference keys names
intitni Jun 30, 2024
920bba7
Format files
intitni Jun 30, 2024
19fe95f
Fix naming style
intitni Jun 30, 2024
9d5e250
Merge branch 'feature/merging-codeium-indexing' into develop
intitni Jun 30, 2024
f255576
Update
intitni Jun 30, 2024
c3c097f
Bump build number
intitni Jun 30, 2024
7187424
Merge tag '0.33.5.beta' into develop
intitni Jun 30, 2024
57480f0
Rename SuggestionModel to SuggestionBasic
intitni Jul 1, 2024
7fbe123
Merge branch 'feature/rename-suggestion-model' into develop
intitni Jul 1, 2024
096569f
Add missing non-stream implemetation
intitni Jul 2, 2024
a2edca4
Add utility chat model
intitni Jul 2, 2024
3e59129
Update
intitni Jul 2, 2024
2d62073
Try to inject system prompt
intitni Jul 2, 2024
982a44d
Add GitHub Copilot chat (poc) to scope preferred models
intitni Jul 2, 2024
2882c24
Disable GitHub Copilot chat model for every place that requires a uti…
intitni Jul 2, 2024
a17e7f5
Bump build number
intitni Jul 2, 2024
348dc9a
Update appcast.xml
intitni Jul 2, 2024
1629510
Update LICENSE
intitni Jun 30, 2024
d80d931
Move KeybindingManager to Core
intitni Jul 2, 2024
c5f8f10
Move theme syncronization to Core
intitni Jul 2, 2024
f9d4913
Minor changes to make it build
intitni Jul 3, 2024
d6fcbe5
Update README.md
intitni Jul 3, 2024
1e57d8d
Remove debug logs
intitni Jul 3, 2024
ff96656
Merge branch 'feature/what-happened' into develop
intitni Jul 3, 2024
ade3d61
Merge branch 'main' into develop
intitni Jul 3, 2024
fe6b09f
Merge branch 'develop'
intitni Jul 3, 2024
6a60726
Update DEVELOPMENT.md
intitni Jul 3, 2024
72c41a1
Update README.md
intitni Jul 3, 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
Remove debug logs
  • Loading branch information
intitni committed Jul 3, 2024
commit 1e57d8dc1de287980d864fc0af07060ea5dcf9b0
23 changes: 1 addition & 22 deletions Core/Sources/KeyBindingManager/TabToAcceptSuggestion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class TabToAcceptSuggestion {
struct ObservationKey: Hashable {}

var canTapToAcceptSuggestion: Bool {
UserDefaults.shared.value(for: \.acceptSuggestionWithTab)
UserDefaults.shared.value(for: \.acceptSuggestionWithTab)
}

var canEscToDismissSuggestion: Bool {
Expand All @@ -39,7 +39,6 @@ final class TabToAcceptSuggestion {

@MainActor
func stopForExit() {
Logger.debug.info("TabToAcceptSuggestion: stopForExit")
stoppedForExit = true
stopObservation()
}
Expand All @@ -66,12 +65,10 @@ final class TabToAcceptSuggestion {
}

func start() {
Logger.debug.info("TabToAcceptSuggestion: start")
Task { [weak self] in
for await _ in ActiveApplicationMonitor.shared.createInfoStream() {
guard let self else { return }
try Task.checkCancellation()
Logger.debug.info("TabToAcceptSuggestion: Active app changed")
Task { @MainActor in
if ActiveApplicationMonitor.shared.activeXcode != nil {
self.startObservation()
Expand All @@ -85,7 +82,6 @@ final class TabToAcceptSuggestion {
userDefaultsObserver.onChange = { [weak self] in
guard let self else { return }
Task { @MainActor in
Logger.debug.info("TabToAcceptSuggestion: Settings changed")
if self.canTapToAcceptSuggestion || self.canEscToDismissSuggestion {
self.startObservation()
} else {
Expand All @@ -97,33 +93,25 @@ final class TabToAcceptSuggestion {

@MainActor
func startObservation() {
Logger.debug.info("TabToAcceptSuggestion: startObservation")
guard !stoppedForExit else { return }
guard canTapToAcceptSuggestion || canEscToDismissSuggestion else { return }
hook.activateIfPossible()
}

@MainActor
func stopObservation() {
Logger.debug.info("TabToAcceptSuggestion: stopObservation")
hook.deactivate()
}

func handleEvent(_ event: CGEvent) -> CGEventManipulation.Result {
Logger.debug.info("TabToAcceptSuggestion: handleEvent")
let keycode = Int(event.getIntegerValueField(.keyboardEventKeycode))
let tab = 48
let esc = 53

switch keycode {
case tab:
Logger.debug.info(
"TabToAcceptSuggestion: Tab detected, flags: \(event.flags), permission: \(canTapToAcceptSuggestion)"
)

guard let fileURL = ThreadSafeAccessToXcodeInspector.shared.activeDocumentURL
else {
Logger.debug.info("TabToAcceptSuggestion: Active file not found")
return .unchanged
}

Expand Down Expand Up @@ -175,28 +163,23 @@ final class TabToAcceptSuggestion {
checkKeybinding(),
canTapToAcceptSuggestion
else {
Logger.debug.info("TabToAcceptSuggestion: Tab is invalid")
return .unchanged
}

guard ThreadSafeAccessToXcodeInspector.shared.activeXcode != nil
else {
Logger.debug.info("TabToAcceptSuggestion: Xcode not found")
return .unchanged
}
guard let editor = ThreadSafeAccessToXcodeInspector.shared.focusedEditor
else {
Logger.debug.info("TabToAcceptSuggestion: Editor not found")
return .unchanged
}
guard let filespace = workspacePool.fetchFilespaceIfExisted(fileURL: fileURL)
else {
Logger.debug.info("TabToAcceptSuggestion: Filespace not found: \(fileURL)")
return .unchanged
}
guard let presentingSuggestion = filespace.presentingSuggestion
else {
Logger.debug.info("TabToAcceptSuggestion: Suggestion not found")
return .unchanged
}

Expand All @@ -210,11 +193,9 @@ final class TabToAcceptSuggestion {
)

if shouldAcceptSuggestion {
Logger.debug.info("TabToAcceptSuggestion: Perform accept suggestion")
acceptSuggestion()
return .discarded
} else {
Logger.debug.info("TabToAcceptSuggestion: Do not accept the suggestion")
return .unchanged
}
case esc:
Expand Down Expand Up @@ -251,7 +232,6 @@ extension TabToAcceptSuggestion {
) -> Bool {
let line = cursorPosition.line
guard line >= 0, line < lines.endIndex else {
Logger.debug.info("TabToAcceptSuggestion: Suggestion position invalid")
return true
}
let col = cursorPosition.character
Expand All @@ -273,7 +253,6 @@ extension TabToAcceptSuggestion {
// If entering a tab doesn't invalidate the suggestion, just let the user type the tab.
// else, accept the suggestion and discard the tab.
guard !presentingSuggestionText.hasPrefix(contentAfterTab) else {
Logger.debug.info("TabToAcceptSuggestion: A tab doesn't invalidate the suggestion")
return false
}
return true
Expand Down