mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
Merge pull request #3354 from rphln/collapse-whitespaces
Collapse spaces and lines in the completion menu.
This commit is contained in:
@@ -606,11 +606,14 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
|||||||
let l:doc = l:doc.value
|
let l:doc = l:doc.value
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Collapse whitespaces and line breaks into a single space.
|
||||||
|
let l:detail = substitute(get(l:item, 'detail', ''), '\_s\+', ' ', 'g')
|
||||||
|
|
||||||
let l:result = {
|
let l:result = {
|
||||||
\ 'word': l:word,
|
\ 'word': l:word,
|
||||||
\ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')),
|
\ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')),
|
||||||
\ 'icase': 1,
|
\ 'icase': 1,
|
||||||
\ 'menu': get(l:item, 'detail', ''),
|
\ 'menu': l:detail,
|
||||||
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
|
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
|
||||||
\}
|
\}
|
||||||
" This flag is used to tell if this completion came from ALE or not.
|
" This flag is used to tell if this completion came from ALE or not.
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ Execute(Should handle Rust completion results correctly):
|
|||||||
\ {'word': 'from', 'menu': 'fn from(s: &''a str) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
\ {'word': 'from', 'menu': 'fn from(s: &''a str) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
||||||
\ {'word': 'from', 'menu': 'fn from(s: Box<str>) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
\ {'word': 'from', 'menu': 'fn from(s: Box<str>) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
||||||
\ {'word': 'from', 'menu': 'fn from(s: Cow<''a, str>) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
\ {'word': 'from', 'menu': 'fn from(s: Cow<''a, str>) -> String', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
||||||
|
\ {'word': 'to_vec', 'menu': 'pub fn to_vec(&self) -> Vec<T> where T: Clone,', 'info': '', 'kind': 'f', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
|
||||||
\],
|
\],
|
||||||
\ ale#completion#ParseLSPCompletions({
|
\ ale#completion#ParseLSPCompletions({
|
||||||
\ "jsonrpc":"2.0",
|
\ "jsonrpc":"2.0",
|
||||||
@@ -184,6 +185,11 @@ Execute(Should handle Rust completion results correctly):
|
|||||||
\ "label":"from",
|
\ "label":"from",
|
||||||
\ "kind":3,
|
\ "kind":3,
|
||||||
\ "detail":"fn from(s: Cow<'a, str>) -> String"
|
\ "detail":"fn from(s: Cow<'a, str>) -> String"
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ "label":"to_vec",
|
||||||
|
\ "kind":3,
|
||||||
|
\ "detail":"pub fn to_vec(&self) -> Vec<T>\nwhere\n T: Clone,"
|
||||||
\ }
|
\ }
|
||||||
\ ]
|
\ ]
|
||||||
\ })
|
\ })
|
||||||
|
|||||||
Reference in New Issue
Block a user