hmatsuda / ruby-block Goto Github PK
View Code? Open in Web Editor NEWhighlight matching ruby block on Atom editor
Home Page: https://atom.io/packages/ruby-block
License: GNU General Public License v2.0
highlight matching ruby block on Atom editor
Home Page: https://atom.io/packages/ruby-block
License: GNU General Public License v2.0
In ruby-block\styles\ruby-block.less
:
Starting from Atom v1.13.0, the contents of atom-text-editor
elements are no longer encapsulated within a shadow DOM boundary. This means you should stop using :host
and ::shadow
pseudo-selectors, and prepend all your syntax selectors with syntax--
. To prevent breakage with existing style sheets, Atom will automatically upgrade the following selectors:
:host .line-number.ruby-block-highlight, atom-text-editor .line-number.ruby-block-highlight, atom-text-editor::shadow .line-number.ruby-block-highlight
=> :host .line-number.ruby-block-highlight, atom-text-editor .line-number.ruby-block-highlight, atom-text-editor.editor .line-number.ruby-block-highlight
:host .highlights .ruby-block-highlight .region, atom-text-editor .highlights .ruby-block-highlight .region, atom-text-editor::shadow .highlights .ruby-block-highlight .region
=> :host .highlights .ruby-block-highlight .region, atom-text-editor .highlights .ruby-block-highlight .region, atom-text-editor.editor .highlights .ruby-block-highlight .region
Automatic translation of selectors will be removed in a few release cycles to minimize startup time. Please, make sure to upgrade the above selectors as soon as possible.
When this package is installed the following happens -
When I press Control + G the go to line minibar doesn't pop up on the first time. It pops up on the second time I press the keyboard shortcut. After that, when I enter the line number, instead going to that line, the cursor moves to the editor and that number is just typed in the editor. In the gif shown below, it can be seen that when I typed 4
in the line input bar, 4
just ended up in the first line of the editor screen where my cursor was before.
Go-to-line works well with atom --safe
so the problem is not with Atom's package as confirmed by one of its developers in the following issue as well -
I would be super happy if you would support else and when as well!
Similar to the jump from the end of block to the beginning, it would be really nice if we can do it from the beginning to the end.
Right now we have CSS for the if/when/then and others but it would be nice if we could also CSS out the end too, so that it kind of matches the way that bracket-matcher works and makes it quite obvious what is going on if a user disables current line background.
if condition # Has CSS Class.
work
end # Would love to have a CSS Class for this too.
In ruby-block/styles/ruby-block.less
:
Starting from Atom v1.13.0, the contents of atom-text-editor
elements are no longer encapsulated within a shadow DOM boundary. This means you should stop using :host
and ::shadow
pseudo-selectors, and prepend all your syntax selectors with syntax--
. To prevent breakage with existing style sheets, Atom will automatically upgrade the following selectors:
:host .line-number.ruby-block-highlight, atom-text-editor .line-number.ruby-block-highlight, atom-text-editor::shadow .line-number.ruby-block-highlight
=> :host .line-number.ruby-block-highlight, atom-text-editor .line-number.ruby-block-highlight, atom-text-editor.editor .line-number.ruby-block-highlight
:host .highlights .ruby-block-highlight .region, atom-text-editor .highlights .ruby-block-highlight .region, atom-text-editor::shadow .highlights .ruby-block-highlight .region
=> :host .highlights .ruby-block-highlight .region, atom-text-editor .highlights .ruby-block-highlight .region, atom-text-editor.editor .highlights .ruby-block-highlight .region
Automatic translation of selectors will be removed in a few release cycles to minimize startup time. Please, make sure to upgrade the above selectors as soon as possible.
e.g. In the below case, it highlights while 0 <= 10 do
when cursor is at 5 line.
1 if true
2 while 0 <= 10 do
3 #
4 end
5 end
I'm on 1.32.1
I have ruby-block turned on, but am not seeing any blocks enabled. There's no highlighting of the top/bottom of blocks when the cursor is over one. And there's nothing on the bottom of Atom that indicates the line position of the start of the block. I really like this extension so I hope this can be fixed! Let me know if there's any other info I can post that can help track this down.
On the package page there is:
"Go to matching line (ctrl-g b)"
ctrl-g brings up the goto menu. This menu only allows numbers to be typed (0 - 9) so I am not able to use this shortcut feature which says I should type 'b'.
Is there something else I am meant to have done to be able to use this? If so, what? And, could these extra steps be added to the info page.
Since the https://github.com/atom/language-ruby was updated to use the tree-sitter atom/language-ruby#225 it stopped working.
Hi there,
first of all, thank you for this useful package :-) It actually works by highlighting the begin of the block when a cursor is at the end. I was wondering if/how is possible to highlight end blocks even when cursor is at the beginning.
thanks in advance for eventual replies :-)
%W(a b c).each do |v|
class_eval <<-RUBY
hello_#{v}.each do |(k, v)|
# Work
end
RUBY
end
New to submitting bug issues, but wanted to see if anyone else was experiencing the same.
By default Atom detects my .rb file as grammar for 'Ruby' file. The highlighting wasn't working until I switched from 'Ruby' to 'Ruby on Rails'.
Request:
Able to detect and use in multiple 'Ruby*' grammar detections by default or checkbox ability.
The issue is this:
With background color if the color is too light it's not obvious which line is the start of the block. If the color is too strong I can't see the code in that line. Underscore makes it be much clearer.
Atom v0.202 - OSX. I think it stopped working on v0.200. I also notice a slow down when moving to an end
in RSpec. Like when I move down from the second line to the third:
it "does something" do
expect(true).to eq(true)
end
The delay is gone if I disable this package.
Hi, thank you for this really nice package!
Is there a way to make the highlighting more visible? I can actually barely see the highlighing. I looked into the .sass file of your package, if the visiblity is set to 10% or something, but it seems to be at 100%? Thanks!
[Enter steps to reproduce:]
Atom: 1.19.2 x64
Electron: 1.6.9
OS: Mac OS X 10.11.6
Thrown From: ruby-block package 0.3.6
Uncaught Error: Cannot find module 'underscore-plus'
At module.js:472
Error: Cannot find module 'underscore-plus'
at Module._resolveFilename (module.js:470:15)
at Module._resolveFilename (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.get_Module._resolveFilename (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/module-cache.js:354:58)
at Module.require (Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/static/index.js:40:43)
at require (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/native-compile-cache.js:66:33)
at Object.loadClasses (/packages/ruby-block/lib/ruby-block.coffee:197:9)
at Object.init (/packages/ruby-block/lib/ruby-block.coffee:80:6)
at Object.subscribeToActiveTextEditor (/packages/ruby-block/lib/ruby-block.coffee:104:6)
at /packages/ruby-block/lib/ruby-block.coffee:65:73
at Function.module.exports.Emitter.simpleDispatch (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
at Workspace.didActivatePaneContainer (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/workspace.js:478:28)
at WorkspaceCenter.paneContainer.onDidActivatePane (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/workspace-center.js:12:59)
at Function.module.exports.Emitter.simpleDispatch (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:25:20)
at Emitter.module.exports.Emitter.emit (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/node_modules/event-kit/lib/emitter.js:141:34)
at PaneContainer.didActivatePane (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/pane-container.js:264:24)
at Pane.module.exports.Pane.activate (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/pane.js:911:20)
at Pane.module.exports.Pane.focus (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/pane.js:290:25)
at HTMLElement.<anonymous> (/Users/j.r.confucius/Downloads/Atom.app/Contents/Resources/app/src/pane-element.js:51:25)
-1:24.1.0 tree-view:copy (div.tool-panel.tree-view)
ruby-block 0.3.6
def foo()
bar = if true
end # highlighting this `end` shows a match on the method `def` line
end
It seems that doing an assignment from some blocks results in it not being spotted as the beginning of a block. In the above example I get def foo()
as my match for the end
for the if
block.
edit: Thanks for making this awesome plugin!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.