3500: Don't creat public APIs with typos r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-03-06 17:41:53 +00:00 committed by GitHub
commit a42f29166b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 18 deletions

View File

@ -225,7 +225,7 @@ impl Completions {
let snippet = if ctx
.db
.feature_flags
.get("completion.insertion.add-argument-sippets")
.get("completion.insertion.add-argument-snippets")
{
let to_skip = if has_self_param { 1 } else { 0 };
let function_params_snippet = join(

View File

@ -54,8 +54,9 @@ impl Default for FeatureFlags {
FeatureFlags::new(&[
("lsp.diagnostics", true),
("completion.insertion.add-call-parenthesis", true),
("completion.insertion.add-argument-sippets", true),
("completion.insertion.add-argument-snippets", true),
("completion.enable-postfix", true),
("call-info.full", true),
("notifications.workspace-loaded", true),
("notifications.cargo-toml-not-found", true),
])

View File

@ -3,10 +3,10 @@
use lsp_types::{
self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation,
Location, LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp,
SemanticTokenModifier, SemanticTokenType, SymbolKind, TextDocumentEdit, TextDocumentIdentifier,
TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier,
WorkspaceEdit,
Location, LocationLink, MarkupContent, MarkupKind, ParameterInformation, ParameterLabel,
Position, Range, RenameFile, ResourceOp, SemanticTokenModifier, SemanticTokenType,
SignatureInformation, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem,
TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, WorkspaceEdit,
};
use ra_ide::{
translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition,
@ -220,17 +220,20 @@ impl Conv for ra_ide::Documentation {
}
}
impl Conv for ra_ide::FunctionSignature {
impl ConvWith<bool> for ra_ide::FunctionSignature {
type Output = lsp_types::SignatureInformation;
fn conv(self) -> Self::Output {
use lsp_types::{ParameterInformation, ParameterLabel, SignatureInformation};
fn conv_with(self, concise: bool) -> Self::Output {
let (label, documentation, params) = if concise {
let mut params = self.parameters;
if self.has_self_param {
params.remove(0);
}
(params.join(", "), None, params)
} else {
(self.to_string(), self.doc.map(|it| it.conv()), self.parameters)
};
let label = self.to_string();
let documentation = self.doc.map(|it| it.conv());
let parameters: Vec<ParameterInformation> = self
.parameters
let parameters: Vec<ParameterInformation> = params
.into_iter()
.map(|param| ParameterInformation {
label: ParameterLabel::Simple(param),

View File

@ -459,8 +459,12 @@ pub fn handle_signature_help(
let _p = profile("handle_signature_help");
let position = params.try_conv_with(&world)?;
if let Some(call_info) = world.analysis().call_info(position)? {
let active_parameter = call_info.active_parameter.map(|it| it as i64);
let sig_info = call_info.signature.conv();
let concise = !world.analysis().feature_flags().get("call-info.full");
let mut active_parameter = call_info.active_parameter.map(|it| it as i64);
if concise && call_info.signature.has_self_param {
active_parameter = active_parameter.map(|it| it.saturating_sub(1));
}
let sig_info = call_info.signature.conv_with(concise);
Ok(Some(req::SignatureHelp {
signatures: vec![sig_info],

View File

@ -197,7 +197,7 @@
"type": "boolean",
"description": "Whether to add parenthesis when completing functions"
},
"completion.insertion.add-argument-sippets": {
"completion.insertion.add-argument-snippets": {
"type": "boolean",
"description": "Whether to add argument snippets when completing functions"
},
@ -205,6 +205,10 @@
"type": "boolean",
"description": "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
},
"call-info.full": {
"type": "boolean",
"description": "Show function name and docs in parameter hints"
},
"notifications.workspace-loaded": {
"type": "boolean",
"description": "Whether to show `workspace loaded` message"