Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit b9b935d

Browse files
committed
disable js autocompleton for whitespaces
fix #83
1 parent 3e14da0 commit b9b935d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎lib/provider.coffee

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports =
1111
completions: COMPLETIONS
1212

1313
getSuggestions: (request) ->
14-
if @isJavaScript(request) and @isIgnoreInJavaScript(request)
14+
if @isJavaScript(request) and not @isIgnoreInJavaScript(request)
1515
@getJavascriptCompletions(request)
1616
else if @isHtml(request)
1717
if @isAttributeStart(request)
@@ -26,16 +26,17 @@ module.exports =
2626
return true if scope.startsWith('source') and scope.endsWith('.js')
2727
return false
2828

29-
isIgnoreInJavaScript: ({ scopeDescriptor }) ->
29+
isIgnoreInJavaScript: ({ scopeDescriptor, prefix }) ->
3030
scopes = scopeDescriptor.getScopesArray()
31-
return false if scopes.indexOf('punctuation.terminator.statement.js') isnt -1 or
31+
return true if scopes.indexOf('punctuation.terminator.statement.js') isnt -1 or
3232
scopes.indexOf('keyword.operator.assignment.js') isnt -1 or
3333
scopes.indexOf('meta.delimiter.object.comma.js') isnt -1 or
3434
scopes.indexOf('keyword.operator.comparison.js') isnt -1 or
3535
scopes.indexOf('keyword.operator.ternary.js') isnt -1 or
3636
scopes.indexOf('keyword.operator.js') isnt -1 or
37-
scopes.indexOf('string.quoted.template.js') isnt -1
38-
return true
37+
scopes.indexOf('string.quoted.template.js') isnt -1 or
38+
prefix.trim() is ''
39+
return false
3940

4041
isHtml: ({ scopeDescriptor }) ->
4142
for scope in scopeDescriptor.getScopesArray()

0 commit comments

Comments
 (0)