Skip to content

refactor!: centralize sticky prompt and selection handling #855

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

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

deathbeam
Copy link
Collaborator

@deathbeam deathbeam commented Feb 24, 2025

This refactoring improves the CopilotChat plugin's state management by:

  • Adding insert_sticky function to centralize sticky prompt management
  • Creating set_selection to provide a cleaner API for selection handling
  • Consolidating highlight management in update_highlights
  • Standardizing function signatures and return values
  • Improving Chat:set_prompt functionality
  • Removing redundant code for better maintainability

BREAKING CHANGES:

  • M.resolve_prompt now returns config first and prompt second
  • M.update_selection removed in favor of new M.set_selection function
  • M.resolve_embeddings renamed to M.resolve_context
  • Selection setting now only configurable in global config, not per-operation
  • get_selection no longer accepts a config parameter
  • Selection handling moved from dynamic config to static global config
  • Changed sticky format and processing approach
  • Prompts in config now use explicit sticky property instead of prefixing

Closes #716

@deathbeam deathbeam added the enhancement New feature or request label Feb 24, 2025
@deathbeam deathbeam force-pushed the use-sticky-better branch 26 times, most recently from ceb2e98 to 3e5dedf Compare March 3, 2025 22:30
@deathbeam deathbeam force-pushed the use-sticky-better branch 3 times, most recently from fc55a95 to 0dea26f Compare March 4, 2025 22:45
@deathbeam deathbeam force-pushed the use-sticky-better branch 5 times, most recently from 322ebe3 to f55feef Compare March 4, 2025 23:07
@deathbeam deathbeam changed the title refactor: use sticky instead of stored config per chat refactor!: use sticky instead of stored config per chat Mar 4, 2025
@deathbeam deathbeam marked this pull request as ready for review March 4, 2025 23:07
@deathbeam deathbeam force-pushed the use-sticky-better branch 4 times, most recently from 0cc5798 to 17cf065 Compare March 4, 2025 23:24
@deathbeam
Copy link
Collaborator Author

TODO:

When doing .stop() and starting new prompt right after, for some reason stickies are not inherited

@deathbeam deathbeam force-pushed the use-sticky-better branch 8 times, most recently from c2b1715 to c3c205d Compare March 5, 2025 10:26
This refactoring improves the CopilotChat plugin's state management by:
- Adding `insert_sticky` function to centralize sticky prompt management
- Creating `set_selection` to provide a cleaner API for selection handling
- Consolidating highlight management in `update_highlights`
- Standardizing function signatures and return values
- Improving `Chat:set_prompt` functionality
- Removing redundant code for better maintainability

BREAKING CHANGES:
- `M.resolve_prompt` now returns config first and prompt second
- `M.update_selection` removed in favor of new `M.set_selection` function
- `M.resolve_embeddings` renamed to `M.resolve_context`
- Selection setting now only configurable in global config, not per-operation
- `get_selection` no longer accepts a config parameter
- Selection handling moved from dynamic config to static global config
- Changed sticky format and processing approach
- Prompts in config now use explicit `sticky` property instead of prefixing

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
@deathbeam deathbeam force-pushed the use-sticky-better branch from c3c205d to 9621293 Compare March 5, 2025 10:27
@deathbeam deathbeam changed the title refactor!: use sticky instead of stored config per chat refactor!: centralize sticky prompt and selection handling Mar 5, 2025
@deathbeam deathbeam merged commit a1de0aa into CopilotC-Nvim:main Mar 5, 2025
2 checks passed
@deathbeam deathbeam deleted the use-sticky-better branch March 5, 2025 10:31
@v3ceban v3ceban mentioned this pull request Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making implicit context explicit visually in copilot
1 participant