refactor to use remove_range and replace_range instead of TextEdit

This commit is contained in:
gfreezy 2019-01-20 00:38:34 +08:00
parent 64342599ca
commit 94d96b60f3
47 changed files with 619 additions and 755 deletions

View File

@ -31,7 +31,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
for field in s.fields(ctx.db) {
CompletionItem::new(
CompletionKind::Reference,
ctx,
ctx.leaf_range(),
field.name().to_string(),
)
.kind(CompletionItemKind::Field)
@ -45,7 +45,7 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty)
}
Ty::Tuple(fields) => {
for (i, _ty) in fields.iter().enumerate() {
CompletionItem::new(CompletionKind::Reference, ctx, i.to_string())
CompletionItem::new(CompletionKind::Reference, ctx.leaf_range(), i.to_string())
.kind(CompletionItemKind::Field)
.add_to(acc);
}
@ -59,10 +59,14 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty
receiver.iterate_methods(ctx.db, |func| {
let sig = func.signature(ctx.db);
if sig.has_self_param() {
CompletionItem::new(CompletionKind::Reference, ctx, sig.name().to_string())
.from_function(ctx, func)
.kind(CompletionItemKind::Method)
.add_to(acc);
CompletionItem::new(
CompletionKind::Reference,
ctx.leaf_range(),
sig.name().to_string(),
)
.from_function(ctx, func)
.kind(CompletionItemKind::Method)
.add_to(acc);
}
None::<()>
});

View File

@ -34,7 +34,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
}
})
.for_each(|(label, lookup)| {
CompletionItem::new(CompletionKind::Magic, ctx, label)
CompletionItem::new(CompletionKind::Magic, ctx.leaf_range(), label)
.lookup_by(lookup)
.add_to(acc)
});

View File

@ -9,25 +9,26 @@
pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionContext) {
// complete keyword "crate" in use stmt
let leaf_range = ctx.leaf_range();
match (ctx.use_item_syntax.as_ref(), ctx.path_prefix.as_ref()) {
(Some(_), None) => {
CompletionItem::new(CompletionKind::Keyword, ctx, "crate")
CompletionItem::new(CompletionKind::Keyword, leaf_range, "crate")
.kind(CompletionItemKind::Keyword)
.insert_text("crate::")
.add_to(acc);
CompletionItem::new(CompletionKind::Keyword, ctx, "self")
CompletionItem::new(CompletionKind::Keyword, leaf_range, "self")
.kind(CompletionItemKind::Keyword)
.add_to(acc);
CompletionItem::new(CompletionKind::Keyword, ctx, "super")
CompletionItem::new(CompletionKind::Keyword, leaf_range, "super")
.kind(CompletionItemKind::Keyword)
.insert_text("super::")
.add_to(acc);
}
(Some(_), Some(_)) => {
CompletionItem::new(CompletionKind::Keyword, ctx, "self")
CompletionItem::new(CompletionKind::Keyword, leaf_range, "self")
.kind(CompletionItemKind::Keyword)
.add_to(acc);
CompletionItem::new(CompletionKind::Keyword, ctx, "super")
CompletionItem::new(CompletionKind::Keyword, leaf_range, "super")
.kind(CompletionItemKind::Keyword)
.insert_text("super::")
.add_to(acc);
@ -37,7 +38,7 @@ pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionC
}
fn keyword(ctx: &CompletionContext, kw: &str, snippet: &str) -> CompletionItem {
CompletionItem::new(CompletionKind::Keyword, ctx, kw)
CompletionItem::new(CompletionKind::Keyword, ctx.leaf_range(), kw)
.kind(CompletionItemKind::Keyword)
.snippet(snippet)
.build()

View File

@ -15,18 +15,26 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
hir::Def::Module(module) => {
let module_scope = module.scope(ctx.db);
for (name, res) in module_scope.entries() {
CompletionItem::new(CompletionKind::Reference, ctx, name.to_string())
.from_resolution(ctx, res)
.add_to(acc);
CompletionItem::new(
CompletionKind::Reference,
ctx.leaf_range(),
name.to_string(),
)
.from_resolution(ctx, res)
.add_to(acc);
}
}
hir::Def::Enum(e) => {
e.variants(ctx.db)
.into_iter()
.for_each(|(variant_name, _variant)| {
CompletionItem::new(CompletionKind::Reference, ctx, variant_name.to_string())
.kind(CompletionItemKind::EnumVariant)
.add_to(acc)
CompletionItem::new(
CompletionKind::Reference,
ctx.leaf_range(),
variant_name.to_string(),
)
.kind(CompletionItemKind::EnumVariant)
.add_to(acc)
});
}
_ => return,

View File

@ -29,9 +29,13 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
}
})
.for_each(|(name, res)| {
CompletionItem::new(CompletionKind::Reference, ctx, name.to_string())
.from_resolution(ctx, res)
.add_to(acc)
CompletionItem::new(
CompletionKind::Reference,
ctx.leaf_range(),
name.to_string(),
)
.from_resolution(ctx, res)
.add_to(acc)
});
}
@ -46,9 +50,13 @@ fn complete_fn(
.flat_map(|scope| scopes.scopes.entries(scope).iter())
.filter(|entry| shadowed.insert(entry.name()))
.for_each(|entry| {
CompletionItem::new(CompletionKind::Reference, ctx, entry.name().to_string())
.kind(CompletionItemKind::Binding)
.add_to(acc)
CompletionItem::new(
CompletionKind::Reference,
ctx.leaf_range(),
entry.name().to_string(),
)
.kind(CompletionItemKind::Binding)
.add_to(acc)
});
}

