From 24fda01a0e50fedba1b3f893142e3da49c36d31b Mon Sep 17 00:00:00 2001 From: Alvin Chan Date: Mon, 31 Dec 2018 14:29:42 -0700 Subject: [PATCH 1/3] Add associated line text on ALEFindReferences results for TypeScript --- autoload/ale/references.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/ale/references.vim b/autoload/ale/references.vim index d00a1fa9..dc0b8df2 100644 --- a/autoload/ale/references.vim +++ b/autoload/ale/references.vim @@ -27,6 +27,7 @@ function! ale#references#HandleTSServerResponse(conn_id, response) abort \ 'filename': l:response_item.file, \ 'line': l:response_item.start.line, \ 'column': l:response_item.start.offset, + \ 'match': trim(l:response_item.lineText), \}) endfor From f534db1ef944e4af102cfb810eab23460cd4ffdc Mon Sep 17 00:00:00 2001 From: Alvin Chan Date: Mon, 31 Dec 2018 14:54:36 -0700 Subject: [PATCH 2/3] Replace `trim` with `substitute` for compatibility (Vim <8.0.1630) --- autoload/ale/references.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ale/references.vim b/autoload/ale/references.vim index dc0b8df2..24267bb4 100644 --- a/autoload/ale/references.vim +++ b/autoload/ale/references.vim @@ -27,7 +27,7 @@ function! ale#references#HandleTSServerResponse(conn_id, response) abort \ 'filename': l:response_item.file, \ 'line': l:response_item.start.line, \ 'column': l:response_item.start.offset, - \ 'match': trim(l:response_item.lineText), + \ 'match': substitute(l:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', ''), \}) endfor From 5792bd6e29eb21d129df6f26b08ae60be217be60 Mon Sep 17 00:00:00 2001 From: Alvin Chan Date: Mon, 31 Dec 2018 14:59:50 -0700 Subject: [PATCH 3/3] Update FindReferences tests --- test/test_find_references.vader | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_find_references.vader b/test/test_find_references.vader index 88b2d762..14b5e37b 100644 --- a/test/test_find_references.vader +++ b/test/test_find_references.vader @@ -135,9 +135,9 @@ Execute(Results should be shown for tsserver responses): AssertEqual \ [ - \ {'filename': '/foo/bar/app.ts', 'column': 9, 'line': 9}, - \ {'filename': '/foo/bar/app.ts', 'column': 3, 'line': 804}, - \ {'filename': '/foo/bar/other/app.ts', 'column': 3, 'line': 51}, + \ {'filename': '/foo/bar/app.ts', 'column': 9, 'line': 9, 'match': 'import {doSomething} from ''./whatever'''}, + \ {'filename': '/foo/bar/app.ts', 'column': 3, 'line': 804, 'match': 'doSomething()'}, + \ {'filename': '/foo/bar/other/app.ts', 'column': 3, 'line': 51, 'match': 'doSomething()'}, \ ], \ g:item_list AssertEqual {}, ale#references#GetMap()