Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
233516d
Bump GitHub Copilot language server to 1.48.0
intitni May 8, 2025
415088e
Add model settings for GitHub Copilot but looks like it's not yet imp…
intitni May 8, 2025
519cce1
Stop handling multiple selections in modification
intitni May 8, 2025
87cae85
Support disabling chat panel always on top
intitni May 8, 2025
2bb0a70
Do not hide modification panel, instead change the level
intitni May 8, 2025
a8d2710
Adjust chat panel level behavior
intitni May 8, 2025
380cffc
Fix open chat
intitni May 8, 2025
38fcd66
Hide chat panel by default
intitni May 8, 2025
3bb2629
Support destroying workspacePool from menu
intitni May 8, 2025
9340275
Fix command injection
intitni May 8, 2025
2822025
Revert chat window behavior
intitni May 8, 2025
e8df300
Bump version
intitni May 8, 2025
2398a9c
Update modification panel to show all modifications
intitni May 8, 2025
cc6ed15
Jump to new modification when started
intitni May 8, 2025
297076d
Move to the target file before accepting a modification
intitni May 8, 2025
a08e1bc
Tweak modification panel behavior
intitni May 9, 2025
3b78254
Update model list
intitni May 9, 2025
6acaf19
Cherry pick accept first line of suggestion
intitni May 9, 2025
2c394e3
Fix modification panel not dismissing after accept
intitni May 9, 2025
f13b82d
Drop GitHub Copilot language server to 1.44.0
intitni May 9, 2025
bd03440
Update
intitni May 9, 2025
f7863d9
Bump Codeium language server
intitni May 9, 2025
a00642a
Bump GitHub Copilot language server
intitni May 9, 2025
8b12291
Update
intitni May 9, 2025
3905f1a
Adjust always on top behavior
intitni May 9, 2025
58727f6
Update default settings
intitni May 9, 2025
82307fe
Fix window level
intitni May 9, 2025
ca0bd7a
Merge branch 'hotfix/0.35.8'
intitni May 9, 2025
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
Tweak modification panel behavior
  • Loading branch information
