From 077732274045ca963f53f0eca19abcb383be9f8f Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sat, 21 Sep 2024 17:01:56 -0700 Subject: [PATCH] simplify the LSP server name comparison --- autoload/lsp/lsp.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index 24cf5895..d6e0d54c 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -91,11 +91,10 @@ enddef # Add a LSP server for a filetype def LspAddServer(ftype: string, lspsrv: dict) var lspsrvlst = ftypeServerMap->has_key(ftype) ? ftypeServerMap[ftype] : [] - for l in lspsrvlst - if l['name'] == lspsrv['name'] + if util.Indexof(lspsrvlst, (_, v) => v.name == lspsrv.name) != -1 + # LSP server already added for this file type return - endif - endfor + endif lspsrvlst->add(lspsrv) ftypeServerMap[ftype] = lspsrvlst enddef