Be more lenient when dealing with rust-analyzer's flycheck commands (#36782)
Flycheck commands are global and makes sense to fall back to looking up project's rust-analyzer even if the commands are run on a non-rust buffer. If multiple rust-analyzers are found in the project, avoid ambiguous commands and bail (as before). Closes #ISSUE Release Notes: - Made it possible to run rust-analyzer's flycheck actions from anywhere in the project
This commit is contained in:
parent
153724aad3
commit
d24cad30f3
5 changed files with 114 additions and 64 deletions
|
@ -9029,13 +9029,22 @@ impl LspStore {
|
|||
lsp_store.update(&mut cx, |lsp_store, cx| {
|
||||
if let Some(server) = lsp_store.language_server_for_id(server_id) {
|
||||
let text_document = if envelope.payload.current_file_only {
|
||||
let buffer_id = BufferId::new(envelope.payload.buffer_id)?;
|
||||
lsp_store
|
||||
.buffer_store()
|
||||
.read(cx)
|
||||
.get(buffer_id)
|
||||
.and_then(|buffer| Some(buffer.read(cx).file()?.as_local()?.abs_path(cx)))
|
||||
.map(|path| make_text_document_identifier(&path))
|
||||
let buffer_id = envelope
|
||||
.payload
|
||||
.buffer_id
|
||||
.map(|id| BufferId::new(id))
|
||||
.transpose()?;
|
||||
buffer_id
|
||||
.and_then(|buffer_id| {
|
||||
lsp_store
|
||||
.buffer_store()
|
||||
.read(cx)
|
||||
.get(buffer_id)
|
||||
.and_then(|buffer| {
|
||||
Some(buffer.read(cx).file()?.as_local()?.abs_path(cx))
|
||||
})
|
||||
.map(|path| make_text_document_identifier(&path))
|
||||
})
|
||||
.transpose()?
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue