Skip to content

Commit

Permalink
Fix listeners calls to agent (#1440)
Browse files Browse the repository at this point in the history
## Changes 

When reading agent code I realised that change in cursor/selection
should in fact be passed by `didChange` and not `didFocus` event. This
was changed recently by me while trying to improve situation with agent
crashes (and when we though excessive amount of agent notifications
might be a partial reason) but I realised this change was simply
incorrect.


## Test plan

Manual check with debugger if proper endpoints are hit.
  • Loading branch information
pkukielka authored May 6, 2024
1 parent 5c40014 commit 9b5fd28
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CodyCaretListener(val project: Project) : CaretListener {

ProtocolTextDocument.fromEditor(e.editor)?.let { textDocument ->
CodyAgentService.withAgent(project) { agent: CodyAgent ->
agent.server.textDocumentDidFocus(textDocument)
agent.server.textDocumentDidChange(textDocument)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CodyFileEditorListener : FileEditorManagerListener {
source.selectedTextEditor?.let { editor ->
val protocolTextFile = fromVirtualFile(editor, file)
withAgent(source.project) { agent: CodyAgent ->
agent.server.textDocumentDidClose(protocolTextFile)
agent.server.textDocumentDidOpen(protocolTextFile)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CodySelectionListener(val project: Project) : SelectionListener {

ProtocolTextDocument.fromEditor(e.editor)?.let { textDocument ->
CodyAgentService.withAgent(project) { agent ->
agent.server.textDocumentDidFocus(textDocument)
agent.server.textDocumentDidChange(textDocument)
}
}

Expand Down

0 comments on commit 9b5fd28

Please sign in to comment.