Skip to content

Commit

Permalink
simplify the LSP server name comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
yegappan committed Sep 22, 2024
1 parent c813516 commit 0777322
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions autoload/lsp/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ enddef
# Add a LSP server for a filetype
def LspAddServer(ftype: string, lspsrv: dict<any>)
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
Expand Down

0 comments on commit 0777322

Please sign in to comment.