autoload/lsp/lsp.vim | 6 ++++-- diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index 88e0b086038627ecf674a7754ca5cc6304b12cba..1e3c93c5da6725c591477af6b5e8a773065d83cc 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -55,7 +55,7 @@ var lspservers = ftypeServerMap[ftype] # All the langauge servers with the same score are being used var bestMatches: list> = [] - var bestScore: number = 0 + var bestScore: number = -2 var bufDir = bnr->bufname()->fnamemodify(':p:h') @@ -66,7 +66,9 @@ if !lspserver.rootSearchFiles->empty() # The score is calculated by how deep the workspace root dir is, the # deeper the better. var path = util.FindNearestRootDir(bufDir, lspserver.rootSearchFiles) - score = path->strcharlen() + # subtract one to make servers with a non matching 'rootSearch' rank below + # servers without a 'rootSearch'. + score = path->strcharlen() - 1 endif if score > bestScore