Indispensable for writing a program (?). format So, this time I'm talking about formatting what was written in Ruby. (* Since it is operated with mac os and made a note, the shortcut etc. may be slightly different)
First, click the shortcut normally (alt + shift + F. Not ctrl) By default ruby doesn't format it.
By the way, I have Prettier installed as a formatter, but it seems that I can only format web languages such as html, js, ts, css and their surroundings (?). [^ a] (I just noticed that this php will also be formatted ...)
[^ a]: There seems to be a ruby version of prettier by volunteers. Maybe I'll try this too
So let's "install the formatter". (It's hard to hit a machete, only "ta" becomes hiragana)
When I look it up, Rufo seems to be good? Then, immediately install something called "Rufo --Ruby formatter".
Well, as you can see from the details, it seems that you need to install rufo.
Just hit "gem install rufo" in the terminal. ... A permission error has occurred. 「While executing gem ... (Gem::FilePermissionError)」 (I restarted the terminal without making a note. Only this one line remains)
Apparently the cause is using ruby of the system. So I use ruby which is not a system.
Reference site: What to do when a permission error occurs in gem install
Then run again with this
% gem install rufo
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
Why isn't it w I thought, I didn't run "rbenv global X.X.X". Let's read in order () When I try to execute it again, the installation is completed successfully! Then restart vscode.
The number of tabs is 2 ... I'm a little worried about whether to use it.
Recommended Posts