From 827806534f1d68099cd8d8ec5b001740038ef34e Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 28 Jun 2017 10:11:17 -0700 Subject: [PATCH] Use first line of detail string in completion menu Fixes remaining issue in #16 Some servers send multiline detail strings in completion suggestions. Split to just the first line to avoid ugly characters and long menu. --- CHANGELOG.md | 3 ++- autoload/lsc/complete.vim | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8f57332..4a07be00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.2.2-dev +# 0.2.2 - Completion Improvements: - Bug fix: Don't leave an extra character when completing after typing 3 @@ -9,6 +9,7 @@ list. - Use the `triggerCharacters` suggested by the server instead of `.` exclusively. + - Use only the first line of suggestion detail in completion menu - Bug Fix: Send and allow a space before header content. # 0.2.1 diff --git a/autoload/lsc/complete.vim b/autoload/lsc/complete.vim index 626c243f..6cd36482 100644 --- a/autoload/lsc/complete.vim +++ b/autoload/lsc/complete.vim @@ -236,7 +236,7 @@ function! s:CompletionItem(completion_item) abort let item.kind = s:CompletionItemKind(a:completion_item.kind) endif if has_key(a:completion_item, 'detail') && a:completion_item.detail != v:null - let item.menu = a:completion_item.detail + let item.menu = split(a:completion_item.detail, "\n")[0] endif if has_key(a:completion_item, 'documentation') \ && a:completion_item.documentation != v:null