intitni committed May 9, 2025
commit a08e1bcc64ba08d43cd9bbe23dddd5913ece4e08
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public struct PromptToCodeGroup {
switch action {
case let .activateOrCreatePromptToCode(s):
if let promptToCode = state.activePromptToCode, s.id == promptToCode.id {
state.selectedTabId = promptToCode.id
return .run { send in
await send(.promptToCode(.element(
id: promptToCode.id,
Expand All @@ -61,10 +62,11 @@ public struct PromptToCodeGroup {
await send(.createPromptToCode(s, sendImmediately: false))
}
case let .createPromptToCode(newPromptToCode, sendImmediately):
// insert at 0 so it has high priority then the other detached prompt to codes
var newPromptToCode = newPromptToCode
newPromptToCode.isActiveDocument = newPromptToCode.id == state.activeDocumentURL
state.promptToCodes.append(newPromptToCode)
state.selectedTabId = newPromptToCode.id
return .run { send in
return .run { [newPromptToCode] send in
if sendImmediately,
!newPromptToCode.contextInputController.instruction.string.isEmpty
{
Expand All @@ -91,6 +93,10 @@ public struct PromptToCodeGroup {

case let .updateActivePromptToCode(documentURL):
state.activeDocumentURL = documentURL
for index in state.promptToCodes.indices {
state.promptToCodes[index].isActiveDocument =
state.promptToCodes[index].id == documentURL
}
return .none

case let .discardExpiredPromptToCode(documentURLs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public struct PromptToCodePanel {
public var generateDescriptionRequirement: Bool

public var hasEnded = false

public var isActiveDocument: Bool = false

public var snippetPanels: IdentifiedArrayOf<PromptToCodeSnippetPanel.State> {
get {
Expand Down Expand Up @@ -85,6 +87,7 @@ public struct PromptToCodePanel {
case cancelButtonTapped
case acceptButtonTapped
case acceptAndContinueButtonTapped
case revealFileButtonClicked
case statusUpdated([String])
case snippetPanel(IdentifiedActionOf<PromptToCodeSnippetPanel>)
}
Expand Down Expand Up @@ -248,13 +251,7 @@ public struct PromptToCodePanel {

case .acceptButtonTapped:
state.hasEnded = true
let url = state.promptToCodeState.source.documentURL
let startLine = state.snippetPanels.first?.snippet.attachedRange.start.line ?? 0
return .run { _ in
let activeDocumentURL = await XcodeInspector.shared.safe.activeDocumentURL
if activeDocumentURL != url {
await commandHandler.presentFile(at: url, line: startLine)
}
await commandHandler.acceptModification()
activatePreviousActiveXcode()
}
Expand All @@ -265,6 +262,13 @@ public struct PromptToCodePanel {
activateThisApp()
}

case .revealFileButtonClicked:
let url = state.promptToCodeState.source.documentURL
let startLine = state.snippetPanels.first?.snippet.attachedRange.start.line ?? 0
return .run { _ in
await commandHandler.presentFile(at: url, line: startLine)
}

case let .statusUpdated(status):
state.promptToCodeState.status = status
return .none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ struct PromptToCodeTabBarButton: View {
.controlSize(.small)
}
Text(info.tabTitle)
.truncationMode(.middle)
.allowsTightening(true)
}
.font(.callout)
.lineLimit(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,12 @@ extension PromptToCodePanelView {
.buttonStyle(CommandButtonStyle(color: .gray))
.keyboardShortcut("w", modifiers: [.command])

if !isCodeEmpty {
AcceptButton(store: store)
if store.isActiveDocument {
if !isCodeEmpty {
AcceptButton(store: store)
}
} else {
RevealButton(store: store)
}
}
.fixedSize()
Expand Down Expand Up @@ -357,6 +361,22 @@ extension PromptToCodePanelView {
}
}
}

struct RevealButton: View {
let store: StoreOf<PromptToCodePanel>

var body: some View {
WithPerceptionTracking {
Button(action: {
store.send(.revealFileButtonClicked)
}) {
Text("Jump to File(⌘ + ⏎)")
}
.buttonStyle(CommandButtonStyle(color: .accentColor))
.keyboardShortcut(KeyEquivalent.return, modifiers: [.command])
}
}
}

struct AcceptButton: View {
let store: StoreOf<PromptToCodePanel>
Expand Down
60 changes: 31 additions & 29 deletions Core/Sources/SuggestionWidget/WidgetWindowsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ actor WidgetWindowsController: NSObject {
}
}
}

Task { @MainActor in
windows.chatPanelWindow.isPanelDisplayed = false
}
Expand Down Expand Up @@ -132,36 +132,38 @@ private extension WidgetWindowsController {
observeToAppTask = Task {
await windows.orderFront()

for await notification in await notifications.notifications() {
try Task.checkCancellation()

/// Hide the widgets before switching to another window/editor
/// so the transition looks better.
func hideWidgetForTransitions() async {
let newDocumentURL = await xcodeInspector.safe.realtimeActiveDocumentURL
let documentURL = await MainActor
.run { store.withState { $0.focusingDocumentURL } }
if documentURL != newDocumentURL {
await send(.panel(.removeDisplayedContent))
await hidePanelWindows()
}
await send(.updateFocusingDocumentURL)
}

func removeContent() async {
/// Hide the widgets before switching to another window/editor
/// so the transition looks better.
func hideWidgetForTransitions() async {
let newDocumentURL = await xcodeInspector.safe.realtimeActiveDocumentURL
let documentURL = await MainActor
.run { store.withState { $0.focusingDocumentURL } }
if documentURL != newDocumentURL {
await send(.panel(.removeDisplayedContent))
await hidePanelWindows()
}
await send(.updateFocusingDocumentURL)
}

func updateWidgetsAndNotifyChangeOfEditor(immediately: Bool) async {
await send(.panel(.switchToAnotherEditorAndUpdateContent))
updateWindowLocation(animated: false, immediately: immediately)
updateWindowOpacity(immediately: immediately)
}
func removeContent() async {
await send(.panel(.removeDisplayedContent))
}

func updateWidgets(immediately: Bool) async {
updateWindowLocation(animated: false, immediately: immediately)
updateWindowOpacity(immediately: immediately)
}
func updateWidgetsAndNotifyChangeOfEditor(immediately: Bool) async {
await send(.panel(.switchToAnotherEditorAndUpdateContent))
updateWindowLocation(animated: false, immediately: immediately)
updateWindowOpacity(immediately: immediately)
}

func updateWidgets(immediately: Bool) async {
updateWindowLocation(animated: false, immediately: immediately)
updateWindowOpacity(immediately: immediately)
}

await updateWidgetsAndNotifyChangeOfEditor(immediately: true)

for await notification in await notifications.notifications() {
try Task.checkCancellation()

switch notification.kind {
case .focusedWindowChanged:
Expand Down Expand Up @@ -257,7 +259,7 @@ private extension WidgetWindowsController {
extension WidgetWindowsController {
@MainActor
func hidePanelWindows() {
windows.sharedPanelWindow.alphaValue = 0
// windows.sharedPanelWindow.alphaValue = 0
windows.suggestionPanelWindow.alphaValue = 0
}

Expand Down Expand Up @@ -903,7 +905,7 @@ class WidgetWindow: CanBecomeKeyWindow {
: .normal

if targetLevel != level {
self.orderFrontRegardless()
orderFrontRegardless()
level = targetLevel
}
}
Expand Down