This repository was archived by the owner on Oct 13, 2021. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 75
Customizing LSP label
        haorenW1025 edited this page Jun 8, 2020 
        ·
        1 revision
      
    - 
NOTE This is not a feature in completion-nvim, it also work for the defaultomnifunc.
- You can customize your kindandsymbollabels in completion menus withon_attach, even in a server basis.
- See the default labels in runtime/lua/vim/lsp/protocol.luaof neovim's source code.
- Here is an example of customizing labels in texlabprovided by Clason.
local lsp = require'nvim_lsp'
local protocol = require'vim.lsp.protocol'
local function texlab_attach()
    require'completion'.on_attach()
    protocol.SymbolKind = {
        'file';
        'sec';
        'fold';
        '';
        'class';
        'float';
        'lib';
        'field';
        'label';
        'enum';
        'misc';
        'cmd';
        'thm';
        'equ';
        'strg';
        'arg';
        '';
        '';
        'PhD';
        '';
        '';
        'item';
        'book';
        'artl';
        'part';
        'coll';
    }
    protocol.CompletionItemKind = {
        'string';
        '';
        '';
        '';
        'field';
        '';
        'class';
        'misc';
        '';
        'library';
        'thesis';
        'argument';
        '';
        '';
        'snippet';
        'color';
        'file';
        '';
        'folder';
        '';
        '';
        'book';
        'article';
        'part';
        'collect';
    }
end
lsp.texlab.setup{
    cmd = {vim.fn.stdpath("cache")..'/nvim_lsp/texlab'},
    on_attach=texlab_attach
}