*tsuquyomi* is a Vim plugin for TypeScript.

Version: 0.6.0
Author : Quramy <yosuke.kurami@gmail.com>
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 TypeScript@v1.6.0 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 TypeScript@v2.1.0 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:
