patch 9.1.1049: insert-completed items are always sorted
Problem: insert-completed items are always sorted, although the LSP
spec[1] standard defines sortText in the returned
completionitem list. This means that the server has sorted the
results. When fuzzy is enabled, this will break the server's
sorting results.
Solution: disable sorting of candidates when "nosort" is set in
'completeopt'
[1]
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem
closes: #16501
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/option.h b/src/option.h
index a3634a6..11fefc3 100644
--- a/src/option.h
+++ b/src/option.h
@@ -530,6 +530,7 @@
#define COT_NOINSERT 0x040 // FALSE: select & insert, TRUE: noinsert
#define COT_NOSELECT 0x080 // FALSE: select & insert, TRUE: noselect
#define COT_FUZZY 0x100 // TRUE: fuzzy match enabled
+#define COT_NOSORT 0x200 // TRUE: fuzzy match without qsort score
#ifdef BACKSLASH_IN_FILENAME
EXTERN char_u *p_csl; // 'completeslash'
#endif