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

Enhance scittle nrepl, where to add stuff? #2

Open
benjamin-asdf opened this issue Jan 28, 2023 · 10 comments
Open

Enhance scittle nrepl, where to add stuff? #2

benjamin-asdf opened this issue Jan 28, 2023 · 10 comments

Comments

@benjamin-asdf
Copy link
Contributor

benjamin-asdf commented Jan 28, 2023

Currently we have this 2 layer solution for the sci nrepl that talks via websocked to e.g. scittle nrepl.
I would like to implement eldoc for scittle so I would have to add it both here and there; Sounds like trouble.
In the case of eldoc we might be able to implement in terms of sci.nrepl. Because it only needs to eval

(meta
 (resolve sym))

I guess the whole point of sci.nrepl is to try to not have to reimplement the same stuff for each project.

@borkdude
Copy link
Contributor

It would be nice if we can concentrate the logic here indeed.

@benjamin-asdf
Copy link
Contributor Author

benjamin-asdf commented Jan 29, 2023

Describe Operation Implementation Challenge

The browser server handles describe, but which ops are actually implemented is defined on the handler side.
Suggested naming:

So client <- browser-server -> nrepl-handler-server (scittle.nrepl).

If I want to add eldoc, I want to advertise the supported op (ops in describe).

  1. Make browser-server always say "eldoc" is implemented .
  2. Make browser-server flow describe through to handler-server, so it
    handles it by itself. (This could be done by a sci.nrepl lib
    function, that server-handler can use).

1. downsides:

  • Would not be correct anymore, if we plug in a another server-handler
    (which handles a different set of ops)

2. downsides:

  • More logic on the handler side but we want as much as possible
    in sci.nrepl
  • Braking because existing implementations need to handle describe

@borkdude
Copy link
Contributor

borkdude commented Feb 2, 2023

I'll get back to this hopefully soon.

@borkdude
Copy link
Contributor

borkdude commented Feb 10, 2023

@benjamin-asdf

  1. I think we need to move the describe response to the implementation (scittle) rather than this dependency since it will depend on the implementation what it supports.

  2. As for eldoc: we can put the common eldoc handler in sci.nrepl and then you can hook it up in the implementation, similar to how completions work.

nbb has a slightly more sophisticated eldoc handler than what you described:

https://github.com/babashka/nbb/blob/ec00dfd7e8de51a85db4318f52decc103c98c2ee/src/nbb/impl/nrepl_server.cljs#L194-L244

@benjamin-asdf
Copy link
Contributor Author

Yes this makes the most sense 👍

I guess we already know that nobody else is using sci.nrepl except the scittle repl? Because it would be a braking change if they update sci.nrepl.. They then need to implement describe else tools would break.

I plan to tackle moving describe and implement an eldoc for scittle repl in the comming days.

@borkdude
Copy link
Contributor

sci.nrepl isn't really used beyond scittle. There is an open PR in Clerk that adds the same nREPL support as scittle to it, but I can easily change that.

@benjamin-asdf
Copy link
Contributor Author

benjamin-asdf commented Feb 11, 2023

(case (keyword (get msg :op))

How to handle the ops list?
Currently, if I add additional ops handled by the implementing nrepl-server,

  1. we also need some scheme to know about the ops.

  2. Or we flow all ops through to the nrepl-server and expect it to complain about unkown ops itself?

maybe 2 is the simplest and easiest.
I would then not complain about unkown op in browser_server and assume the nrepl-server is handleling ops / unkown ops.

@borkdude
Copy link
Contributor

I don't fully understand the consequences of either, so just go with the easiest option and we will change if necessary

@benjamin-asdf
Copy link
Contributor Author

image

eldoc in scittle! haha

not all core functions have meta data. str for example does not.

benjamin-asdf added a commit to benjamin-asdf/sci.nrepl that referenced this issue Feb 12, 2023
benjamin-asdf added a commit to benjamin-asdf/scittle that referenced this issue Feb 12, 2023
@borkdude
Copy link
Contributor

not all core functions have meta data. str for example does not.

This is because scittle is compiled with SCI_ELIDE_VARS which is a setting which leaves out docstrings and arglists for core vars to save space.

borkdude pushed a commit that referenced this issue Feb 17, 2023
borkdude pushed a commit to babashka/scittle that referenced this issue Feb 17, 2023
* Update nrepl to handle describe and eldoc

See babashka/sci.nrepl#2

* Update changelog
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

No branches or pull requests

2 participants