summaryrefslogtreecommitdiff
path: root/_config/200-lsp.vim
blob: 16a2751180ee192cb619d4bc1f3c773a93de18c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
UsePlugin 'vim-lsp'

let g:lsp_diagnostics_enabled = 1
let g:lsp_diagnostics_float_cursor = 1
let g:lsp_signs_enabled = 1         " enable signs
let g:lsp_diagnostics_echo_cursor = 1 " enable echo under cursor when in normal mode
" let g:lsp_ultisnips_integration = 1
" for debug
" let g:lsp_log_verbose = 1
" let g:lsp_log_file = expand('~/vim-lsp.log')
" let g:asyncomplete_log_file = expand('~/asyncomplete.log')

let g:lsp_settings = {
\  'efm-langserver': {
\    'disabled': 0,
\   },
\   'intelephense': {
\     'workspace_config': {
\       'intelephense': {
\         'stubs': [
\           'apache',
\           'bcmath',
\           'bz2',
\           'calendar',
\           'com_dotnet',
\           'Core',
\           'ctype',
\           'curl',
\           'date',
\           'dba',
\           'dom',
\           'enchant',
\           'exif',
\           'FFI',
\           'fileinfo',
\           'filter',
\           'fpm',
\           'ftp',
\           'gd',
\           'gettext',
\           'gmp',
\           'hash',
\           'iconv',
\           'imap',
\           'intl',
\           'json',
\           'ldap',
\           'libxml',
\           'mbstring',
\           'meta',
\           'mysqli',
\           'oci8',
\           'odbc',
\           'openssl',
\           'pcntl',
\           'pcre',
\           'PDO',
\           'pdo_ibm',
\           'pdo_mysql',
\           'pdo_pgsql',
\           'pdo_sqlite',
\           'pgsql',
\           'Phar',
\           'posix',
\           'pspell',
\           'readline',
\           'Reflection',
\           'session',
\           'shmop',
\           'SimpleXML',
\           'snmp',
\           'soap',
\           'sockets',
\           'sodium',
\           'SPL',
\           'sqlite3',
\           'standard',
\           'superglobals',
\           'sysvmsg',
\           'sysvsem',
\           'sysvshm',
\           'tidy',
\           'tokenizer',
\           'xml',
\           'xmlreader',
\           'xmlrpc',
\           'xmlwriter',
\           'xsl',
\           'Zend OPcache',
\           'zip',
\           'zlib',
\           'wordpress'
\   ]
\       }
\     }
\   }
\}

autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif

function! s:on_lsp_buffer_enabled() abort
    setlocal omnifunc=lsp#complete
    setlocal signcolumn=yes
    nmap <buffer> gd <plug>(lsp-definition)
    nmap <buffer> <f2> <plug>(lsp-rename)
    nmap <buffer> gD <plug>(lsp-references)
    nmap <buffer> K <plug>(lsp-hover)
    nmap <buffer> ]s <plug>(lsp-next-error)
    nmap <buffer> [s <plug>(lsp-previous-error)

endfunction

augroup lsp_install
    au!
    " call s:on_lsp_buffer_enabled only for languages that has the server registered.
    autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END