mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Refactor CallInfo function signatures to new FunctionSignature type
This is used by CallInfo to create a pretty printed function signature that can be used with completions and other places as well.
This commit is contained in:
parent
5f700179fc
commit
0e49abb7fb
8 changed files with 212 additions and 71 deletions
|
@ -174,6 +174,28 @@ impl Conv for ra_ide_api::Documentation {
|
|||
}
|
||||
}
|
||||
|
||||
impl Conv for ra_ide_api::FunctionSignature {
|
||||
type Output = lsp_types::SignatureInformation;
|
||||
fn conv(self) -> Self::Output {
|
||||
use lsp_types::{ParameterInformation, ParameterLabel, SignatureInformation};
|
||||
|
||||
let label = self.to_string();
|
||||
|
||||
let documentation = self.doc.map(|it| it.conv());
|
||||
|
||||
let parameters: Vec<ParameterInformation> = self
|
||||
.parameters
|
||||
.into_iter()
|
||||
.map(|param| ParameterInformation {
|
||||
label: ParameterLabel::Simple(param),
|
||||
documentation: None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
SignatureInformation { label, documentation, parameters: Some(parameters) }
|
||||
}
|
||||
}
|
||||
|
||||
impl ConvWith for TextEdit {
|
||||
type Ctx = LineIndex;
|
||||
type Output = Vec<lsp_types::TextEdit>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue