summaryrefslogtreecommitdiff
path: root/lib/syntax_suggest/core_ext.rb
AgeCommit message (Collapse)Author
2024-11-15[ruby/syntax_suggest] Fix missing line break due to puts logicSchneems
In #225 it was reported that the output looks incorrect: ``` $ cat /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb def x.y.z end $ ruby /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb: --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parametersunexpected '.', ignoring it > 1 def x.y.z > 2 end ``` Specifically: ``` expected a delimiter to close the parametersunexpected '.', ignoring it ``` However this does not show up when executing the debug executable: ``` $ bin/bundle exec exe/syntax_suggest /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb --> /tmp/4a71c7e417cc9eac0971e3a2519b295c/scratch.rb expected a delimiter to close the parameters unexpected '.', ignoring it > 1 def x.y.z > 2 end ``` This is because `exe/syntax_suggest` uses STDOUT.puts while calling `ruby` with the filename uses a fake IO object represented by MiniStringIO. This class was incorrectly not adding a newline to the end of the print. The fix was to move the class to it's own file where it can be tested and then fix the behavior. close https://github.com/ruby/syntax_suggest/pull/225 https://github.com/ruby/syntax_suggest/commit/d2ecd94a3b Co-authored-by: Andy Yong <andyywz@gmail.com>
2023-06-28[ruby/syntax_suggest] [DOC] Fix method nameNobuyoshi Nakada
https://github.com/ruby/syntax_suggest/commit/08a9afb64f
2023-04-06[ruby/syntax_suggest] The annotation must end with a new lineYusuke Endoh
syntax_suggest did not work great when there is no new line at the end of the input file. Input: ``` def foo end end # No newline at end of file ``` Previous output: ``` $ ruby test.rb test.rb: --> test.rb Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ? > 1 def foo > 2 end > 3 end # No newline at end of filetest.rb:3: syntax error, unexpected `end' (SyntaxError) end # No newline at end of file ^~~ ``` Note that "test.rb:3: ..." is appended to the last line of the annotation. This change makes sure that the annotation ends with a new line. New output: ``` $ ruby test.rb test.rb: --> test.rb Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ? > 1 def foo > 2 end > 3 end # No newline at end of file test.rb:3: syntax error, unexpected `end' (SyntaxError) end # No newline at end of file ^~~ ``` https://github.com/ruby/syntax_suggest/commit/db4cf9147d
2023-01-27[ruby/syntax_suggest] Hide internal document and detail of `Kernel` monkey ↵Nobuyoshi Nakada
patching https://bugs.ruby-lang.org/issues/19285 https://github.com/ruby/syntax_suggest/commit/25ca82f8f9
2022-12-09Merge syntax_suggest masterHiroshi SHIBATA
Pick from https://github.com/ruby/syntax_suggest/commit/daee74dcb06296fa69fe8595fdff5d93d432b30d Notes: Merged: https://github.com/ruby/ruby/pull/6890
2022-12-02[ruby/syntax_suggest] Add temp support for 3.2.0-preview{3,2,1}schneems
This SyntaxError#path feature only exists in Ruby HEAD. Until it is released in a preview I want to continue to support existing releases of 3.2.0 (and also so CI will continue to work, as it still uses a preview version to execute tests). https://github.com/ruby/syntax_suggest/commit/9862032465
2022-12-02[ruby/syntax_suggest] No longer need PathnameFromMessage with SyntaxError#path.Hiroshi SHIBATA
https://bugs.ruby-lang.org/issues/19138 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> https://github.com/ruby/syntax_suggest/commit/8e1e7b3298
2022-08-19Sync SyntaxSuggestschneems
``` $ tool/sync_default_gems.rb syntax_suggest ``` Notes: Merged: https://github.com/ruby/ruby/pull/5859
close