@@ -85,8 +85,9 @@ module.exports =
8585
8686 getJavascriptCompletions : ({ prefix, editor, bufferPosition }) ->
8787 completions = []
88+ prefix = @ getPrefix (editor, bufferPosition)
8889 for idx, tag of @completions .javascript
89- completions .push ({ text : tag, type : ' angularjs' })
90+ completions .push ({ text : tag, type : ' angularjs' , replacementPrefix : prefix })
9091 completions
9192
9293 getPreviousAttribute : (editor , bufferPosition ) ->
@@ -100,5 +101,15 @@ module.exports =
100101
101102 attributePattern .exec (editor .getTextInRange ([[bufferPosition .row , 0 ], [bufferPosition .row , quoteIndex]]))? [1 ]
102103
104+ getPrefix : (editor , bufferPosition ) ->
105+ # Whatever your prefix regex might be
106+ regex = / \$ ? [\w 0-9 _-] + $ /
107+
108+ # Get the text for the line up to the triggered buffer position
109+ line = editor .getTextInRange ([[bufferPosition .row , 0 ], bufferPosition])
110+
111+ # Match the regex to the line, and return the match
112+ line .match (regex)? [0 ] or ' '
113+
103114firstCharsEqual = (str1 , str2 ) ->
104115 str1[0 ].toLowerCase () is str2[0 ].toLowerCase ()
0 commit comments