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

Crash on LSP diagnostic #2572

Closed
dead10ck opened this issue May 25, 2022 · 3 comments
Closed

Crash on LSP diagnostic #2572

dead10ck opened this issue May 25, 2022 · 3 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@dead10ck
Copy link
Member

dead10ck commented May 25, 2022

Summary

I experienced a crash of helix with this message:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/dead10ck/src/helix/helix-term/src/application.rs:459:81
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This was on d2b1add and the problematic issue is here:

Notification::PublishDiagnostics(params) => {
let path = params.uri.to_file_path().unwrap();
let doc = self.editor.document_by_path_mut(&path);
if let Some(doc) = doc {
let lang_conf = doc.language_config();
let text = doc.text();
let diagnostics = params
.diagnostics
.into_iter()
.filter_map(|diagnostic| {
use helix_core::{
diagnostic::{Range, Severity::*},
Diagnostic,
};
use lsp::DiagnosticSeverity;
let language_server = doc.language_server().unwrap();

It appears that it was trying to handle a diagnostic message before the LSP was fully initialized, and this code seems to assume that if we are handling this message, the LSP must be fully initialized.

Helix Version

helix d2b1add

@dead10ck dead10ck added the C-bug Category: This is a bug label May 25, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label May 25, 2022
@lebakasable
Copy link

The problem is already fixed I think update your Helix

@dead10ck
Copy link
Member Author

@frexsdev oh, I don't see any change? It still looks the same to me:

let language_server = doc.language_server().unwrap();

Was it fixed somewhere else in the code?

@pascalkuthe
Copy link
Member

This was fixed by #7467

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 C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants