Open oxysoft opened 1 year ago
@oxysoft I like this. Are you interested in keymappings through IdeaVim to the existing actions (select code as context and focus the input box), in custom keymappings, decided by the user, or just a few more pre-decided shortcuts, like "comment code", "write docstring", etc...?
Hi, can you clarify? It's not entirely clear what you mean. In Vim, keymaps are simply sequences of inputs to play, so the commands I showed above can be mapped directly as mappings. These functionalities must be usable with and without the chat window.
My preferred way to use it is no chat window. So if I map a ContinueGenerate command to a keymap, I would hit that key, wait a little bit, and the code is immediately inserted into the buffer. For refactoring, I would select some code, hit the keymap, and after a few moments the code is immediately updated.
But it would be cool in some cases to use the chat window, so there should be equivalent functions which send it to the chat window instead, and also having commands we can map for the usual continue workflow, such as sending the selection to context and simply focusing the input box without sending.
The chat-less functionalities would also prepare you for the NeoVim implementation, since this is how most Vim users are gonna want to use continue.dev initially. The chatting is actually an edge case for most developers I think, it would be better if we first optimized the UX for the basics of code insertion and transformation with AI in the same classic code-editing environment we are used to.
Ok I totally see what you're saying! And I think this answered my question perfectly, which was basically just whether you were interested in shortcuts to slash commands in the chat window.
We're currently doing something similar in VS Code by adding right click dropdown menu options when code is highlighted, this is just the even faster version of that. So if anything I'll take that as a starting point. First few I think we'd add are "write comments", "write docstring", "fix", "edit from instructions".
Current plan is for them to use our existing diff UI, which opens a full screen side-by-side diff. This seems like a fairly orthogonal question, but do you have strong opinions on that vs. inline (vertical you might call it) edit display?
I was a little confused about the slash commands at first, but yes so basically in this post so far I am proposing the simplest use case of LLMs which I think we should be focusing on first even outside of Vim usage patterns — meaning no slash command, simply asking the LLM to insert or modify the code with our own prompt. The slash commands I realize now are more than just reusable templates — if that were the case I was just gonna do it myself in my Vim config and implement all the prompts I need — but turns out they can implement much more complex behavior with python code, so definitely we should also be able to call them from Vim, perhaps like this :ContinueSlash test
I think it's also possible to write Vim commands in a way such that the rest of the arguments afterwards will be joined into a string so :ContinueSlash test write some tests
would be equivalent to /test write some tests
I prefer having no diff UI at all, instead accept by default and one undo is equivalent to declining the edit. That way it's one fewer user interaction some of the time, and less UI flashing around every time.
I think even outside of Vim you should focus on having in all your supported IDEs a way to input a prompt at the caret location with minimal UI jumping around. Vim has the command line built-in that we can re-use, but if you don't use IdeaVim or Vim then you could implement a prompt mode for each IDE where your caret becomes colored, everything you type has a tinted background color to indicate it's a prompt, press enter to confirm and it removes the prompt text, the editor locks up for a few moments to let you know it's processing, and then the code is instantly summoned into the editor without any UI, fuss, etc. simply undo if you don't like it and activate prompt mode again. The prompt mode could have a history to navigate with up/down arrow keys, slash keys and context all work in here, etc. Like a one-shot version of your Chat window built into the code editor! Sounds like much less work to maintain and for most users I bet it would be the main tool they'd use!
In Copilot this is what I always wished, instead I have to write comments into the code and half the time the LLM doesn't understand the code should resume and instead hallucinates a bunch more comments......
For editing code it's a little more complicated since the caret is already used up to highlight the code. For that I think you'd wanna spawn a minimal UI textbox on top of the editor, but that's a whole other can of beans since you have to consider what each IDE and their UI framework will allow, and you also have to consider multi-platform support. Most likely both VS Code and JetBrains have the tools to build a good minimal input workflow, but I'm not sure if you'll be able to have that UI near the caret to avoid eye movement the same way we can do it using the editor itself as for inserting code.
I appreciate all of this. Sounds like we can make IdeaVim integration happen.
Inline UI is something we would love to do - unfortunately, at least in VS Code and as far as I've found so far in JetBrains as well, it's still an experimental API so we wouldn't be able to publish to the store. There may be workarounds though, and it's something we'll keep looking into.
Validations
Problem
Currently the UX is not ideal for IdeaVim users, many productivity gains are possible by adding native IdeaVim commands that allow interfacing with continue.dev
Solution
Implement commands e.g.
It's very important to ensure that it continues to work in recorded macros & keymaps. See the following IdeaVim plugins for inspiration on how it can be integrated. https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins