rename completion kind

This commit is contained in:
Aleksey Kladov 2018-12-22 01:14:15 +03:00
parent 184665ff9b
commit ebb584ce66

View File

@ -7,7 +7,7 @@ pub struct CompletionItem {
lookup: Option<String>,
snippet: Option<String>,
/// Used only internally in test, to check only specific kind of completion.
kind: CompletionKind,
completion_kind: CompletionKind,
}
pub enum InsertText {
@ -34,7 +34,7 @@ pub(crate) fn new(label: impl Into<String>) -> Builder {
label,
lookup: None,
snippet: None,
kind: CompletionKind::Unspecified,
completion_kind: CompletionKind::Unspecified,
}
}
/// What user sees in pop-up in the UI.
@ -65,7 +65,7 @@ pub(crate) struct Builder {
label: String,
lookup: Option<String>,
snippet: Option<String>,
kind: CompletionKind,
completion_kind: CompletionKind,
}
impl Builder {
@ -78,7 +78,7 @@ pub(crate) fn build(self) -> CompletionItem {
label: self.label,
lookup: self.lookup,
snippet: self.snippet,
kind: self.kind,
completion_kind: self.completion_kind,
}
}
pub(crate) fn lookup_by(mut self, lookup: impl Into<String>) -> Builder {
@ -90,7 +90,7 @@ pub(crate) fn snippet(mut self, snippet: impl Into<String>) -> Builder {
self
}
pub(crate) fn kind(mut self, kind: CompletionKind) -> Builder {
self.kind = kind;
self.completion_kind = kind;
self
}
}
@ -154,7 +154,7 @@ fn normalize(expected: &str) -> String {
fn debug_render(&self, kind: CompletionKind) -> String {
let mut res = String::new();
for c in self.buf.iter() {
if c.kind == kind {
if c.completion_kind == kind {
if let Some(lookup) = &c.lookup {
res.push_str(lookup);
res.push_str(&format!(" {:?}", c.label));