mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-23 01:46:18 +04:00
lsp: Fix compilation errors.
This commit is contained in:
parent
a5f9080a9c
commit
4240f757c0
@ -583,7 +583,12 @@ pub async fn text_document_range_formatting(
|
|||||||
Ok(response.unwrap_or_default())
|
Ok(response.unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn goto_request<T: lsp::request::Request>(
|
async fn goto_request<
|
||||||
|
T: lsp::request::Request<
|
||||||
|
Params = lsp::GotoDefinitionParams,
|
||||||
|
Result = Option<lsp::GotoDefinitionResponse>,
|
||||||
|
>,
|
||||||
|
>(
|
||||||
&self,
|
&self,
|
||||||
text_document: lsp::TextDocumentIdentifier,
|
text_document: lsp::TextDocumentIdentifier,
|
||||||
position: lsp::Position,
|
position: lsp::Position,
|
||||||
@ -628,7 +633,8 @@ pub async fn goto_definition(
|
|||||||
text_document: lsp::TextDocumentIdentifier,
|
text_document: lsp::TextDocumentIdentifier,
|
||||||
position: lsp::Position,
|
position: lsp::Position,
|
||||||
) -> anyhow::Result<Vec<lsp::Location>> {
|
) -> anyhow::Result<Vec<lsp::Location>> {
|
||||||
self.goto_request(response).await
|
self.goto_request::<lsp::request::GotoDefinition>(text_document, position)
|
||||||
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn goto_type_definition(
|
pub async fn goto_type_definition(
|
||||||
@ -636,24 +642,8 @@ pub async fn goto_type_definition(
|
|||||||
text_document: lsp::TextDocumentIdentifier,
|
text_document: lsp::TextDocumentIdentifier,
|
||||||
position: lsp::Position,
|
position: lsp::Position,
|
||||||
) -> anyhow::Result<Vec<lsp::Location>> {
|
) -> anyhow::Result<Vec<lsp::Location>> {
|
||||||
let params = lsp::GotoDefinitionParams {
|
self.goto_request::<lsp::request::GotoTypeDefinition>(text_document, position)
|
||||||
text_document_position_params: lsp::TextDocumentPositionParams {
|
.await
|
||||||
text_document,
|
|
||||||
position,
|
|
||||||
},
|
|
||||||
work_done_progress_params: lsp::WorkDoneProgressParams {
|
|
||||||
work_done_token: None,
|
|
||||||
},
|
|
||||||
partial_result_params: lsp::PartialResultParams {
|
|
||||||
partial_result_token: None,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let response = self
|
|
||||||
.request::<lsp::request::GotoTypeDefinition>(params)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
self.goto_request(response).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn goto_implementation(
|
pub async fn goto_implementation(
|
||||||
@ -661,24 +651,8 @@ pub async fn goto_implementation(
|
|||||||
text_document: lsp::TextDocumentIdentifier,
|
text_document: lsp::TextDocumentIdentifier,
|
||||||
position: lsp::Position,
|
position: lsp::Position,
|
||||||
) -> anyhow::Result<Vec<lsp::Location>> {
|
) -> anyhow::Result<Vec<lsp::Location>> {
|
||||||
let params = lsp::GotoDefinitionParams {
|
self.goto_request::<lsp::request::GotoImplementation>(text_document, position)
|
||||||
text_document_position_params: lsp::TextDocumentPositionParams {
|
.await
|
||||||
text_document,
|
|
||||||
position,
|
|
||||||
},
|
|
||||||
work_done_progress_params: lsp::WorkDoneProgressParams {
|
|
||||||
work_done_token: None,
|
|
||||||
},
|
|
||||||
partial_result_params: lsp::PartialResultParams {
|
|
||||||
partial_result_token: None,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let response = self
|
|
||||||
.request::<lsp::request::GotoImplementation>(params)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
self.goto_request(response).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn goto_reference(
|
pub async fn goto_reference(
|
||||||
@ -704,7 +678,6 @@ pub async fn goto_reference(
|
|||||||
|
|
||||||
let response = self.request::<lsp::request::References>(params).await?;
|
let response = self.request::<lsp::request::References>(params).await?;
|
||||||
|
|
||||||
self.goto_request(response.map(lsp::GotoDefinitionResponse::Array))
|
Ok(response.unwrap_or_default())
|
||||||
.await
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user