-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Add REPL tab-completion functionality. #2964
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not yet sure which shape the API should have. Should complete return
I think it should return the top suggestion as a string. This suggestion may be set interactively when the user uses the prompt buffer.
Issue #1: When completing, the symbol around the cursor doesn't get pasted onto the prompt buffer.
Issue #2: If I type a prefix of the symbol I'm trying to complete, it won't appear at the top of the suggestions. This may be a limitation of the prompt buffer. Perhaps it doesn't sort sources, I didn't check it.
Looks good to me other than André's remarks. |
Good, then no change to the current API :D
Yes, doesn't. That deliberate: instead of parsing the contents of the cell (compiler-complete problem) and somehow replacing it (requiring JS), we just list all the suggestions and paste the selected one verbatim. This is not a perfect API, but:
So, unless we come up with something better, this one would be fine :) But then, should we call it tab-completion if it's not actually completing? Maybe call it
Yeah, it doesn't. I've reordered the sources to be more intuitive in 8266378, but there's not much to do beyond that :) |
Yes, this is not completion. Suggest sounds good to me! Also, I'd strongly advice not including a button for this feature (see below). The feature is easily discoverable by commonplace keybindings ( Personally, I find it odd to integrate this feature at such a premature stage. I think that the bare minimum should do as follows. Let This needs to be extensively tested to ensure that the text replacement is done right. Handling whitespace, non-alpha symbols, etc. Although I didn't think about this long enough, it strikes me that the suggested solution does it at the level of |
So, putting it on a backburner? Or delete a button and ship :D I mean, yeah, something like general tab-completion won't hurt, but this REPL-local hack is okay for the use-case (((o(*゚▽゚*)o))) |
All addressed:
Rebasing, squashing, merging? |
Hello Artyom, thank you very much for this! It does in fact make the REPL infinitely more useful. I find myself struggling to remember symbols, and this really helps. With regards to this PR, it is I believe an improvement. Ideally, we need to consider a completion framework at the level of input-edit as Andre suggested. That said, I think this should be merged in because it begins the development of a framework. When the next time happens that we want to add tab-completion we'll have a basis of which to build off. A way in order to see how the code could be generalized for reuse. We'll discover the API. I am thinking of the approach as delineated in Practical Common Lisp of writing code and then replacing things with Macros as the correct solution emerges (https://gigamonkeys.com/book/practical-a-simple-database.html). |
@aartaka I'd like to emphasize that this is a fantastic improvement! The remarks I made only make sense when reviewing the PR based on the title. I think it would be premature to jump at solving a big and general problem when we can have this simple and elegant solution that enhances the REPL experience. Thank you for working on this. For my side, it's ready to be merged. I'm not sold on the name of the command, |
I mean, the |
19081f6
to
4c4c048
Compare
4c4c048
to
2c96778
Compare
This is not correct. See |
Description
Y'ALL ON ATLAS TEAM, WE'RE ALL ON VACATION, DON'T REVIEW THIS PR, GET SOME TIME FOR YOURSELF ヽ(o`皿′o)ノ
This allows us to tab-complete things in REPL (at least for
lisp-cell
s), which I myself found a painfully lacking feature.Discussion
complete
returnffi-buffer-paste
thing is more customizable per cell?Checklist:
Everything in this checklist is required for each PR. Please do not approve a PR that does not have all of these items.
cd /path/to/nyxt/checkout git submodule add https://gitlab.common-lisp.net/nyxt/py-configparser _build/py-configparser
:documentation
s written in the aforementioned style. (It's OK to skip the docstring for really trivial parts.)changelog.lisp
with my changes if it's anything user-facing (new features, important bug fix, compatibility breakage).migration.lisp
entry for all compatibility-breaking changes.(asdf:test-system :nyxt)
and(asdf:test-system :nyxt/gi-gtk)
) and they pass.