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

Commit

Permalink
disable autocomplete with special characters
Browse files Browse the repository at this point in the history
especially comman and so on
close #83
  • Loading branch information
outsideris committed Jan 5, 2018
1 parent 113101b commit 05dffe7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion 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)
if @isJavaScript(request) and @isIgnoreInJavaScript(request)
@getJavascriptCompletions(request)
else if @isHtml(request)
if @isAttributeStart(request)
Expand All @@ -26,6 +26,17 @@ module.exports =
return true if scope.startsWith('source') and scope.endsWith('.js')
return false

isIgnoreInJavaScript: ({ scopeDescriptor }) ->
scopes = scopeDescriptor.getScopesArray()
return false 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

isHtml: ({ scopeDescriptor }) ->
for scope in scopeDescriptor.getScopesArray()
return true if scope.endsWith('.html')
Expand Down

0 comments on commit 05dffe7

Please sign in to comment.