Rivenfall
Rivenfall

Reputation: 1263

How can I detect syntax errors due to invisible characters in Sublime Text?

The [1] is copy paste from the ruby file, and [2] is valid

[1] pry(main)> " do ".bytes
=> [32, 100, 111, 194, 160]
[2] pry(main)> " do ".bytes
=> [32, 100, 111, 32]

Ruby syntax validation only gives the last line of the file which makes it hard to find the problem

$ ruby -c class/test.rb
class/test.rb:123: syntax error, unexpected keyword_end, expecting end-of-input

Upvotes: 0

Views: 364

Answers (1)

Sravan
Sravan

Reputation: 18647

Use SublimeLinter package for sublime text to validate ruby syntax,

SublimeLinter:

This one is actually three separate packages: SublimeLinter, SublimeLinter-Ruby, and SublimeLinter-rubocop.

With these installed, Sublime lints my Ruby code as I type! If I’m not satisfied with the default rules, I can tweak style enforcement using ~.rubocop.yml. Check out the Rubocop documentation for details.

Here is the sublime package for ruby syntax

A beautiful documentation for sublime3 packages

Rubocop style violations in yellow. (If there were Ruby syntax errors, they would appear in red.)

Upvotes: 1

Related Questions