View File

@ -1,7 +1,7 @@
use crate::completion::{CompletionItem, Completions, CompletionKind, CompletionItemKind, CompletionContext, completion_item::Builder};
fn snippet<'a>(ctx: &'a CompletionContext<'a>, label: &str, snippet: &str) -> Builder<'a> {
CompletionItem::new(CompletionKind::Snippet, ctx, label)
fn snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Builder {
CompletionItem::new(CompletionKind::Snippet, ctx.leaf_range(), label)
.snippet(snippet)
.kind(CompletionItemKind::Snippet)
}

View File

@ -1,10 +1,7 @@
use hir::PerNs;
use ra_text_edit::{
AtomTextEdit,
TextEdit,
};
use crate::completion::completion_context::CompletionContext;
use ra_syntax::TextRange;
/// `CompletionItem` describes a single completion variant in the editor pop-up.
/// It is basically a POD with various properties. To construct a
@ -18,26 +15,10 @@ pub struct CompletionItem {
kind: Option<CompletionItemKind>,
detail: Option<String>,
lookup: Option<String>,
/// The format of the insert text. The format applies to both the `insert_text` property
/// and the `insert` property of a provided `text_edit`.
insert_text: Option<String>,
insert_text_format: InsertTextFormat,
/// An edit which is applied to a document when selecting this completion. When an edit is
/// provided the value of `insert_text` is ignored.
///
/// *Note:* The range of the edit must be a single line range and it must contain the position
/// at which completion has been requested.
///
/// *Note:* If sending a range that overlaps a string, the string should match the relevant
/// part of the replacement text, or be filtered out.
text_edit: Option<AtomTextEdit>,
/// An optional array of additional text edits that are applied when
/// selecting this completion. Edits must not overlap (including the same insert position)
/// with the main edit nor with themselves.
///
/// Additional text edits should be used to change text unrelated to the current cursor position
/// (for example adding an import statement at the top of the file if the completion item will
/// insert an unqualified type).
additional_text_edits: Option<TextEdit>,
replace_range: TextRange,
delete_range: Option<TextRange>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -76,14 +57,14 @@ pub enum InsertTextFormat {
}
impl CompletionItem {
pub(crate) fn new<'a>(
pub(crate) fn new(
completion_kind: CompletionKind,
ctx: &'a CompletionContext,
replace_range: TextRange,
label: impl Into<String>,
) -> Builder<'a> {
) -> Builder {
let label = label.into();
Builder {
ctx,
replace_range,
completion_kind,
label,
insert_text: None,
@ -91,8 +72,7 @@ pub(crate) fn new<'a>(
detail: None,
lookup: None,
kind: None,
text_edit: None,
additional_text_edits: None,
delete_range: None,
}
}
/// What user sees in pop-up in the UI.
@ -114,22 +94,27 @@ pub fn lookup(&self) -> &str {
pub fn insert_text_format(&self) -> InsertTextFormat {
self.insert_text_format.clone()
}
pub fn insert_text(&self) -> String {
match &self.insert_text {
Some(t) => t.clone(),
None => self.label.clone(),
}
}
pub fn kind(&self) -> Option<CompletionItemKind> {
self.kind
}
pub fn text_edit(&mut self) -> Option<&AtomTextEdit> {
self.text_edit.as_ref()
pub fn delete_range(&self) -> Option<TextRange> {
self.delete_range
}
pub fn take_additional_text_edits(&mut self) -> Option<TextEdit> {
self.additional_text_edits.take()
pub fn replace_range(&self) -> TextRange {
self.replace_range
}
}
/// A helper to make `CompletionItem`s.
#[must_use]
pub(crate) struct Builder<'a> {
ctx: &'a CompletionContext<'a>,
pub(crate) struct Builder {
replace_range: TextRange,
completion_kind: CompletionKind,
label: String,
insert_text: Option<String>,
@ -137,76 +122,53 @@ pub(crate) struct Builder<'a> {
detail: Option<String>,
lookup: Option<String>,
kind: Option<CompletionItemKind>,
text_edit: Option<AtomTextEdit>,
additional_text_edits: Option<TextEdit>,
delete_range: Option<TextRange>,
}
impl<'a> Builder<'a> {
impl Builder {
pub(crate) fn add_to(self, acc: &mut Completions) {
acc.add(self.build())
}
pub(crate) fn build(self) -> CompletionItem {
let self_text_edit = self.text_edit;
let self_insert_text = self.insert_text;
let text_edit = match (self_text_edit, self_insert_text) {
(Some(text_edit), ..) => Some(text_edit),
(None, Some(insert_text)) => {
Some(AtomTextEdit::replace(self.ctx.leaf_range(), insert_text))
}
_ => None,
};
CompletionItem {
replace_range: self.replace_range,
label: self.label,
detail: self.detail,
insert_text_format: self.insert_text_format,
lookup: self.lookup,
kind: self.kind,
completion_kind: self.completion_kind,
text_edit,
additional_text_edits: self.additional_text_edits,
delete_range: self.delete_range,
insert_text: self.insert_text,
}
}
pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder<'a> {
pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder {
self.lookup = Some(lookup.into());
self
}
pub(crate) fn insert_text(mut self, insert_text: impl Into<String>) -> Builder<'a> {
pub(crate) fn insert_text(mut self, insert_text: impl Into<String>) -> Builder {
self.insert_text = Some(insert_text.into());
self
}
#[allow(unused)]
pub(crate) fn insert_text_format(
mut self,
insert_text_format: InsertTextFormat,
) -> Builder<'a> {
pub(crate) fn insert_text_format(mut self, insert_text_format: InsertTextFormat) -> Builder {
self.insert_text_format = insert_text_format;
self
}
pub(crate) fn snippet(mut self, snippet: impl Into<String>) -> Builder<'a> {
pub(crate) fn snippet(mut self, snippet: impl Into<String>) -> Builder {
self.insert_text_format = InsertTextFormat::Snippet;
self.insert_text(snippet)
}
pub(crate) fn kind(mut self, kind: CompletionItemKind) -> Builder<'a> {
pub(crate) fn kind(mut self, kind: CompletionItemKind) -> Builder {
self.kind = Some(kind);
self
}
#[allow(unused)]
pub(crate) fn text_edit(mut self, text_edit: AtomTextEdit) -> Builder<'a> {
self.text_edit = Some(text_edit);
self
}
#[allow(unused)]
pub(crate) fn additional_text_edits(mut self, additional_text_edits: TextEdit) -> Builder<'a> {
self.additional_text_edits = Some(additional_text_edits);
self
}
#[allow(unused)]
pub(crate) fn detail(self, detail: impl Into<String>) -> Builder<'a> {
pub(crate) fn detail(self, detail: impl Into<String>) -> Builder {
self.set_detail(Some(detail))
}
pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder<'a> {
pub(crate) fn set_detail(mut self, detail: Option<impl Into<String>>) -> Builder {
self.detail = detail.map(Into::into);
self
}
@ -214,7 +176,7 @@ pub(super) fn from_resolution(
mut self,
ctx: &CompletionContext,
resolution: &hir::Resolution,
) -> Builder<'a> {
) -> Builder {
let resolved = resolution.def_id.map(|d| d.resolve(ctx.db));
let kind = match resolved {
PerNs {
@ -259,7 +221,7 @@ pub(super) fn from_function(
mut self,
ctx: &CompletionContext,
function: hir::Function,
) -> Builder<'a> {
) -> Builder {
// If not an import, add parenthesis automatically.
if ctx.use_item_syntax.is_none() && !ctx.is_call {
if function.signature(ctx.db).params().is_empty() {
@ -274,7 +236,7 @@ pub(super) fn from_function(
}
}
impl<'a> Into<CompletionItem> for Builder<'a> {
impl<'a> Into<CompletionItem> for Builder {
fn into(self) -> CompletionItem {
self.build()
}

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.835266+00:00
Created: 2019-01-19T16:37:23.674785+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,13 +24,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "quux()$0"
}
insert_text: Some(
"quux()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.835796+00:00
Created: 2019-01-19T16:37:23.676585+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [213; 231),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,9 +24,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [213; 231),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -35,13 +37,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [213; 231),
insert: "quux()$0"
}
insert_text: Some(
"quux()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [213; 231),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.835351+00:00
Created: 2019-01-19T16:37:23.676674+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [78; 79),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,9 +24,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [78; 79),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -35,13 +37,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [78; 79),
insert: "quux($0)"
}
insert_text: Some(
"quux($0)"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [78; 79),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.819543+00:00
Created: 2019-01-19T16:37:23.630898+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,14 +71,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "continue;"
}
insert_text: Some(
"continue;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -96,14 +86,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "break;"
}
insert_text: Some(
"break;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -113,13 +101,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [54; 56),
insert: "return $0;"
}
insert_text: Some(
"return $0;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [54; 56),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.830288+00:00
Created: 2019-01-19T16:37:23.647435+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [59; 61),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [59; 61),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [59; 61),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [59; 61),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [59; 61),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [59; 61),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [59; 61),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [59; 61),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [59; 61),
insert: "return $0;"
}
insert_text: Some(
"return $0;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [59; 61),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799862+00:00
Created: 2019-01-19T16:37:23.649286+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [23; 25),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.821375+00:00
Created: 2019-01-19T16:37:23.640573+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [84; 102),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [84; 102),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [84; 102),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [84; 102),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [84; 102),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [84; 102),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [84; 102),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [84; 102),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [84; 102),
insert: "return $0"
}
insert_text: Some(
"return $0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [84; 102),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799845+00:00
Created: 2019-01-19T16:37:23.670539+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [35; 39),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,8 +24,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [35; 39),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799820+00:00
Created: 2019-01-19T16:37:23.671764+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [40; 41),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.841643+00:00
Created: 2019-01-19T16:37:23.680378+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [108; 146),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,13 +24,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [108; 146),
insert: "foo()$0"
}
insert_text: Some(
"foo()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [108; 146),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.844671+00:00
Created: 2019-01-19T16:37:23.681170+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [53; 56),
insert: "no_args()$0"
}
insert_text: Some(
"no_args()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [53; 56),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -28,13 +26,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [53; 56),
insert: "main()$0"
}
insert_text: Some(
"main()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [53; 56),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.849139+00:00
Created: 2019-01-19T16:37:23.686781+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [72; 77),
insert: "main()$0"
}
insert_text: Some(
"main()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [72; 77),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -28,13 +26,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [72; 77),
insert: "with_args($0)"
}
insert_text: Some(
"with_args($0)"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [72; 77),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.819926+00:00
Created: 2019-01-19T16:37:23.640068+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 54),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 54),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 54),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 54),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 54),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 54),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 54),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 54),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 54),
insert: "return;"
}
insert_text: Some(
"return;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 54),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.819839+00:00
Created: 2019-01-19T16:37:23.640134+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,14 +71,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "else {$0}"
}
insert_text: Some(
"else {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -96,14 +86,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "else if $0 {}"
}
insert_text: Some(
"else if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -113,13 +101,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [91; 105),
insert: "return;"
}
insert_text: Some(
"return;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [91; 105),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.822255+00:00
Created: 2019-01-19T16:37:23.640767+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [31; 65),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [31; 65),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [31; 65),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [31; 65),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [31; 65),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [31; 65),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [31; 65),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [31; 65),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [31; 65),
insert: "return $0;"
}
insert_text: Some(
"return $0;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [31; 65),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.830680+00:00
Created: 2019-01-19T16:37:23.664707+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 58),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 58),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 58),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 58),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 58),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 58),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 58),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 58),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [24; 58),
insert: "return;"
}
insert_text: Some(
"return;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [24; 58),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.819227+00:00
Created: 2019-01-19T16:37:23.639067+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: PlainText,
text_edit: Some(
AtomTextEdit {
delete: [16; 30),
insert: "crate::"
}
insert_text: Some(
"crate::"
),
additional_text_edits: None
insert_text_format: PlainText,
replace_range: [16; 30),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,9 +26,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [16; 30),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -40,13 +39,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: PlainText,
text_edit: Some(
AtomTextEdit {
delete: [16; 30),
insert: "super::"
}
insert_text: Some(
"super::"
),
additional_text_edits: None
insert_text_format: PlainText,
replace_range: [16; 30),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.822990+00:00
Created: 2019-01-19T16:37:23.643595+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [18; 20),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -23,13 +24,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: PlainText,
text_edit: Some(
AtomTextEdit {
delete: [18; 20),
insert: "super::"
}
insert_text: Some(
"super::"
),
additional_text_edits: None
insert_text_format: PlainText,
replace_range: [18; 20),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.826915+00:00
Created: 2019-01-19T16:37:23.648502+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [23; 24),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -23,13 +24,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: PlainText,
text_edit: Some(
AtomTextEdit {
delete: [23; 24),
insert: "super::"
}
insert_text: Some(
"super::"
),
additional_text_edits: None
insert_text_format: PlainText,
replace_range: [23; 24),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.821139+00:00
Created: 2019-01-19T16:37:23.640449+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "return $0;"
}
insert_text: Some(
"return $0;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.829078+00:00
Created: 2019-01-19T16:37:23.649440+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,13 +71,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [62; 100),
insert: "return $0;"
}
insert_text: Some(
"return $0;"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [62; 100),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.817204+00:00
Created: 2019-01-19T16:37:23.629020+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,13 +11,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [143; 144),
insert: "the_method($0)"
}
insert_text: Some(
"the_method($0)"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [143; 144),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.835687+00:00
Created: 2019-01-19T16:37:23.676740+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [72; 102),
insert: "quux()$0"
}
insert_text: Some(
"quux()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [72; 102),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -28,9 +26,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [72; 102),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -40,8 +39,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [72; 102),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.836102+00:00
Created: 2019-01-19T16:37:23.677905+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [100; 102),
insert: "quux()$0"
}
insert_text: Some(
"quux()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [100; 102),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -28,8 +26,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [100; 102),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799743+00:00
Created: 2019-01-19T16:37:23.666350+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [12; 14),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,8 +24,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [12; 14),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.821881+00:00
Created: 2019-01-19T16:37:23.640842+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "if $0 {}"
}
insert_text: Some(
"if $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -28,14 +26,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "match $0 {}"
}
insert_text: Some(
"match $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -45,14 +41,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "while $0 {}"
}
insert_text: Some(
"while $0 {}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -62,14 +56,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "loop {$0}"
}
insert_text: Some(
"loop {$0}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -79,14 +71,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "continue"
}
insert_text: Some(
"continue"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -96,14 +86,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "break"
}
insert_text: Some(
"break"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
},
CompletionItem {
completion_kind: Keyword,
@ -113,13 +101,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [106; 108),
insert: "return"
}
insert_text: Some(
"return"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [106; 108),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:27:14.070727+00:00
Created: 2019-01-19T16:37:23.629063+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
lookup: Some(
"file_id"
),
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [98; 102),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:29:09.355053+00:00
Created: 2019-01-19T16:37:23.629062+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
lookup: Some(
"file_id"
),
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [98; 102),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:29:09.355066+00:00
Created: 2019-01-19T16:37:23.630980+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
lookup: Some(
"file_id"
),
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [269; 273),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799765+00:00
Created: 2019-01-19T16:37:23.664242+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [45; 47),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,8 +24,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [45; 47),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.837692+00:00
Created: 2019-01-19T16:37:23.678426+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [46; 60),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,13 +24,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [46; 60),
insert: "x()$0"
}
insert_text: Some(
"x()$0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [46; 60),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:59:18.394156+00:00
Created: 2019-01-19T16:37:23.679470+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [24; 26),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.844708+00:00
Created: 2019-01-19T16:37:23.681192+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,14 +11,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [16; 18),
insert: "eprintln!(\"$0 = {:?}\", $0);"
}
insert_text: Some(
"eprintln!(\"$0 = {:?}\", $0);"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [16; 18),
delete_range: None
},
CompletionItem {
completion_kind: Snippet,
@ -28,13 +26,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [16; 18),
insert: "eprintln!(\"$0 = {:#?}\", $0);"
}
insert_text: Some(
"eprintln!(\"$0 = {:#?}\", $0);"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [16; 18),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.845616+00:00
Created: 2019-01-19T16:37:23.682017+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -13,14 +13,12 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
lookup: Some(
"tfn"
),
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [49; 79),
insert: "#[test]\nfn ${1:feature}() {\n $0\n}"
}
insert_text: Some(
"#[test]\nfn ${1:feature}() {\n $0\n}"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [49; 79),
delete_range: None
},
CompletionItem {
completion_kind: Snippet,
@ -30,13 +28,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [49; 79),
insert: "pub(crate) $0"
}
insert_text: Some(
"pub(crate) $0"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [49; 79),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:34:11.702218+00:00
Created: 2019-01-19T16:37:23.628928+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -13,8 +13,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
"u32"
),
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [84; 85),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.817216+00:00
Created: 2019-01-19T16:37:23.629043+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -13,9 +13,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
"(u32, i32)"
),
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [125; 126),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -25,13 +26,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [125; 126),
insert: "foo($0)"
}
insert_text: Some(
"foo($0)"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [125; 126),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T13:42:17.817207+00:00
Created: 2019-01-19T16:37:23.629041+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -13,9 +13,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
"(u32,)"
),
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [120; 121),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -25,13 +26,11 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text_format: Snippet,
text_edit: Some(
AtomTextEdit {
delete: [120; 121),
insert: "foo($0)"
}
insert_text: Some(
"foo($0)"
),
additional_text_edits: None
insert_text_format: Snippet,
replace_range: [120; 121),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799683+00:00
Created: 2019-01-19T16:37:23.667522+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,9 +11,10 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [11; 13),
delete_range: None
},
CompletionItem {
completion_kind: Reference,
@ -23,8 +24,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [11; 13),
delete_range: None
}
]

View File

@ -1,4 +1,4 @@
Created: 2019-01-19T11:53:16.799788+00:00
Created: 2019-01-19T16:37:23.669476+00:00
Creator: insta@0.1.4
Source: crates/ra_ide_api/src/completion/completion_item.rs
@ -11,8 +11,9 @@ Source: crates/ra_ide_api/src/completion/completion_item.rs
),
detail: None,
lookup: None,
insert_text: None,
insert_text_format: PlainText,
text_edit: None,
additional_text_edits: None
replace_range: [24; 26),
delete_range: None
}
]

