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

Commit

Permalink
disable js autocompleton for whitespaces
Browse files Browse the repository at this point in the history
fix #83
  • Loading branch information
outsideris committed Jan 6, 2018
1 parent 3e14da0 commit b9b935d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/provider.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports =
completions: COMPLETIONS

getSuggestions: (request) ->
if @isJavaScript(request) and @isIgnoreInJavaScript(request)
if @isJavaScript(request) and not @isIgnoreInJavaScript(request)
@getJavascriptCompletions(request)
else if @isHtml(request)
if @isAttributeStart(request)
Expand All @@ -26,16 +26,17 @@ module.exports =
return true if scope.startsWith('source') and scope.endsWith('.js')
return false

isIgnoreInJavaScript: ({ scopeDescriptor }) ->
isIgnoreInJavaScript: ({ scopeDescriptor, prefix }) ->
scopes = scopeDescriptor.getScopesArray()
return false if scopes.indexOf('punctuation.terminator.statement.js') isnt -1 or
return true if scopes.indexOf('punctuation.terminator.statement.js') isnt -1 or
scopes.indexOf('keyword.operator.assignment.js') isnt -1 or
scopes.indexOf('meta.delimiter.object.comma.js') isnt -1 or
scopes.indexOf('keyword.operator.comparison.js') isnt -1 or
scopes.indexOf('keyword.operator.ternary.js') isnt -1 or
scopes.indexOf('keyword.operator.js') isnt -1 or
scopes.indexOf('string.quoted.template.js') isnt -1
return true
scopes.indexOf('string.quoted.template.js') isnt -1 or
prefix.trim() is ''
return false

isHtml: ({ scopeDescriptor }) ->
for scope in scopeDescriptor.getScopesArray()
Expand Down

0 comments on commit b9b935d

Please sign in to comment.