diff --git a/autoload/tsuquyomi/tsClient.vim b/autoload/tsuquyomi/tsClient.vim index 158ced4..9912b1c 100644 --- a/autoload/tsuquyomi/tsClient.vim +++ b/autoload/tsuquyomi/tsClient.vim @@ -434,7 +434,7 @@ endfunction " PARAM: {int} line The line number of the symbol's position. " PARAM: {int} offset The col number of the symbol's position. " PARAM: {0|1} findInComments Whether result contains word in comments. -" PARAM: {0|1} findInComments Whether result contains word in String literals. +" PARAM: {0|1} findInString Whether result contains word in String literals. " RETURNS: {dict} Rename information dictionary. " e.g.: " { @@ -460,7 +460,7 @@ endfunction " ] " } function! tsuquyomi#tsClient#tsRename(file, line, offset, findInComments, findInString) - " TODO findInComments and findInString parameters don't work... why? + " TODO findInString parameter does not work... why? let l:arg = {'file': a:file, 'line': a:line, 'offset': a:offset, \ 'findInComments': a:findInComments ? s:JSON.true : s:JSON.false, \ 'findInString' : a:findInString ? s:JSON.true : s:JSON.false diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index 217bdec..8b502bb 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -39,10 +39,10 @@ command! -buffer TsuquyomiGeterr :call tsuquyomi#geterr() command! -buffer TsuGeterr :call tsuquyomi#geterr() command! -buffer TsuquyomiRenameSymbol :call tsuquyomi#renameSymbol() command! -buffer TsuRenameSymbol :call tsuquyomi#renameSymbol() - -" TODO These commands don't work correctly. [#7] command! -buffer TsuquyomiRenameSymbolC :call tsuquyomi#renameSymbolWithComments() command! -buffer TsuRenameSymbolC :call tsuquyomi#renameSymbolWithComments() + +" TODO These commands don't work correctly. command! -buffer TsuquyomiRenameSymbolS :call tsuquyomi#renameSymbolWithStrings() command! -buffer TsuRenameSymbolS :call tsuquyomi#renameSymbolWithStrings() command! -buffer TsuquyomiRenameSymbolCS :call tsuquyomi#renameSymbolWithCommentsStrings() @@ -52,9 +52,9 @@ noremap (TsuquyomiDefinition) :TsuquyomiDefinition < noremap (TsuquyomiGoBack) :TsuquyomiGoBack noremap (TsuquyomiReferences) :TsuquyomiReferences noremap (TsuquyomiRenameSymbol) :TsuquyomiRenameSymbol - -" TODO These commands don't work correctly. [#7] noremap (TsuquyomiRenameSymbolC) :TsuquyomiRenameSymbolC + +" TODO These commands don't work correctly. noremap (TsuquyomiRenameSymbolS) :TsuquyomiRenameSymbolS noremap (TsuquyomiRenameSymbolCS) :TsuquyomiRenameSymbolCS diff --git a/vest/resources/renameTest.ts b/vest/resources/renameTest.ts index c358fd1..15c77e9 100644 --- a/vest/resources/renameTest.ts +++ b/vest/resources/renameTest.ts @@ -10,4 +10,11 @@ module Test { **/ var someFunc = (bar: string) => { }; + var otherFunc = () => { + var prefix; + console.log(' prefix '); + console.log(" prefix "); + console.log(` prefix `); + } + } diff --git a/vest/tsRename.spec.vim b/vest/tsRename.spec.vim index 093e0b3..ba5ef2f 100644 --- a/vest/tsRename.spec.vim +++ b/vest/tsRename.spec.vim @@ -54,7 +54,6 @@ Context Vesting.run() let file = s:Filepath.join(s:script_dir, 'vest/resources/renameTest.ts') call tsuquyomi#tsClient#tsOpen(file) let result_rename_dict = tsuquyomi#tsClient#tsRename(file, 3, 9, 0, 0) - echo result_rename_dict Should len(result_rename_dict.locs[0].locs) == 3 Should result_rename_dict.locs[0].locs[0].start.line == 4 Should result_rename_dict.locs[0].locs[0].start.offset == 13 @@ -65,5 +64,21 @@ Context Vesting.run() call tsuquyomi#tsClient#stopTss() End + It can rename variables in comments. + let file = s:Filepath.join(s:script_dir, 'vest/resources/renameTest.ts') + call tsuquyomi#tsClient#tsOpen(file) + let result_rename_dict = tsuquyomi#tsClient#tsRename(file, 11, 21, 1, 0) + Should len(result_rename_dict.locs[0].locs) == 2 + Should result_rename_dict.locs[0].locs[1].start.line == 8 + Should result_rename_dict.locs[0].locs[1].start.offset == 15 + End + + " It can rename identifiers in strings. + " let file = s:Filepath.join(s:script_dir, 'vest/resources/renameTest.ts') + " call tsuquyomi#tsClient#tsOpen(file) + " let result_rename_dict = tsuquyomi#tsClient#tsRename(file, 14, 13, 0, 1) + " Should len(result_rename_dict.locs[0].locs) == 4 + " End + End Fin