copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.79k stars 126 forks source link

Add get panel completions support #135

Closed rwc9u closed 1 year ago

rwc9u commented 1 year ago

Add support for calling getPanelCompletions.

In neovim this is called with :Copilot panel or :Copilot

Open a window with up to 10 completions for the current buffer.

zerolfx commented 1 year ago

I have made some changes to the code. I attempted to use org-mode for displaying completions as line separators can cause syntax errors in certain languages and disrupt syntax highlighting. However, I encountered an org-related error: Error running timer ‘org-reveal’: (wrong-type-argument number-or-marker-p nil). I will address this issue later.

To make the panel feature better, we can also:

rwc9u commented 1 year ago

Cool. I'll try those others. I'm a relative newb at programming more than a few lines of emacs-lisp but figure there must be a way to sort lists in lisp lol

rwc9u commented 1 year ago

If you would prefer that I stack commits in separate PRs I can do that. I didn't see the error you mentioned with my org-mode setup. I have added sorting based on score. I did the sorting for each PanelSolution notification because sometimes I don't get 10 solutions so I never get the PanelSolutionsDone.

zerolfx commented 1 year ago

Thanks a lot for your effort.

You made excellent use of org-mode properties to sort and filter. (I'm not an org user.)

There is one minor issue that remains: mark-whole-buffer should not be used in elisp programming because it is interactive-only. Unfortunately, we cannot call org-sort-entries without using it. I will merge the changes now and address the warning later if necessary.