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

Conversation

WoodyWoodsta
Copy link

Description of the Change

getSuggestions now performs an initial check for scopes indicating custom properties, and only drops into resolving additional suggestions if this is not the case.

Benefits

This allows tokens resolved as per atom/language-css#102 to be available in the custom property scopes and no other tokens (AFAIK, no other suggestions are applicable here).

Applicable Issues

#56
atom/autocomplete-plus#740

@WoodyWoodsta
Copy link
Author

Tests will be on their way as soon as I get the time.

.concat(@getTagCompletions(request))
else if not isSass and @isCompletingName(request)
completions = @getPropertyNameCompletions(request)
if not @isCompletingCustomProperty(request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be unless

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies! This is my first shot at coffeescript. It's a frightening departure from Javascript 😆

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

(hasScope(scopes, 'variable.css')) or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like these have one extra layer of parentheses that can be removed.

@50Wliu
Copy link
Contributor

50Wliu commented Mar 17, 2017

This fails when you're typing against a colon as in the following scenario: --v|:, where | represents the current cursor position. You may want to look at how the other parts of autocomplete-css handles that scenario (especially isCompletingName).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants