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

Various fixes to lsp-fsharp #3327

Merged
merged 1 commit into from
Jul 16, 2022
Merged

Various fixes to lsp-fsharp #3327

merged 1 commit into from
Jul 16, 2022

Conversation

drvink
Copy link
Contributor

@drvink drvink commented Jan 28, 2022

Changes described in the commit messages and docstrings.

@github-actions github-actions bot added client One or more of lsp-mode language clients documentation labels Jan 28, 2022
@razzmatazz
Copy link
Collaborator

razzmatazz commented Feb 12, 2022

hey @drvink I am thinking about reviewing/testing this, but my question is about your last commit

I was planning about introducing an ability to install fsautocomplete as a global dotnet tool (almost the exact same code as we have it for csharp-ls in lsp-csharp.el). in this PR you apparently are trying to use the locally installed fsautocomplete dotnet tool, but do not provide ability to install it, right?

is there any particular reason you expect fsautocomplete to be installed as a local dotnet tool and not as a global dotnet tool? as I understand the current installation method for fsharp fails for you too, right?

would you mind if I dropped your last commit and:
(a) rewrite of installation of fsautocomplete using dotnet tool install -g fsautocomplete
(b) drop lsp-fsharp-use-dotnet-tool-for-fsac -- as fsac would always be invoked from a dotnet tool package

@razzmatazz
Copy link
Collaborator

also, I don't quiet get the reason behind introducing lsp-use-workspace-root-for-server-default-directory var? is this because you're using a "local" version of fsautocomplete dotnet tool and not a global? i.e. in the case of local dotnet too you only have access to the command from workspace root, right?

then I guess this wouldn't be necessary if we require fsautocomplete to be installed as a global tool

@drvink
Copy link
Contributor Author

drvink commented Feb 12, 2022

Indeed, I didn't add anything for installing it; it would be even simpler than the existing install code, since as of 0.50, FSAC is intended to be installed as a dotnet tool (and only a nupkg is provided in the github releases, no more zip file). I figured I'd get this PR through first, since it doesn't break anything or change any defaults.

I agree the ideal thing would be to try to run it as a global tool by default. However, when I installed fsautocomplete as a global tool, it still didn't work unless I manually made a dotnet-fsautocomplete symlink pointing to the FSAC binary somewhere in my PATH, and then I could run it via dotnet fsautocomplete (you can't run global tools with dotnet tool). I don't know if we should make the symlink as part of installation from lsp-mode--it would probably be rude to do it automatically, because there's no location that's both guaranteed to be in the user's PATH and where it would not be presumptuous to mess with its contents. But we should definitely at least tell the user they have to do it, if not.)

I don't think it hurts to keep lsp-fsharp-use-dotnet-tool-for-fsac and just leave it nil by default, given that people may want it local for any number of reasons.

(I wonder: should we try fallbacks? E.g. try dotnet tool run iff lsp-fsharp-use-dotnet-tool-for-fsac is non-nil; else (or if it fails) try dotnet fsautocomplete (global); else try the old way. I couldn't find an easy way to do it, but it's probably not worth it anyway.)

And yes, you only have access to local dotnet tools if you're in a directory under the workspace root, so I had to add the stuff for lsp-use-workspace-root-for-server-default-directory in order for lsp-mode to be able to run it. I could easily imagine a situation like this coming up again in the future (including with other lsp servers/language "package" systems), so I think it's useful to keep even if your plan is to just install FSAC as a global tool.

@razzmatazz
Copy link
Collaborator

ok, my plan is then to:
(a) use your first 2 commits as a base for my PR
(b) rewrite installation/startup mechanism to use global tool version
(c) leave it to you to rebase your last PR so you can provide customization on top of (b)

@razzmatazz
Copy link
Collaborator

@drvink I have upped a PR #3350 with your commits (sans the last one)

I suggest we wait for it to be merged and then you can reapply your last commit with non-global fsautocomplete setup on top of master then

@drvink
Copy link
Contributor Author

drvink commented Feb 21, 2022

@razzmatazz Do you want me to try to rebase what I have on #3350, or should I wait until it's merged?

@razzmatazz
Copy link
Collaborator

razzmatazz commented Feb 21, 2022

@razzmatazz Do you want me to try to rebase what I have on #3350, or should I wait until it's merged?

Actually, could you wait a bit -- I got my pc reinstalled twice -- sorry it took so long -- as I still want to add (executable-find "fsautocomplete") check to inform the user he/she has to fix exec-path before merge

I should be able to do it today

you can then rebase on master

@razzmatazz
Copy link
Collaborator

I have enabled automerge on #3350, should be merged soon after CIs are complete

@elken
Copy link
Contributor

elken commented Mar 13, 2022

Might also be worth adding in defcustom-lsp

@yyoncho
Copy link
Member

yyoncho commented Jul 2, 2022

can you resolve conflicts?

This is a buffer-local variable to enable temporarily binding
`default-directory' to `lsp-workspace-root' when running an LSP server, allowing
for project-local LSP server installations (e.g. as with `dotnet tool` for F#).
@drvink
Copy link
Contributor Author

drvink commented Jul 16, 2022

@yyoncho Sorry to keep you waiting; rebased and should be fine to merge now.

@yyoncho yyoncho merged commit e1d5649 into emacs-lsp:master Jul 16, 2022
@yyoncho
Copy link
Member

yyoncho commented Jul 16, 2022

@drvink thank you.

(FTR it is good to ping after force push, GH might not send a mail)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client One or more of lsp-mode language clients documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants