Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Make way for variable completions #81

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions lib/provider.coffee
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ module.exports =
scopes = request.scopeDescriptor.getScopesArray()
isSass = hasScope(scopes, 'source.sass')

if @isCompletingValue(request)
completions = @getPropertyValueCompletions(request)
else if @isCompletingPseudoSelector(request)
completions = @getPseudoSelectorCompletions(request)
else
if isSass and @isCompletingNameOrTag(request)
completions = @getPropertyNameCompletions(request)
.concat(@getTagCompletions(request))
else if not isSass and @isCompletingName(request)
completions = @getPropertyNameCompletions(request)
unless @isCompletingCustomProperty(request)
if @isCompletingValue(request)
completions = @getPropertyValueCompletions(request)
else if @isCompletingPseudoSelector(request)
completions = @getPseudoSelectorCompletions(request)
else
if isSass and @isCompletingNameOrTag(request)
completions = @getPropertyNameCompletions(request)
.concat(@getTagCompletions(request))
else if not isSass and @isCompletingName(request)
completions = @getPropertyNameCompletions(request)

if not isSass and @isCompletingTagSelector(request)
tagCompletions = @getTagCompletions(request)
Expand All @@ -55,6 +56,12 @@ module.exports =
{@pseudoSelectors, @properties, @tags} = JSON.parse(content) unless error?
return

isCompletingCustomProperty: ({scopeDescriptor}) ->
scopes = scopeDescriptor.getScopesArray()

hasScope(scopes, 'variable.css') or
hasScope(scopes, 'meta.function.variable.css')

isCompletingValue: ({scopeDescriptor, bufferPosition, prefix, editor}) ->
scopes = scopeDescriptor.getScopesArray()

Expand Down