-
Notifications
You must be signed in to change notification settings - Fork 5
/
vim-lsp-ale.txt
213 lines (158 loc) · 8.33 KB
/
vim-lsp-ale.txt
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
*vim-lsp-ale.txt* Bridge between vim-lsp and ALE
Author: rhysd <https://rhysd.github.io>
CONTENTS *vim-lsp-ale-contents*
Introduction |vim-lsp-ale-introduction|
Install |vim-lsp-ale-install|
Usage |vim-lsp-ale-usage|
Variables |vim-lsp-ale-variables|
Functions |vim-lsp-ale-functions|
Issues |vim-lsp-ale-issues|
License |vim-lsp-ale-license|
==============================================================================
INTRODUCTION *vim-lsp-ale-introduction*
*vim-lsp-ale* is a plugin for bridge between |vim-lsp| and |ale|.
When using ALE and vim-lsp, both plugins run language server process
respectively. It's resource consuming and may cause some issues due to
multiple server processes running at the same time.
|vim-lsp-ale| solves the problem by getting diagnostics results from vim-lsp
and by sending them to ALE. It means vim-lsp can be handled as one of linters
supported by ALE.
It's also possible to disable LSP features in ALE and use both ALE and
vim-lsp's |:LspDocumentDiagnostics| together. But managing linter results
with multiple plugins is complicated and confusing since behaviors of each
plugins are not persistent.
Screencast: https://github.com/rhysd/ss/blob/master/vim-lsp-ale/main.gif
==============================================================================
INSTALL *vim-lsp-ale-install*
Install |ale|, |vim-lsp| and |vim-lsp-ale| with your favorite plugin manager
or using |:packadd|.
The following is an example using vim-plug.
>
Plug 'dense-analysis/ale'
Plug 'prabirshrestha/vim-lsp'
Plug 'rhysd/vim-lsp-ale'
<
Repositories:
- ALE: https://github.com/dense-analysis/ale/
- vim-lsp: https://github.com/prabirshrestha/vim-lsp
- vim-lsp-ale: https://github.com/rhysd/vim-lsp-ale
==============================================================================
USAGE *vim-lsp-ale-usage*
Register LSP servers you want to use with |lsp#register_server()| and set
"vim-lsp" linter to |g:ale_linters| for filetypes you want to check with
vim-lsp.
The following example configures gopls and golint to check Go sources. ALE
will automatically reports diagnostics results from gopls and lint errrors
from golint when you're writing Go source code.
>
if executable('gopls')
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'gopls',
\ 'cmd': ['gopls'],
\ 'allowlist': ['go', 'gomod'],
\ })
endif
let g:ale_linters = {
\ 'go': ['vim-lsp', 'golint'],
\ }
<
gopls: https://github.com/golang/tools/tree/master/gopls
vim-lsp-ale configures vim-lsp and ALE automatically. You don't need to setup
various variables for them.
vim-lsp-ale automatically does:
- disable showing diagnostics results from vim-lsp since ALE will show the
results
- disable LSP support of ALE since vim-lsp handles all LSP requests/responses
If you don't want them to be done automatically, see
|g:lsp_ale_auto_config_vim_lsp| and |g:lsp_ale_auto_config_ale|
==============================================================================
VARIABLES *vim-lsp-ale-variables*
Behavior of vim-lsp-ale can be customized with some global variables.
------------------------------------------------------------------------------
*g:lsp_ale_auto_config_vim_lsp* (Default: |v:true|)
When |v:true| is set, vim-lsp-ale automatically sets several variables
for configuring vim-lsp not to show diagnostics results in vim-lsp side.
At the time of writing, setting |v:true| is the same as:
>
let g:lsp_diagnostics_enabled = 1
let g:lsp_diagnostics_echo_cursor = 0
let g:lsp_diagnostics_float_cursor = 0
let g:lsp_diagnostics_highlights_enabled = 0
let g:lsp_diagnostics_signs_enabled = 0
let g:lsp_diagnostics_virtual_text_enabled = 0
<
When |v:false| is set, vim-lsp-ale does not set any variables to configure
vim-lsp so that you can configure them by yourself.
------------------------------------------------------------------------------
*g:lsp_ale_auto_config_ale* (Default: |v:true|)
When |v:true| is set, vim-lsp-ale automatically sets several variables
for configuring ALE not to start LSP server process.
At the time of writing, setting |v:true| is the same as:
>
let g:ale_disable_lsp = 1
<
When |v:false| is set, vim-lsp-ale does not set any variables to configure
ALE so that you can configure them by yourself.
------------------------------------------------------------------------------
*g:lsp_ale_auto_enable_linter* (Default: |v:true|)
When |v:true| is set, vim-lsp-ale automatically enables itself as a linter for
all filetypes. It does not modify |g:ale_linters|.
When |v:false| is set, vim-lsp-ale is only active when configured as a linter
for a filetype:
>
let g:ale_linters = {
\ 'go': ['vim-lsp'],
\ 'lua': ['vim-lsp'],
\ 'python': ['vim-lsp'],
\ }
<
------------------------------------------------------------------------------
*g:lsp_ale_diagnostics_severity* (Default: "information")
Severity level of reported diagnostics results. Possible values are "error",
"warning", "information", "hint". Diagnostics results will be filtered by the
severity set to this variable.
For example, when "warning" is set, "error"/"warning" results are shown
and "information"/"hint" results are not shown.
==============================================================================
FUNCTIONS *vim-lsp-ale-functions*
------------------------------------------------------------------------------
lsp#ale#enable() *lsp#ale#enable*
Enables bridge between vim-lsp and ALE. This function is automatically called
when |lsp_setup| autocmd event is triggered by vim-lsp. So basically you don't
need to call this function.
------------------------------------------------------------------------------
lsp#ale#disable() *lsp#ale#disable*
Disables bridge between vim-lsp and ALE. After this function is called,
diagnostics results will no longer be sent to ALE until |lsp#ale#enable| is
called again.
------------------------------------------------------------------------------
lsp#ale#enabled() *lsp#ale#enabled*
Returns whether bridge between vim-lsp and ALE is enabled.
==============================================================================
ISSUES *vim-lsp-ale-issues*
When you find some issues or you have some feature requests to vim-lsp-ale,
visit GitHub repository page and make a new issue:
https://github.com/rhysd/vim-lsp-ale/issues/new
==============================================================================
LICENSE *vim-lsp-ale-license*
vim-lsp-ale is distributed under the MIT license.
>
The MIT License (MIT)
Copyright (c) 2021 rhysd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<
==============================================================================
vim:tw=78:ts=8:ft=help:norl:et:fen:fdl=0: