language-ruby icon indicating copy to clipboard operation
language-ruby copied to clipboard

Wrong scope for .html.erb

Open vdhpieter opened this issue 7 years ago • 3 comments

Prerequisites

  • [x] Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
    • Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
    • Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
    • Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

Description

Currently the whole .html.erb file has source.ruby as a scope which messes up integration with other packages like: https://github.com/AtomLinter/linter-rubocop/issues/48

Edit by @rsese to add screenshots

With Tree-sitter enabled:

with-tree-sitter

Without:

without-tree-sitter

Steps to Reproduce

  1. create a .html.erb file
  2. Write some code and check the scope
  3. find source.ruby

Expected behavior:

The source should be source.embedded.ruby according to the previuous mentionned issue thread

Actual behavior:

The source is seen als a source.ruby context

Reproduces how often: [What percentage of the time does it reproduce?]

100%

Versions

atom --version Atom : 1.33.0 Electron: 2.0.11 Chrome : 61.0.3163.100 Node : 8.9.3

apm --version apm 2.1.2 npm 6.2.0 node 8.9.3 x64 atom 1.33.0 python 2.7.15 git 2.13.2

Additional Information

I cloned the repo and tried to mess arround with it but without succes...

I saw this PR https://github.com/atom/language-ruby/pull/121/files before but I see still some source.ruby tags in the file. I completly new to writing grammar plugins for atom so maybe I'm looking in the wrong place

vdhpieter avatar Dec 12 '18 14:12 vdhpieter

Thanks for the report @vdhpieter - this looks related to the move to Tree-sitter (i.e. if you disable Settings > Core > Use Tree Sitter Parsers an .erb file will open as (HTML (Ruby - ERB) again). With Tree-sitter enabled:

with-tree-sitter

Without:

without-tree-sitter

rsese avatar Jan 03 '19 02:01 rsese

@rsese thanks for the elaborated report! Is this a bug in tree-sitter then or not? Should I file it there?

vdhpieter avatar Jan 03 '19 10:01 vdhpieter

It's fine here in this repository, we can move it later if we need to (you can see the other Tree-sitter issues opened in this repository: https://github.com/atom/language-ruby/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Atree-sitter+).

rsese avatar Jan 03 '19 17:01 rsese