View File

@ -13,6 +13,7 @@
use ra_text_edit::{AtomTextEdit, TextEdit};
use crate::{req, server_world::ServerWorld, Result};
use ra_text_edit::TextEditBuilder;
pub trait Conv {
type Output;
@ -78,19 +79,24 @@ impl ConvWith for CompletionItem {
type Ctx = LineIndex;
type Output = ::lsp_types::CompletionItem;
fn conv_with(mut self, ctx: &LineIndex) -> ::lsp_types::CompletionItem {
let text_edit = self.text_edit().map(|t| t.conv_with(ctx));
let additonal_text_edit = self
.take_additional_text_edits()
.map(|it| it.conv_with(ctx));
fn conv_with(self, ctx: &LineIndex) -> ::lsp_types::CompletionItem {
let atom_text_edit = AtomTextEdit::replace(self.replace_range(), self.insert_text());
let text_edit = (&atom_text_edit).conv_with(ctx);
let additional_text_edits = if let Some(delete_range) = self.delete_range() {
let mut builder = TextEditBuilder::default();
builder.delete(delete_range);
Some(builder.finish().conv_with(ctx))
} else {
None
};
let mut res = lsp_types::CompletionItem {
label: self.label().to_string(),
detail: self.detail().map(|it| it.to_string()),
filter_text: Some(self.lookup().to_string()),
kind: self.kind().map(|it| it.conv()),
text_edit,
additional_text_edits: additonal_text_edit,
text_edit: Some(text_edit),
additional_text_edits,
..Default::default()
};
res.insert_text_format = Some(match self.insert_text_format() {