-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for formatting capabilities to the LSP #1216
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.
The setup is indeed a bit clunky, but I imagine it's due to the setup of Topiary being clunky, right? There's not more to do for the Nickel LSP than what we already need to do to use Topiary locally, if I understand correctly? In that case, this is a reasonable first iteration step 👍
If there are things that Topiary could do to help, please open an issue there 🙂 . |
Yeah, but it's not really a big issue. The problem is that topiary cannot work (automatically) outside topiary repo's directory: you'd have to set some environment variables for it to work
I've told @nbacquey about this. They (the topiary team) are aware of it, but they have not yet decided how dynamic loading of languages should work, so I assume there should be an issue tracking it there. |
Relevant issues in Topiary are tweag/topiary#254 and tweag/topiary#415 |
@nbacquey this is only about getting a running topiary executable, right? How would the |
Embedding the queries in the distributed binary would be a possibility, yes. Also, we could support manual installation of languages, as @ebresafegaga suggested. Something like $ topiary install <language>
$ topiary list languages |
@ebresafegaga is there anything left to do on this PR? Otherwise, I think you can merge. |
This pull request adds the formatting capability to the LSP using topiary.
To use this successfully, the user has to do the following:
topiary
binary installed. See hereTOPIARY_REPO_DIR
to point to the local copy of the repoTOPIARY_LANGUAGE_DIR
to point to$TOPIARY_REPO_DIR/languages
Steps 2-4 are necessary because, for now,
topiary
cannot be used outside its repo directory.Alternatives
I think making a user fetch the
topiary
and set those environment variables, just to have the formatting capability innls
is a bit too much. I can think of the following alternatives, but I don't know if they are ideal.Keep a cache of the topiary repo
Keep a cache of the
topiary
repo. Fetch the repo from GitHub if it is not available in the local cache or not up to date.nls
has to download a potentially large repoEmbedded Nickel formatting rules as a string in the
nls
binarySince
topiary
just needs a singlenickel.scm
to be able to format nickel files we could just pointTOPIARY_LANGUAGE_DIR
to<some-temp-directory>/language
, and put the embedded file in that directory.topiary