facebookarchive / atom-ide-ui

A collection of user interfaces for Atom IDE.
http://ide.atom.io
Other
936 stars 79 forks source link

atom-ide-ui not triggering for embedded scopes #144

Open Arcanemagus opened 6 years ago

Arcanemagus commented 6 years ago

Description

atom-ide-ui is only considering the file's grammar scope, not the scopes at the cursor position(s).

Expected Behavior

atom-ide-ui should respect a Linter provider's grammarScopes property. The contents of this can change at any time (but the reference should stay the same), and this should be handled at the cursor level. Meaning if the user has any cursor within a scope denoted in grammarScopes then the related Linter providers are triggered.

Actual Behavior

atom-ide-ui fails to trigger providers which don't list the file's "main" grammar in their scopes. For example linter-eslint allows linting of the JavaScript within HTML files if you add source.js.embedded.html to the list of allowed scopes (either manually or with the "Lint HTML Files" option), and then put the cursor within a section of JavaScript code and request a lint() (after configuring ESLint itself to support this of course). This works just fine with linter, but with atom-ide-ui the lint() method of linter-eslint is never called in this setup.

If you add text.html.basic to linter-eslint's scopes manually, then atom-ide-ui will request a lint() on the file, but that is incorrect since linter-eslint has no idea how to lint HTML, it only understands embedded JavaScript.

Versions

Additional Details

This was originally reported in https://github.com/AtomLinter/linter-eslint/issues/1071 and sounds like it might be the issue behind #136.

Installed packages ``` Community Packages (80) C:\Users\abneyl\.atom\packages ├── atom-beautify@0.30.9 ├── atom-ide-ui@0.7.1 ├── atom-material-ui@2.1.1 ├── autocomplete-lua@0.9.0 ├── busy-signal@1.4.3 (disabled) ├── docblockr@0.13.5 ├── editorconfig@2.2.2 ├── file-watcher@1.2.6 (disabled) ├── highlight-selected@0.13.1 ├── ide-flowtype@0.17.6 ├── ide-php@0.7.4 ├── ide-python@0.5.0 ├── ide-typescript@0.7.2 ├── intentions@1.1.5 (disabled) ├── language-ansible@0.2.1 ├── language-chef@0.11.0 ├── language-cjson@0.0.1 ├── language-docker@1.1.8 ├── language-elixir@0.20.3 ├── language-erlang@3.2.0 ├── language-fortran@2.1.6 ├── language-gettext@0.6.1 ├── language-glsl@2.0.4 ├── language-haml@0.25.2 ├── language-haskell@1.17.3 ├── language-icinga2@0.4.1 ├── language-ini@1.19.0 ├── language-jade@0.7.2 ├── language-jolie@0.5.0 ├── language-kotlin@0.5.0 ├── language-livescript@0.0.3 ├── language-lua@0.9.11 ├── language-moonscript@1.7.1 ├── language-postcss@1.3.1 ├── language-powershell@4.0.0 ├── language-pug@0.0.21 ├── language-puppet@0.23.0 ├── language-r@0.4.2 ├── language-reg@0.0.0 ├── language-rust@0.4.12 ├── language-swift@0.5.0 ├── language-terraform@0.8.1 ├── language-vue@0.23.1 ├── linter@2.2.0 ├── linter-coffeelint@1.3.1 ├── linter-eslint@8.4.0 ├── linter-flake8@2.3.0 ├── linter-htmlhint@1.4.0 ├── linter-js-standard@4.2.0 ├── linter-js-yaml@1.2.8 ├── linter-jsonlint@1.3.0 ├── linter-markdown@5.2.0 ├── linter-perl@0.8.1 ├── linter-perlcritic@2.0.0 ├── linter-php@1.5.1 ├── linter-phpcs@1.6.8 ├── linter-phpmd@2.0.0 ├── linter-proselint@3.3.0 ├── linter-pylama@0.9.5 ├── linter-pylint@2.1.0 ├── linter-rails-best-practices@0.2.2 (disabled) ├── linter-reek@2.2.2 ├── linter-rubocop@2.2.0 ├── linter-ruby@1.2.6 ├── linter-stylelint@4.2.0 ├── linter-tidy@2.3.1 ├── linter-ui-default@1.6.10 ├── linter-ui-plus@0.3.2 (disabled) ├── mapfile-grammar@0.1.0 ├── minimap@4.29.7 ├── minimap-git-diff@4.3.1 ├── minimap-highlight-selected@4.6.1 ├── minimap-linter@2.1.3 ├── minimap-selection@4.5.0 ├── sequential-number@0.5.0 ├── sort-lines@0.18.0 ├── tab-control@0.6.10 ├── teletype@0.5.0 ├── toggle-quotes@1.1.0 └── trailing-spaces@0.4.0 ```
hansonw commented 6 years ago

Ah interesting, I didn't know grammarScopes were interpreted this way by linter... that makes things a bit more difficult, as we've always assumed that it referred to the grammar on the TextEditor.

Arcanemagus commented 6 years ago

I guess it's not explicit in the type documentation, but it's how we handled things like the embedded scopes that triggered this discovery. I've got a huge backlog of things for the AtomLinter org or I'd look into how to fix it!

IanVS commented 5 years ago

Hi, now that tree-sitter is rolling out to more and more people, this is causing users of linter-eslint (and maybe other packages) serious confusion. Any chance it can get some eyes? Or if not, maybe some suggestions on how to go about fixing this, so the community could step up?