3 import './codeaction.vim'
5 # Functions related to handling LSP code lens
7 export def ProcessCodeLens(lspserver: dict<any>, codeLensItems: list<dict<any>>)
8 var text: list<string> = []
9 for i in codeLensItems->len()->range()
10 var item = codeLensItems[i]
11 if !item->has_key('command')
12 # resolve the code lens
13 item = lspserver.resolveCodeLens(item)
17 codeLensItems[i] = item
19 text->add(printf("%d. %s\t| L%s:%s", i + 1, item.command.title,
20 item.range.start.line + 1,
21 getline(item.range.start.line + 1)))
24 var choice = inputlist(['Code Lens:'] + text)
25 if choice < 1 || choice > codeLensItems->len()
29 codeaction.DoCommand(lspserver, codeLensItems[choice - 1].command)
32 # vim: tabstop=8 shiftwidth=2 softtabstop=2