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

Tab completion and inspection #34

Closed
wants to merge 5 commits into from

Conversation

bendudson
Copy link

This PR replaces PR #33, and includes both that inspect_request handling code and complete_request handling. These provide tab completion of symbols and keywords, and inspection of functions with Shift-Tab.

I put public domain code from SWANK into a separate file, completions.lisp. Unfortunately this part of the SWANK backend isn't in Conium on QuickLisp, but it's fairly small. The tab completion code therefore uses the same method as SLIME to find the completions. A list of possible completions is presented in the notebook, sorted with shortest at the top.

The code works with SBCL 1.4.2 on Debian with Jupyter 4.1.0. I think the basic functionality is there, but could of course be improved and should probably be tested on other systems.

Plan to borrow code from SWANK (public domain) to inspect
functions and variables. This should be able to replace
the SLIME feature which shows the current function argument list.
Typing Shift-Tab brings up a tooltip containing the output of DESCRIBE.
To mimic the behaviour of SLIME, the function at the start of the form
is described, not the symbol at the cursor.
* If no function symbol found, searches surrounding form
  to handle macros and let forms
* Copied public domain code from swank into src/completions.lisp
  into new package cl-jupyter-swank

* Added a handler for complete_request message types. Currently
  just prints the message fields.
Finds the symbol before the cursor position using simple backward search.
Will get confused by symbols with spaces in the name, but hopefully rare.

Tooltip contains matching symbols sorted by length, shortest first.
@fredokun
Copy link
Owner

fredokun commented Feb 8, 2018

Sorry I'm a little bit late for the reply. Completion is something I really would like to support but I did not find enough time to start it, I'm glad you did! So before finding some dev. time I created a branch completion and merged your PR there. I suggest you base your further PR's directly on this branch so you can continue to update things if you want, and I know where to look at things. Hopefully this will be merged in master ASAP. Anyways thanks for contributing!
(I close this PR because it's in the new branch).

@fredokun fredokun closed this Feb 8, 2018
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.

2 participants