From 0adbce30964ae1a3813a9841153f6fadc6ba2e9a Mon Sep 17 00:00:00 2001 From: Kidon Chu Date: Sun, 21 Aug 2016 00:38:19 -0500 Subject: [PATCH 1/2] Add {{# to search pattern to allow block param component gf --- autoload/ember_tools/gf.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ember_tools/gf.vim b/autoload/ember_tools/gf.vim index 4456b34..46a3564 100644 --- a/autoload/ember_tools/gf.vim +++ b/autoload/ember_tools/gf.vim @@ -113,7 +113,7 @@ function! ember_tools#gf#TemplateComponent() return '' endif - if !ember_tools#search#UnderCursor('^\s*\%(=\|{{\)\{}\s*\zs\k\+') + if !ember_tools#search#UnderCursor('^\s*\%(=\|{{\#\|{{\)\{}\s*\zs\k\+') return '' endif From 39984b7cb70d3cc1ca0975445bc13ea818d31e83 Mon Sep 17 00:00:00 2001 From: Kidon Chu Date: Sun, 21 Aug 2016 01:15:32 -0500 Subject: [PATCH 2/2] Remove extra pipe in regex and add test --- autoload/ember_tools/gf.vim | 2 +- spec/plugin/gf_spec.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/autoload/ember_tools/gf.vim b/autoload/ember_tools/gf.vim index 46a3564..679551b 100644 --- a/autoload/ember_tools/gf.vim +++ b/autoload/ember_tools/gf.vim @@ -113,7 +113,7 @@ function! ember_tools#gf#TemplateComponent() return '' endif - if !ember_tools#search#UnderCursor('^\s*\%(=\|{{\#\|{{\)\{}\s*\zs\k\+') + if !ember_tools#search#UnderCursor('^\s*\%(=\|{{#\|{{\)\{}\s*\zs\k\+') return '' endif diff --git a/spec/plugin/gf_spec.rb b/spec/plugin/gf_spec.rb index e4123b2..db9e60f 100644 --- a/spec/plugin/gf_spec.rb +++ b/spec/plugin/gf_spec.rb @@ -144,6 +144,22 @@ expect(current_file).to eq 'app/pods/foo/bar-baz/template.hbs' end + specify "finding a component with block expression" do + touch_file 'app/components/foo/bar-baz/template.hbs' + edit_file 'app/templates/example.hbs', <<-EOF +

+ {{#foo/bar-baz param1=something}} +

Foo Bar

+ {{/foo/bar-baz}} +

+ EOF + vim.search 'foo/bar-baz' + + vim.normal 'gf' + + expect(current_file).to eq 'app/components/foo/bar-baz/template.hbs' + end + specify "finding a controller action" do edit_file 'app/controllers/foo.js', <<-EOF export default Ember.Controller.extend({