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

lsp: Actually implement workDoneProgress #234

Merged
merged 9 commits into from
Jun 18, 2021
Merged

Conversation

vv9k
Copy link
Contributor

@vv9k vv9k commented Jun 12, 2021

This PR reenables workDoneProgress and adds handling for workDoneProgress/create requests from lsp server.

@pickfire
Copy link
Contributor

Seemed to work and doesn't have performance issue but I would probably try to change to reuse the buffer later on like I mentioned.

@vv9k
Copy link
Contributor Author

vv9k commented Jun 13, 2021

Seemed to work and doesn't have performance issue but I would probably try to change to reuse the buffer later on like I mentioned.

Sorry but I'm not fully sure which buffer are you talking about, could you point it out to me perhaps?

@@ -73,6 +76,8 @@ impl Application {
editor,

callbacks: FuturesUnordered::new(),

lsp_progress: HashMap::new(),
Copy link
Member

Choose a reason for hiding this comment

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

Having this on Application is problematic because two different LSPs could write to the same progress token. I know this is kind of hard, but we need to set these on the LSP client :/

Comment on lines 291 to 281
(Some(title), None, None) => title.to_string(),
(None, Some(message), None) => message.to_string(),
(None, None, Some(percentage)) => format!("{}%", percentage),
(None, None, None) => "".into(),
};

if let lsp::WorkDoneProgress::End(_) = work {
self.lsp_progress.remove(&token);
}

msg
};
let token = match token {
lsp::NumberOrString::Number(n) => n.to_string(),
lsp::NumberOrString::String(s) => s,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry but I'm not fully sure which buffer are you talking about, could you point it out to me perhaps?

This part. String is being allocated and deallocated for every event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I optimized it somewhat, let me know if you think we can improve it further. Currently the status variable is moved to set_editor so we still have to allocate it on each event.

@vv9k
Copy link
Contributor Author

vv9k commented Jun 15, 2021

I submitted my work in progress, very much incomplete so nothing to see here for now. Will work on it some more tomorrow.

@pickfire
Copy link
Contributor

Can you please mark the pull request as draft?

@vv9k vv9k marked this pull request as draft June 16, 2021 03:40
helix-lsp/src/lib.rs Outdated Show resolved Hide resolved
@vv9k vv9k force-pushed the workdone branch 2 times, most recently from ca3cf83 to fe388e5 Compare June 16, 2021 16:29
@vv9k vv9k marked this pull request as ready for review June 16, 2021 16:33
@vv9k vv9k force-pushed the workdone branch 2 times, most recently from ea2a78a to 1f2f970 Compare June 16, 2021 17:44
helix-lsp/src/lib.rs Outdated Show resolved Hide resolved
helix-term/src/application.rs Outdated Show resolved Hide resolved
@archseer
Copy link
Member

Okay, one last thing, can we add a config option to disable the progress reports in the prompt? rust-analyzer pushes way too much data out continually, it's visually distracting for me

@vv9k
Copy link
Contributor Author

vv9k commented Jun 18, 2021

Okay, one last thing, can we add a config option to disable the progress reports in the prompt? rust-analyzer pushes way too much data out continually, it's visually distracting for me

Done, had to rebase to master so that I can reuse the Config.

book/src/configuration.md Outdated Show resolved Hide resolved
@archseer archseer merged commit a3cb79e into helix-editor:master Jun 18, 2021
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.

3 participants