Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve editor when getting doc context #1793

Merged
merged 5 commits into from
Nov 17, 2023
Merged

Conversation

abeatrix
Copy link
Contributor

image

Fixes an error that occurred when attempting to get the current VS Code document context. The previous methods for retrieving the active editor, document, and document text do not work with the new chat panel because when an user focuses on the webview panel we run the vscode.window.activeTextEditor, it would always returns undefined, cause Cody unable to fetch local context.

This replaces the previous logic with new utility functions getActiveEditorFromVisibleEditors, getCurrentVSCodeDoc, and getCurrentVSCodeDocText that more robustly retrieve the current document context that is not the focused webview chat panel.

Test plan

  • Select some code in your editor
  • In the new chat panel UI, type /test to run the test command
  • Before the fix, Cody will tell you it doesn't have any context and cant identify the testing framework

AFTER

Screen.Recording.2023-11-17.at.7.53.15.AM.mov

BEFORE

Screen.Recording.2023-11-17.at.7.54.19.AM.mov

@abeatrix abeatrix requested review from umpox and a team November 17, 2023 16:00
@abeatrix
Copy link
Contributor Author

@umpox can i get a quick review from you, please 🙇‍♀️

@abeatrix abeatrix merged commit 8a0d43e into main Nov 17, 2023
14 checks passed
@abeatrix abeatrix deleted the bee/fix-editor-context branch November 17, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants