-
Notifications
You must be signed in to change notification settings - Fork 72
/
tsuquyomi.txt
511 lines (424 loc) · 16.8 KB
/
tsuquyomi.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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
*tsuquyomi* is a Vim plugin for TypeScript.
Version: 0.6.0
Author : Quramy <[email protected]>
License: MIT license {{{
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.
}}}
CONTENTS *tsuquyomi-contents*
Introduction |tsuquyomi-introduction|
Install |tsuquyomi-install|
Interface |tsuquyomi-interface|
Commands |tsuquyomi-commands|
Variables |tsuquyomi-variables|
Key Mappings |tsuquyomi-key-mappings|
Functions |tsuquyomi-functions|
Examples |tsuquyomi-examples|
==============================================================================
INTRODUCTION *tsuquyomi-introduction*
Tsuquyomi works as a client for TSServer(which is an editor service bundled into TypeScript).
This plugin provides the following functions:
+ Functions to fetch information of your source codes from TSServer.
(compeletions, locations of definition or references, error, etc...)
+ Functions to start or stop the TSServer process.
==============================================================================
INSTALL *tsuquyomi-install*
Tsuquyomi requires the following:
* Vim (v.7.4.0 or later)
* Shougo/vimproc.vim (https://github.com/Shougo/vimproc.vim)
(Not required if you use vim8 or later)
* Node.js and TypeScript (v.1.5.0 or later)
First of all, if you haven't installed |vimproc|, please install it.
(Please see https://github.com/Shougo/vimproc.vim)
Secondly, install the latest version of TypeScript.
Prompt:
>
$ npm -g install typescript
<
Thirdly, locate Tsuquyomi to your Vim plugin directory.
If you use |NeoBundle| for plugin management, append the following to `.vimrc` .
>
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
NeoBundle 'Quramy/tsuquyomi'
>
And execute the Ex command |:NeoBundleInstall| .
Also, Tsuquyomi is an extension of |unite-outline|.
If you have installed |unite| and |unite-outline| , you can get the outline of
the current buffer calling ':Unite outline'.
==============================================================================
INTERFACE *tsuquyomi-interface*
------------------------------------------------------------------------------
COMMANDS *tsuquyomi-commands*
*:TsuquyomiStartServer*
*:TsuStartServer*
:TsuquyomiStartServer
Start TSServer process.
If the process is already running, this command doesn't
do anything.
*:TsuquyomiStopServer*
*:TsuStopServer*
:TsuquyomiStopServer
Stop TSServer process if it exists.
*:TsuquyomiStatusServer*
*:TsuStatusServer*
:TsuquyomiStatusServer
Show TSServer status.
When TSServer is running, the message "reading" will be
displayed.
*:TsuquyomiOpen*
*:TsuOpen*
:TsuquyomiOpen [{file} ...]
Let TSServer open {file}s.
Once TSServer opens files, you can start a variety of
operations on them.
If you omit the argument {file}, TSServer opens the current
buffer.
By default, |g:tsuquyomi_auto_open| is enabled,
so usually users don't need to exec this command manually.
*:TsuquyomiClose*
*:TsuClose*
:TsuquyomiClose [{file} ...]
Let TSServer release opened {file}s.
If you omit the argument {file}, TSServer closes the file
related to the current buffer.
*:TsuquyomiReload*
*:TsuReload*
:TsuquyomiReload [{file} ...]
Let TSServer reload files.
If you omit the argument {file}, TSServer reloads the current
buffer.
*:TsuquyomiDump*
*:TsuDump*
:TsuquyomiDump [{file} ...]
Save TSServer's buffer to files.
This command can be executed only for debugging purposes.
If you omit the argument {file}, TSServer saves the file
related to the current buffer.
Note: Dumped filename is `originalFileName` + `'.dump'` .
*:TsuquyomiDefinition*
*:TsuDefinition*
:TsuquyomiDefinition
Navigate to the location where the symbol is defined.
*:TsuquyomiSplitDefinition*
*:TsuSplitDefinition*
:TsuquyomiSplitDefinition
Split current window in two. Navigate to the location where
the symbol is defined.
*:TsuquyomiTypeDefinition*
*:TsuTypeDefinition*
:TsuquyomiTypeDefinition
Navigate to the location where the type of the symbol is
defined.
*:TsuquyomiGoBack*
*:TsuGoBack*
:TsuquyomiGoBack
Move the cursor position to the location where
the last |:TsuquyomiDefinition| or |:TsuquyomiTypeDefinition|
was called.
*:TsuquyomiImplementation*
*:TsuImplementation*
:TsuquyomiImplementation
Navigate to the locations where an interface is implemented.
The result is loaded into the |location-list| .
*:TsuquyomiReferences*
*:TsuReferences*
:TsuquyomiReferences
Navigate to the locations where the symbol is referenced.
The result is loaded into the |location-list| .
*:TsuquyomiRenameSymbol*
*:TsuRenameSymbol*
:TsuquyomiRenameSymbol
Rename the identifier under the cursor to a new name.
If the identifier is referenced by other .ts files,
you should open them before executing this command.
*:TsuquyomiRenameSymbolC*
*:TsuRenameSymbolC*
:TsuquyomiRenameSymbolC
Rename the identifier under the cursor to a new name.
This command renames the identifiers including comments.
*:TsuquyomiReloadProject*
*:TsuReloadProject*
:TsuquyomiReloadProject
Close and re-open all files opened by |:TsuquyomiOpen|.
If you change your `tsconfig.json` after opening any `*.ts` files,
you should execute this command so the changes of `tsconfig.json`
are reflected in the TSServer.
*:TsuquyomiGeterr*
*:TsuGeterr*
:TsuquyomiGeterr
Show compilation errors of current buffer in QuickFix window.
*:TsuquyomiAsynGeterr*
*:TsuAsyncGeterr*
:TsuquyomiAsyncGeterr
Show compilation errors of current buffer in QuickFix window
asynchronous.
*:TsuquyomiGeterrProject*
*:TsuGeterrProject*
:TsuquyomiGeterrProject
Show all compilation errors of your project in QuickFix window.
This command requires [email protected] or later.
*:TsuquyomiSeaarch*
*:TsuSearch*
:TsuquyomiSearch {keyword}
Search locations which contain {keyword} from project.
*:TsuquyomiQuickFix*
*:TsuQuickFix*
:TsuquyomiQuickFix
If the cursor is over an error and there is a quick fix is
for it, apply it.
This command requires [email protected] or later.
*:TsuquyomiSignatureHelp*
*:TsuSignatureHelp*
:TsuquyomiSignatureHelp
Display signature help for the method signature the cursor is
currently inside, and display the output in the preview
window. If there are multiple, overloads they will be
displayed along with any documentation.
Note that the cursor must be between the method parentheses,
or at least after the opening parenthesis of a partially
written method call.
------------------------------------------------------------------------------
VARIABLES *tsuquyomi-variables*
*g:tsuquyomi_auto_open*
g:tsuquyomi_auto_open (default 1)
Whether TSServer automatically opens the file of the current
buffer when the buffer is opened in Vim.
If you set this option to 0, you should manually exec the
|:TsuquyomiOpen| command after opening buffers.
*g:tsuquyomi_use_local_typescript*
g:tsuquyomi_use_local_typescript (default 1)
Whether to use `tsserver.js`that was installed for project
locally.
* 0: Tsuquyomi does not search `tsserver.js`.
* 1: Tsuquyomi searches the root directory(which has
`package.json`) of the project from the current directory.
Then, it searches
`node_modules/typescript/bin/tsserver.js` from the
project root.
If not hit, Tsuquyomi determines `tsserver.js` path from
|g:tsuquyomi_use_dev_node_module| option.
*g:tsuquyomi_use_dev_node_module*
g:tsuquyomi_use_dev_node_module (default 0)
Whether to use `tsserver.js` that was installed manually.
* 0: Tsuquyomi uses global installed `tsserver` command(default).
* 1: Tsuquyomi uses
`tsuquyomi/node_modules/typescript/bin/tsserver.js` .
If you use this mode, exec the following:
>
:cd ~/.vim/bundle/tsuquyomi
:!npm install
<
* 2: Tsuquyomi uses `tsserver.js` whose path is
|g:tsuquyomi_tsserver_path| .
*g:tsuquyomi_tsserver_path*
g:tsuquyomi_tsserver_path (default `''`)
If |g:tsuquyomi_use_dev_node_module| equals `2`,
user should set path of `tsserver.js` to this variable.
For example,
>
let g:tsuquyomi_use_dev_node_module = 2
let g:tsuquyomi_tsserver_path =
\ '~/typescript/built/local/tsserver.js'
<
*g:tsuquyomi_nodejs_path*
g:tsuquyomi_nodejs_path (default "node")
A path to Node.js.
*g:tsuquyomi_definition_split*
g:tsuquyomi_definition_split (default 0)
A way to open a target file when navigating with
|:TsuquyomiDefinition| or |:TsuquyomiTypeDefinition|.
* 0: |:edit|
* 1: |:split|
* 2: |:vsplit|
* 3: |:tabedit|
*g:tsuquyomi_completion_detail*
g:tsuquyomi_completion_detail (default 0)
Whether to show details of complete menu when |tsuquyomi#complete|.
This option makes sense when 'completeopt' includes "menu".
NOTE: If it's set, completions get slow.
*g:tsuquyomi_completion_case_sensitive*
g:tsuquyomi_completion_case_sensitive (default 0)
Whether to search completion case-sensitively when
|tsuquyomi#complete|.
*g:tsuquyomi_case_sensitive_imports*
g:tsuquyomi_case_sensitive_imports (default 0)
Whether to search imports case-sensitively when
|tsuquyomi#es6import#complete|.
*g:tsuquyomi_completion_preview*
g:tsuquyomi_completion_preview (default 0)
Whether to show signature in preview when |tsuquyomi#complete|.
This option makes sense when 'completeopt' includes "menu"
and "preview".
NOTE: If it's set, completions get a little slow.
*g:tsuquyomi_disable_default_mappings*
g:tsuquyomi_disable_default_mappings (default 0)
If set no keys are mapped.
*g:tsuquyomi_disable_quickfix*
g:tsuquyomi_disable_quickfix (default 0)
If set, |:TsuquyomiGeterr| isn't called when you save buffers.
*g:tsuquyomi_save_onrename*
g:tsuquyomi_save_onrename (default 0)
If set, Tsuquyomi automatically saves files in which symbols
are replaced when |:TsuquyomiRenameSymbol| is used.
If not set, Tsuquyomi shows replaced files with |:split|.
You can save them with |:wa| after your review changes.
*g:tsuquyomi_single_quote_import*
g:tsuquyomi_single_quote_import (default 0)
If set, Tsuquyomi generates import blocks using single quotes
instead of double quotes when |:TsuquyomiImport|.
*g:tsuquyomi_semicolon_import*
g:tsuquyomi_semicolon_import (default 1)
If set, Tsuquyomi generates import block using a semicolon at
the end when |:TsuquyomiImport|.
*g:tsuquyomi_baseurl_import_path*
g:tsuquyomi_baseurl_import_path (default 0)
If set, |:TsuquyomiImport| will use module paths relative to
`baseUrl` setting in tsconfig.json.
*g:tsuquyomi_javascript_support*
g:tsuquyomi_javascript_support (default 0)
If set, Tsuquyomi will also be enabled for JavaScript files.
You can further configure tsserver's behavior using
tsconfig.json or jsconfig.json in your project.
*g:tsuquyomi_ignore_missing_modules*
g:tsuquyomi_ignore_missing_modules (default 0)
If set, Tsuquyomi will ignore any error that starts with
"Cannot find module". Useful when you don't have type
definitions for all of your imports.
*g:tsuquyomi_use_vimproc*
g:tsuquyomi_use_vimproc (default 0)
If set, Tsuquyomi will use |vimproc| instead of vim8 default
jobs.
*g:tsuquyomi_locale*
g:tsuquyomi_locale (default "en")
LCID for deagonistics localization.
------------------------------------------------------------------------------
KEY MAPPINGS *tsuquyomi-key-mappings*
Normal mode key mappings.
*<Plug>(TsuquyomiDefinition)*
<Plug>(TsuquyomiDefinition)
Navigate to the location where the symbol under the cursor is
defined. See |:TsuquyomiDefinition|.
*<Plug>(TsuquyomiSplitDefinition)*
<Plug>(TsuquyomiSplitDefinition)
Split current window in two. Navigate to the location where
the symbol under the cursor is defined. See
|:TsuquyomiSplitDefinition|.
*<Plug>(TsuquyomiTypeDefinition)*
<Plug>(TsuquyomiTypeDefinition)
Navigate to the location where the type of the symbol under the
cursor is defined. See |:TsuquyomiTypeDefinition|.
<Plug>(TsuquyomiGoBack) *<Plug>(TsuquyomiGoBack)*
See |:TsuquyomiGoBack|.
*<Plug>(TsuquyomiImplementation)*
<Plug>(TsuquyomiImplementation)
Show a list of locations where the interface under the cursor is
implemented. See |:TsuquyomiImplementation|.
*<Plug>(TsuquyomiReferences)*
<Plug>(TsuquyomiReferences)
Show a list of locations where the symbol under the cursor is
referenced. See |:TsuquyomiReferences|.
*<Plug>(TsuquyomiRenameSymbol)*
<Plug>(TsuquyomiRenameSymbol)
Rename the identifier under the cursor to a new name.
See |:TsuquyomiRenameSymbol|.
*<Plug>(TsuquyomiRenameSymbolC)*
<Plug>(TsuquyomiRenameSymbolC)
Rename the identifier under the cursor to a new name.
See |:TsuquyomiRenameSymbolC|.
*<Plug>(TsuquyomiQuickFix)*
<Plug>(TsuquyomiQuickFix)
Apply quick fix under the cursor if it's available.
See |:TsuquyomiQuickFix|.
*<Plug>(TsuquyomiImport)*
<Plug>(TsuquyomiImport)
Generate ES6 import declaration whose alias is under
the cursor. See |:TsuquyomiImport|.
*<Plug>(TsuquyomiSignatureHelp)*
<Plug>(TsuquyomiSignatureHelp)
Display signature help for the method arguments under the
cursor. See |:TsuquyomiSignatureHelp|.
The following keymappings are default keymappings.
Normal mode default mappings.
{lhs} {rhs}
-------- -----------------------------
<C-]> <Plug>(TsuquyomiDefinition)
<C-W>] <Plug>(TsuquyomiSplitDefinition)
<C-W><C-]> <Plug>(TsuquyomiSplitDefinition)
<C-t> <Plug>(TsuquyomiGoBack)
<C-^> <Plug>(TsuquyomiReferences)
------------------------------------------------------------------------------
FUNCTIONS *tsuquyomi-functions*
tsuquyomi#complete *tsuquyomi#complete*
It's applicable for the 'completefunc' or 'omnifunc' option.
By default, Tsuquyomi sets this function to the 'omnifunc'
option.
If you want to customize completions, see
|tsuquyomi-examples-complete|.
tsuquyomi#balloonexpr *tsuquyomi#balloonexpr*
Returns information about the symbol under the mouse cursor for
tooltip popover window.
This is used as the rhs for 'balloonexpr'.
For example,
>
set ballooneval
autocmd BufNewFile,BufRead *.ts
\ setlocal balloonexpr=tsuquyomi#balloonexpr()
<
Note: This function works only if your Vim is compiled with
|+balloon_eval|.
tsuquyomi#hint *tsuquyomi#hint*
Returns information about the symbol under the cursor. This
function is similar to |tsuquyomi#balloonexpr|, but
works not only in GVim but also in terminal Vim.
For example,
>
autocmd FileType typescript nmap <buffer> <Leader>t :
\ <C-u>echo tsuquyomi#hint()<CR>
<
tsuquyomi#getSupportedCodeFixes *tsuquyomi#getSupportedCodeFixes*
Returns a list of all code quick fixes available.
An error whose code is in this list can be fixed via
|:TsuquyomiQuickFix| command.
Todo
==============================================================================
EXAMPLES *tsuquyomi-examples*
*tsuquyomi-examples-complete*
You can configure tsuquyomi completion, using 'completeopt' .
When completion in call of some method, show the method signature to
the preview window.
>
autocmd FileType typescript setlocal completeopt+=preview
<
When completion, don't show the popup menu of completions.
>
autocmd FileType typescript setlocal completeopt-=menu
<
Show compile errors to QuickFix window asynchronous by Vim8's Job/Channel
feature.
>
autocmd InsertLeave,BufWritePost *.ts,*.tsx call tsuquyomi#asyncGeterr()
<
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen: