gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

maxLineLength + embedded grammars #473

Closed Aerijo closed 6 years ago

Aerijo commented 6 years ago

This changes two things:

  1. The setting limitLineLength has been replaced by maxLineLength. This is then set to 1000, and the related rules that were in effect are deleted because they are now redundant.

  2. The property injectionSelector is added with a value of source.embedded.jsx. This means that when the scope source.embedded.jsx is encountered in another file, it will automatically use this packages grammar for the duration of the scope. For example, the scope will be encountered in a markdown file using language-gfm if the following is present:

    ```jsx
    <jsx code>
Aerijo commented 6 years ago

Please note I haven't tested any changes, so that should be done before any merging. I don't know how good the CI specs are at catching regressions / what they look for.

gandm commented 6 years ago

Thanks. I actually put the limitLineLength to false for a reason - I allude to it in this issue https://github.com/gandm/language-babel/issues/340#issuecomment-287741583 but I cant actually remember the specifics of why I prefer my approach to the one provided by Atom.

The grammar specs are pretty thorough and they seem to pass but I never do any with extra long lines.

Aerijo commented 6 years ago

@gandm it could have been the fact that in the event a line is truncated, the rules will still be applied to the start. This would have caused the string scope to overflow, because the opening quote was seen, but not the proper end one. With the existing setup, it would hide the entire line from the parser.

The second change should be fine though. I'll fix the PR.