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 support for showing all LSPs in --health #7315

Merged
merged 10 commits into from
Oct 16, 2023

Conversation

TheRealLorenz
Copy link
Contributor

@TheRealLorenz TheRealLorenz commented Jun 11, 2023

Hi there, today I had to debug an lsp configuration with multiple servers and came across this missing feature.
I wrote a quick implementation for the --health <language> subcommand, but now I'm stuck at --health languages.

In my machine --health languages doesn't fully show lang-servers' names and if I were to print all names one after another it would be pretty useless.

My idea was to check for the number of lang-servers and if there are more than one than the output could be something like (the names are pretty bad, I'm seeking better ideas):

✓ All (in green, it means all servers are ok)
- Some (in yellow, it means some servers are ok and some are not)
✘ None (in red, it means all servers are not ok)

Then for a more detailed output the user could use --health <language>.

Otherwise we could show every lang-server name in a different line, but I think it could become a little cumbersome to implement.

Let me know your thoughts!

@gabydd
Copy link
Member

gabydd commented Jun 12, 2023

Maybe it would be better then "all, some, none" to represent it will the symbol plus <amount of available servers>/<amount of configured servers>

@TheRealLorenz
Copy link
Contributor Author

TheRealLorenz commented Jun 12, 2023

Update

As @gabydd suggested, I updated the code and now --health languages looks like this:

✓ 2/2 (in green, it means all servers are ok)
- 1/3 (in yellow, it means some servers are ok and some are not)
✘ 0/4 (in red, it means all servers are not ok)

I'm still not sure about the symbol for the yellow message, I don't like the hyphen very much. Maybe I could just use or ?

@TheRealLorenz
Copy link
Contributor Author

Should I also update the docs/wiki?

@TheRealLorenz TheRealLorenz marked this pull request as ready for review June 14, 2023 08:26
@CptPotato
Copy link
Contributor

CptPotato commented Jun 15, 2023

I'm still not sure about the symbol for the yellow message, I don't like the hyphen very much. Maybe I could just use or ?

The way I understand it, multiple language servers for a language are usually alternatives, right?
In that case I think a check mark is fine.

Edit: Ah, thanks for the clarification @AlexanderBrevig

@AlexanderBrevig
Copy link
Contributor

The way I understand it, multiple language servers for a language are usually alternatives, right? In that case I think a check mark is fine.

They all run simultaneously.
A typical setup would be ["typescript", "eslint", "prettier"] for a typescript setup.
Missing one of them would not feel and as such, I vote for the - indicating partial setup.

@TheRealLorenz
Copy link
Contributor Author

Perfect. I'm updating the wiki as soon as this pr gets merged. I haven't find any mention of the healthchecks inside the docs.

@kirawi kirawi added A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Jun 15, 2023
@gyreas
Copy link

gyreas commented Jun 20, 2023

Will it be possible to specify the languages to display as such: hx --health lang1 lang2...langn?

@TheRealLorenz
Copy link
Contributor Author

TheRealLorenz commented Jun 20, 2023

Will it be possible to specify the languages to display as such: hx --health lang1 lang2...langn?

Well I don't think it would be difficult to implement, but I think it should be done in a different PR.

Maybe if you open an issue, I could start to work on that!

Better output (inspired by helix-editor#8156).

Handle the case where no LSPs are configured.
@TheRealLorenz
Copy link
Contributor Author

TheRealLorenz commented Sep 3, 2023

Current output of --health with this PR

--health languages:

css            ✓ vscode-css-language-server (green)
svelte         ✘ 0/3 (red)
tsx            - 2/3 (yellow)
typescript     ✓ 2/2 (green)
yuck           None (yellow)
zig            ✘ zls (red)

--health <language>: (symbols are green or red, paths are green, errors are red and "None" is yellow)

Configured language servers:
  ✓ typescript-language-server: /Users/lollo/Library/pnpm/typescript-language-server
  ✓ vscode-eslint-language-server: /Users/lollo/Library/pnpm/vscode-eslint-language-server
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓
Configured language servers:
  ✓ clangd: /usr/bin/clangd
Configured debug adapter: lldb-vscode
Binary for debug adapter: 'lldb-vscode' not found in $PATH
Highlight queries: ✓
Textobject queries: ✓
Indent queries: ✓
Configured language servers: None
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✘
Indent queries: ✘

@archseer
Copy link
Member

archseer commented Sep 7, 2023

svelte ✘ 0/3 (red)
tsx - 2/3 (yellow)
typescript ✓ 2/2 (green)

I'm not sure this is the best UI, it makes it look like I need to install all the servers where one should be enough. I'd maybe list the ones that were detected and then a number of those that weren't found.

@TheRealLorenz
Copy link
Contributor Author

TheRealLorenz commented Sep 7, 2023

svelte ✘ 0/3 (red)
tsx - 2/3 (yellow)
typescript ✓ 2/2 (green)

I'm not sure this is the best UI, it makes it look like I need to install all the servers where one should be enough. I'd maybe list the ones that were detected and then a number of those that weren't found.

My first idea was actually to make something like:

css            ✓ vscode-css-language-server (green)
svelte         ✘ svelteserver (red)
               ✘ eslint-language-server (red)
               ✘ emmet-langugage-server (red)
tsx            ✓ typescript-language-server (green)
               ✘ eslint-language-server (red)
               ✘ emmet-langugage-server (red)
typescript     ✓ typescript-language-server (green)
               ✘ eslint-language-server (red)
yuck           None (yellow)
zig            ✘ zls (red)

But I though it would have been a little cumbersome to implement.

Let me know if this may be a better solution to the problem.

Displays all LSPs as a list in the table generated wih `--health languages`
@EpocSquadron
Copy link
Contributor

I'm not sure this is the best UI, it makes it look like I need to install all the servers where one should be enough.

Technically, if there are multiple lsps configured this is exactly the case (I configured two more, now I have to see if helix sees them). That is unless and until multiple lsps are configured by default for a language specifically to provide fallbacks rather than expecting multiple to be required. In that case, the alternate UX @TheRealLorenz and I independently suggested is better.

@TheRealLorenz
Copy link
Contributor Author

I think this PR should be included in the upcoming release, as it will be the first release with multiple LSP support.

@TheRealLorenz
Copy link
Contributor Author

svelte ✘ 0/3 (red)
tsx - 2/3 (yellow)
typescript ✓ 2/2 (green)

I'm not sure this is the best UI, it makes it look like I need to install all the servers where one should be enough. I'd maybe list the ones that were detected and then a number of those that weren't found.

My first idea was actually to make something like:

css            ✓ vscode-css-language-server (green)
svelte         ✘ svelteserver (red)
               ✘ eslint-language-server (red)
               ✘ emmet-langugage-server (red)
tsx            ✓ typescript-language-server (green)
               ✘ eslint-language-server (red)
               ✘ emmet-langugage-server (red)
typescript     ✓ typescript-language-server (green)
               ✘ eslint-language-server (red)
yuck           None (yellow)
zig            ✘ zls (red)

But I though it would have been a little cumbersome to implement.

Let me know if this may be a better solution to the problem.

I've already implemented this (need to push it), I'm just looking for a feedback now

helix-term/src/health.rs Outdated Show resolved Hide resolved
helix-term/src/health.rs Outdated Show resolved Hide resolved
@the-mikedavis
Copy link
Member

That alternate UI looks clearer to me

@TheRealLorenz
Copy link
Contributor Author

Pushed commits with the alternative UI and applied the requested changes!

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small style nit. I'm liking the way this is looking now 👍

helix-term/src/health.rs Outdated Show resolved Hide resolved
@David-Else
Copy link
Contributor

I tested this, all seems great!

Please try to merge it before the big new release as it will be very important to problem shoot the new multiple language server feature.

@the-mikedavis the-mikedavis added this to the 23.10 milestone Oct 16, 2023
@pascalkuthe pascalkuthe merged commit d9d7f67 into helix-editor:master Oct 16, 2023
6 checks passed
@TheRealLorenz TheRealLorenz deleted the master branch October 18, 2023 08:05
danillos pushed a commit to danillos/helix that referenced this pull request Nov 21, 2023
* Add support for showing all LSPs in --health <lang>

* Add support for showing all LSPs in --health languages

* Use available/configured in --health languages

* Apply @AlexanderBrevig suggestion in --health

* Update `--health <language>`

Better output (inspired by helix-editor#8156).

Handle the case where no LSPs are configured.

* Display all LSPs in `--health languages` instead of x/x

Displays all LSPs as a list in the table generated wih `--health languages`

* Make check_binary accept Optional references to str

Avoids some calls to .clone()

* Apply @the-mikedavis suggestions

* Avoid useless collecting and cloning

* Use for loop instead of .try_for_each()
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
* Add support for showing all LSPs in --health <lang>

* Add support for showing all LSPs in --health languages

* Use available/configured in --health languages

* Apply @AlexanderBrevig suggestion in --health

* Update `--health <language>`

Better output (inspired by helix-editor#8156).

Handle the case where no LSPs are configured.

* Display all LSPs in `--health languages` instead of x/x

Displays all LSPs as a list in the table generated wih `--health languages`

* Make check_binary accept Optional references to str

Avoids some calls to .clone()

* Apply @the-mikedavis suggestions

* Avoid useless collecting and cloning

* Use for loop instead of .try_for_each()
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
* Add support for showing all LSPs in --health <lang>

* Add support for showing all LSPs in --health languages

* Use available/configured in --health languages

* Apply @AlexanderBrevig suggestion in --health

* Update `--health <language>`

Better output (inspired by helix-editor#8156).

Handle the case where no LSPs are configured.

* Display all LSPs in `--health languages` instead of x/x

Displays all LSPs as a list in the table generated wih `--health languages`

* Make check_binary accept Optional references to str

Avoids some calls to .clone()

* Apply @the-mikedavis suggestions

* Avoid useless collecting and cloning

* Use for loop instead of .try_for_each()
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
* Add support for showing all LSPs in --health <lang>

* Add support for showing all LSPs in --health languages

* Use available/configured in --health languages

* Apply @AlexanderBrevig suggestion in --health

* Update `--health <language>`

Better output (inspired by helix-editor#8156).

Handle the case where no LSPs are configured.

* Display all LSPs in `--health languages` instead of x/x

Displays all LSPs as a list in the table generated wih `--health languages`

* Make check_binary accept Optional references to str

Avoids some calls to .clone()

* Apply @the-mikedavis suggestions

* Avoid useless collecting and cloning

* Use for loop instead of .try_for_each()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Health check subcommand doesn't display multiple language servers