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 --health command for troubleshooting #1669

Merged
merged 7 commits into from
Mar 8, 2022

Conversation

sudormrfbin
Copy link
Member

@sudormrfbin sudormrfbin commented Feb 15, 2022

NOTE: The command has been renamed to --health.


Fixes #976.

Adds a --checkhealth flag to the helix binary which can be used to quickly diagnose some common problems like an LSP not being installed or not found in $PATH, non-existant runtime directory, etc.

$ hx --checkhealth
Config file: /home/gokul/.config/helix/config.toml
Language file: default
Log file: /home/gokul/.cache/helix/helix.log
Runtime directory: /home/gokul/.config/helix/runtime
Runtime directory is symlinked to /home/gokul/Projects/helix/runtime/

$ hx --checkhealth rust
Configured language server: rust-analyzer
Binary for language server: /usr/bin/rust-analyzer
Configured debug adapter: lldb-vscode
Binary for debug adapter: /usr/bin/lldb-vscode
Highlight queries: Found
Textobject queries: Found
Indent queries: Found

$ hx --checkhealth mint
Configured language server: mint
Binary for language server: Not found in $PATH
Configured debug adapter: None
Highlight queries: Not found
Textobject queries: Not found
Indent queries: Not found

$ hx --checkhealth erlang
Configured language server: None
Configured debug adapter: None
Highlight queries: Found
Textobject queries: Not found
Indent queries: Not found

$ hx --checkhealth rut
Given language not found
Did you mean one of these: rust, ruby, racket, regex, rescript ?

(Run locally to see some nice colors :)

@sudormrfbin sudormrfbin changed the title Move runtime file location definitions to core Add --checkhealth command for troubleshooting Feb 15, 2022
@the-mikedavis
Copy link
Member

This is pretty sweet!

A bit of a nit: what do you think about --check-health for the flag?

@archseer
Copy link
Member

archseer commented Feb 16, 2022

A bit of a nit: what do you think about --check-health for the flag?

Or even --check/--health

@archseer
Copy link
Member

Also, what about using a table like in the original proposal? Or outputting all entries. Would make it easier to see everything that's available and correctly detected.

@sudormrfbin
Copy link
Member Author

sudormrfbin commented Feb 26, 2022

I'm trying to display tables using tui's Table widget but I can't get anything rendered to screen. Since we don't display editor and exit early all initializations have to be done manually:

let backend = CrosstermBackend::new(std::io::stdout());
let mut terminal = tui::Terminal::new(backend).unwrap();
let surface = terminal.current_buffer_mut();
let area = *surface.area();

let table = Table::new(vec![
    Row::new(vec!["item1", "items2"]),
    Row::new(vec!["item3", "items4"]),
])
.header(Row::new(vec!["header1", "header2"]));

table.render(area, surface);
terminal.draw(None, helix_view::graphics::CursorKind::Block).unwrap();

(Also renamed the command to --health)

@sudormrfbin sudormrfbin changed the title Add --checkhealth command for troubleshooting Add --health command for troubleshooting Feb 26, 2022
helix-term/src/args.rs Outdated Show resolved Hide resolved
@pickfire
Copy link
Contributor

Screenshot_20220227_102013

I don't get this, the error messages are not that helpful for me. I don't know what is not found, I am curious what binary should be found for dap to work since I never used dap, I did which dap but nothing shows up.

Binary for debug adapter: Not found in $PATH

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

archseer commented Mar 1, 2022

I'm trying to display tables using tui's Table widget but I can't get anything rendered to screen.

I'd avoid that and just space every column out with a double tab for now. Or you could use the underlying types to compute column widths then render by hand. The tui types are intended to work with a fixed screen size (no scrolling)

@sudormrfbin
Copy link
Member Author

Added a tabular view that's displayed with a bare --health. Since there's limited space (even though space for each column is dynamically calculated) the format is a bit dependent on color, to signify for example whether an LSP is found in $PATH (red for not found, green for found, yellow for no configuration):

Screenshot_2022-03-01_15-58-27

I don't get this, the error messages are not that helpful for me. I don't know what is not found, I am curious what binary should be found for dap to work since I never used dap, I did which dap but nothing shows up.

@pickfire "Configured debug adapter" shows the name of the binary that's used for dap, similar to the configured language server line.

Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

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

Looks good to me, seemed to work nicely with 80 characters terminal as well.

@archseer archseer merged commit 194b09f into helix-editor:master Mar 8, 2022
@sudormrfbin sudormrfbin deleted the checkhealth-flag branch March 8, 2022 05:26
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.

Cli command to show enabled lsps, other setup information
4 participants