File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,9 @@ component_re = re.compile('\.(?:controller|directive|service|factory|provider)\(
8
8
DEFAULT_NAME = ' appName'
9
9
DEFAULT_TYPE_NAME = ' type'
10
10
DEFAULT_COMPONENT_NAME = ' componentName'
11
- CHECK_LINES = 20
12
11
13
12
def bufText ():
14
- return ' \n ' .join(vim.current.window.buffer[:CHECK_LINES ])
13
+ return ' \n ' .join(vim.current.window.buffer[:vim.current.window.cursor[ 0 ] + 1 ])
15
14
16
15
def get_ng_component_of (snip ):
17
16
text = bufText()
@@ -25,23 +24,23 @@ def get_ng_type(snip, **kwargs):
25
24
text = kwargs.get(' text' , bufText())
26
25
res = type_re.findall(text)
27
26
if len (res) > 0 :
28
- snip.rv += res[0 ]
27
+ snip.rv += res[len (res) - 1 ]
29
28
else :
30
29
snip.rv += DEFAULT_TYPE_NAME
31
30
32
31
def get_ng_component (snip , ** kwargs ):
33
32
text = kwargs.get(' text' , bufText())
34
33
res = component_re.findall(text)
35
34
if len (res) > 0 :
36
- snip.rv += res[0 ]
35
+ snip.rv += res[len (res) - 1 ]
37
36
else :
38
37
snip.rv += DEFAULT_COMPONENT_NAME
39
38
40
39
def get_ng_module (snip , ** kwargs ):
41
40
text = kwargs.get(' text' , bufText())
42
41
res = mod_re.findall(text)
43
42
if len (res) > 0 :
44
- snip.rv += res[0 ]
43
+ snip.rv += res[len (res) - 1 ]
45
44
else :
46
45
snip.rv += DEFAULT_NAME
47
46
endglobal
You can’t perform that action at this time.
0 commit comments