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

Add "ignore standalone" option that disables HLS for files that don't belong to any folder #353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zkbpkp
Copy link

@zkbpkp zkbpkp commented Feb 25, 2021

Addresses issue #300

How to test:

Set "Haskell: Ignore Standalone" option to true

image

Open Haskell project and check that there's only one HLS instance:

image

Create a new standalone file (Ctrl+N) and paste some Haskell code from your project. Check that the number of haskell* processes is the same (i.e. extension haven't spawned any additional processes for this standalone file)

@jneira
Copy link
Member

jneira commented Mar 9, 2021

@KolesnichenkoDS hi, thanks for the pr, what would be the behaviour if you open directly a haskell file that does not belong to any project (with code MyStandloneModule.hs f. e.)?

@zkbpkp
Copy link
Author

zkbpkp commented Apr 1, 2021

@jneira hi, sorry, missed the response

It will do nothing, i.e. won't start a HLS instance.

@zkbpkp
Copy link
Author

zkbpkp commented Apr 1, 2021

I see how that may be a problem since you'll be forced to open the folder instead of simply opening the file.
Maybe could work around that by checking (in activateServerForFolder) if there is any opened folder, if so — then ignore files that don't belong to the folder, otherwise spawn HLS as usual.
Also, the option can be enabled per project, in that case if you do code Foo.hs then the option would not be enabled and HLS would spawn.
The thing is, right now spawning HLS for standalone files while working on project often causes problems if you often open scratch files with some snippets (for example I do that for snippets to paste into repl after :r). Would be probably better to fix those problems (like HLS instance remaining after standalone file is closed, or duplicated of hints on project files when 2+ instances are spawned) but even then I personally would prefer to have this option since I really don't need it's functionality on scratch files and that allows to reduce memory consumption by limiting HLS to only one instance.

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