-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ddu-source-lsp.txt
279 lines (218 loc) · 7.34 KB
/
ddu-source-lsp.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
*ddu-source-lsp.txt* ddu source for any lsp client
Author : uga-rosa
License : MIT license
CONTENTS *ddu-source-lsp-contents*
Introduction |ddu-source-lsp-introduction|
Install |ddu-source-lsp-install|
Examples |ddu-source-lsp-examples|
Params |ddu-source-lsp-params|
Supported methods |ddu-source-lsp-supported-methods|
FAQ |ddu-source-lsp-faq|
==============================================================================
INTRODUCTION *ddu-source-lsp-introduction*
Ddu source for lsp.
See |ddu-kind-lsp| for available item actions.
Supported lsp clients are:
- nvim-lsp (neovim's built-in client)
- coc.nvim (https://github.com/neoclide/coc.nvim)
- vim-lsp (https://github.com/prabirshrestha/vim-lsp)
- lspoints (https://github.com/kuuote/lspoints)
==============================================================================
INSTALL *ddu-source-lsp-install*
Please install "ddu.vim" and "denops.vim".
https://github.com/Shougo/ddu.vim
https://github.com/vim-denops/denops.vim
==============================================================================
EXAMPLES *ddu-source-lsp-examples*
>
call ddu#custom#patch_global(#{
\ kindOptions: #{
\ lsp: #{
\ defaultAction: 'open',
\ },
\ lsp_codeAction: #{
\ defaultAction: 'apply',
\ },
\ },
\})
call ddu#start(#{
\ sync: v:true,
\ sources: [#{
\ name: 'lsp_definition',
\ }],
\ uiParams: #{
\ ff: #{
\ immediateAction: 'open',
\ },
\ }
\})
call ddu#start(#{
\ sources: [#{
\ name: 'lsp_workspaceSymbol',
\ }],
\ sourceOptions: #{
\ lsp: #{
\ volatile: v:true,
\ },
\ },
\ uiParams: #{
\ ff: #{
\ ignoreEmpty: v:false
\ },
\ }
\})
call ddu#start(#{
\ sources: [#{
\ name: 'lsp_callHierarchy',
\ params: #{
\ method: 'callHierarchy/outgoingCalls',
\ }
\ }],
\ uiParams: #{
\ ff: #{
\ displayTree: v:true,
\ startFilter: v:false,
\ },
\ }
\})
<
==============================================================================
AVAILABLE SOURCES *ddu-source-lsp-available-sources*
*ddu-source-lsp_definition*
- lsp_definition
This lists the definition locations of a symbol at the cursor
position. The following methods are integrated. Which one to use can
be specified in params (|ddu-source-lsp-param-method|).
- textDocument/definition
- textDocument/typeDefinition
- textDocument/declaration
- textDocument/implementation
*ddu-source-lsp_references*
- lsp_references
This lists project-wide references for the symbol denoted by the
cursor position. See also |ddu-source-lsp-params-includeDeclaration|.
*ddu-source-lsp_documentSymbol*
- lsp_documentSymbol
This lists the document symbols in the current buffer.
By setting |ddu-ui-ff-param-displayTree|, class methods, etc. can be
displayed in a tree structure (the language server must support this).
*ddu-source-lsp_workspaceSymbol*
- lsp_workspaceSymbol
This lists the document symbols in the current workspace. The query
option (|ddu-source-lsp-params-query|) is used to filter the symbols.
The |ddu-source-option-volatile| can also be used, in which case the
query option is ignored.
*ddu-source-lsp_callHierarchy*
- lsp_callHierarchy
This lists the call hierarchy in a tree structure. Use
|ddu-ui-ff-action-expandItem| to expand the tree. The following
methods are integrated. Which one to use can be specified in params
(|ddu-source-lsp-param-method|).
- callHierarchy/incomingCalls
- callHierarchy/outgoingCalls
For a function calling hierarchy structure as depicted below,
>
function foo() {
bar();
}
function bar() {
baz();
}
function baz() {}
<
the respective call hierarchy trees would look like this:
- incomingCalls
- baz
- bar
- foo
- outgoingCalls
- foo
- bar
- baz
*ddu-source-lsp_typeHierarchy*
- lsp_typeHierarchy
This lists the type hierarchy in a tree structure. Use
|ddu-ui-ff-action-expandItem| to expand the tree. The following
methods are integrated. Which one to use can be specified in params
(|ddu-source-lsp-param-method|).
- typeHierarchy/supertypes
- typeHierarchy/subtypes
For a class inheritance hierarchy structure as depicted below,
>
class foo {};
class bar : foo {};
class baz : bar {};
<
the respective call hierarchy trees would look like this:
- supertypes
- baz
- bar
foo
- subtypes
- foo
- bar
baz
*ddu-source-lsp_codeAction*
- lsp_codeAction
This lists the available code actions. Executable code actions are
identified from the current selection. To accurately convey the
selection, you must call |ddu#start()| using |<Cmd>|.
You can view the changes that will be made by applying a code action
using the preview feature.
A dedicated |ddu-kinds|, called `lsp_codeAction`, is provided. The only
possible action for an item is 'apply'.
==============================================================================
PARAMS *ddu-source-lsp-params*
*ddu-source-lsp-param-clientName*
clientName (string)
Available in all sources.
This parameter specifies the lsp client to be used. The available
options are:
- nvim-lsp: Neovim's built-in lsp client.
- coc.nvim: https://github.com/neoclide/coc.nvim
- vim-lsp: https://github.com/prabirshrestha/vim-lsp
- lspoints: https://github.com/kuuote/lspoints
See also |g:ddu_source_lsp_clientName|.
Default: "nvim-lsp"
*ddu-source-lsp-param-method*
method (string)
Available in |ddu-source-lsp_definition| and
|ddu-source-lsp_callHierarchy|. The method to be invoked.
Default:
"textDocument/definition" (lsp_definition)
"callHierarchy/incomingCalls" (lsp_callHierarchy)
*ddu-source-lsp-params-includeDeclaration*
includeDeclaration (boolean)
Available in |ddu-source-lsp_references|.
Whether to include the declaration of the current symbol.
Default: true
*ddu-source-lsp-params-query*
query (string)
Available in |ddu-source-lsp_workspaceSymbol|.
A query string is used to filter symbols. Clients may send an empty
string to request all symbols. To dynamically filter, use
|ddu-source-option-volatile|.
Note: While the Language Server Protocol specification allows for an
empty query, certain language server implementations may not return
any results in such instances.
Default: ""
*ddu-source-lsp-params-autoExpandSingle*
autoExpandSingle (boolean)
Available in |ddu-source-lsp_callHierarchy| and
|ddu-source-lsp_typeHierarchy|.
If there is only one item when you open, expand automatically.
Default: true
==============================================================================
VARIABLES *ddu-source-lsp-variables*
*g:ddu_source_lsp_clientName* *b:ddu_source_lsp_clientName*
g:ddu_source_lsp_clientName
b:ddu_source_lsp_clientName
Change the default clientName at once. b:ddu_source_lsp_clientName has
priority over.
==============================================================================
FREQUENTLY ASKED QUESTIONS (FAQ) *ddu-source-lsp-faq*
Q: I want to skip selection when there is only one candidate, close the UI and
jump automatically.
A: Use |ddu-ui-ff-param-immediateAction|.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: