Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow adding extra grammar scopes as a configuration option #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

default50
Copy link

Description of changes:

This commit will add a configuration option that allows the user to enable the linter for other grammar scopes in addition to the default ones.

I'm currently using language-yaml-cloudformation plugin that enables support for CloudFormation YAML syntax and it defines a new grammar scope: source.yaml.cf. By allowing the addition of the grammar scope it makes this linter work.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -108,8 +117,17 @@ module.exports = {
'atom-cfn-lint.overrideSpecPath',
(value) => { this.overrideSpecPath = value }
),
atom.config.observe(
'atom-cfn-lint.extraGrammarScopes',
(value) => { this.extraGrammarScopes = value }

Choose a reason for hiding this comment

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

This will only work when the package is initially loaded. You will need to handle changes in this array in the observe callback here.

Over in linter-eslint we take a slightly different approach where we set the default value of the equivalent config option to be the supported list. This does allow the user to remove supported ones, but as they are only adding them most of the time we haven't had any issues with it.

Note: Removing the contents of the Array and adding the new values isn't the most efficient, but it's super simple and when there are only a few (<10) entries in the Array it isn't exactly a performance bottleneck.

Copy link
Contributor

Choose a reason for hiding this comment

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

@default50 are you able to make these changes? If not I can provide some help. Thanks for pull request.

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

Successfully merging this pull request may close these issues.

None yet

3 participants