endif
endif
var popupID = popup_atcursor(text, {})
- prop_type_add('signature', {bufnr: popupID->winbufnr(), highlight: 'Title'})
+ prop_type_add('signature', {bufnr: winbufnr(popupID), highlight: 'Title'})
if hllen > 0
- prop_add(1, startcol + 1, {bufnr: popupID->winbufnr(), length: hllen, type: 'signature'})
+ prop_add(1, startcol + 1, {bufnr: winbufnr(popupID), length: hllen, type: 'signature'})
endif
enddef
d.kind = LspCompleteItemKindChar(item.kind)
endif
if item->has_key('detail')
- d.menu = item.detail
+ d.info = item.detail
endif
if item->has_key('documentation')
- d.info = item.documentation
+ d.menu = item.documentation
endif
lspserver.completeItems->add(d)
endfor
endif
# result: FoldingRange[]
+ var end_lnum: number
+ var last_lnum: number = line('$')
for foldRange in reply.result
- exe ':' .. (foldRange.startLine + 1) .. ',' .. (foldRange.endLine + 2) .. 'fold'
+ end_lnum = foldRange.endLine + 1
+ if end_lnum < foldRange.startLine + 2
+ end_lnum = foldRange.startLine + 2
+ endif
+ exe ':' .. (foldRange.startLine + 2) .. ',' .. end_lnum .. 'fold'
:foldopen!
endfor
# add a listener to track changes to this buffer
listener_add(function('lsp#bufchange_listener'), bnr)
setbufvar(bnr, '&completefunc', 'lsp#completeFunc')
- setbufvar(bnr, '&completeopt', 'menuone,preview,noinsert')
+ setbufvar(bnr, '&completeopt', 'menuone,popup,noinsert,noselect')
+ setbufvar(bnr, '&completepopup', 'border:off')
# map characters that trigger signature help
if lspserver.caps->has_key('signatureHelpProvider')
def s:initServer(lspserver: dict<any>)
var req = lspserver.createRequest('initialize')
+ # client capabilities (ClientCapabilities)
var clientCaps: dict<any> = {
workspace: {
workspaceFolders: v:true,
applyEdit: v:true,
},
textDocument: {
- foldingRange: {lineFoldingOnly: v:true}
+ foldingRange: {lineFoldingOnly: v:true},
+ completion: {
+ snippetSupport: v:true,
+ completionItem: {
+ documentationFormat: ['plaintext', 'markdown'],
+ },
+ completionItemKind: {valueSet: range(1, 25)}
+ },
+ documentSymbol: {
+ hierarchicalDocumentSymbolSupport: v:true,
+ symbolKind: {valueSet: range(1, 25)}
+ },
+ hover: {
+ contentFormat: ['plaintext', 'markdown']
+ }
},
window: {},
- general: {}
+ general: {},
}
# interface 'InitializeParams'
name: 'Vim',
version: string(v:versionlong),
}
- initparams.rootPath = getcwd()
- initparams.rootUri = LspFileToUri(getcwd())
+ var curdir: string = getcwd()
+ initparams.rootPath = curdir
+ initparams.rootUri = LspFileToUri(curdir)
initparams.workspaceFolders = {
- uri: LspFileToUri(getcwd()),
- name: getcwd()
+ name: fnamemodify(curdir, ':t'),
+ uri: LspFileToUri(curdir)
}
+ initparams.trace = 'off'
initparams.capabilities = clientCaps
req.params->extend(initparams)
# interface CompletionParams
# interface TextDocumentPositionParams
req.params->extend(s:getLspTextDocPosition())
+ # interface CompletionContext
+ req.params->extend({context: {triggerKind: 1}})
lspserver.sendMessage(req)
enddef