summaryrefslogtreecommitdiff
path: root/lib/irb
AgeCommit message (Collapse)Author
2024-02-16[ruby/irb] Support repeating debugger input by passing empty inputStan Lo
to it (https://github.com/ruby/irb/pull/856) * Test IRB's behaviour with empty input * Handle empty input and pass it to debugger Since `rdbg` accepts empty input to repeat the previous command, IRB should take empty input in `irb:rdbg` sessions and pass them to the debugger. Currently, IRB simply ignores empty input and does nothing. This commit creates `EmptyInput` to represent empty input so it can fit into the current IRB's input processing flow in `Irb#eval_input`. https://github.com/ruby/irb/commit/0e9db419be
2024-02-14[ruby/irb] Repurpose the help command to display the help messageStan Lo
(https://github.com/ruby/irb/pull/872) See #787 for more details. https://github.com/ruby/irb/commit/d9192d92d0
2024-02-14[ruby/irb] Improve constant lookup in SourceFindertomoya ishida
(https://github.com/ruby/irb/pull/871) https://github.com/ruby/irb/commit/87c279ccf2
2024-02-13[ruby/irb] Fix SourceFinder's constant evaluation issueStan Lo
(https://github.com/ruby/irb/pull/869) Currently, if the signature's constant part is not defined, a NameError would be raised. ``` irb(main):001> show_source Foo (eval):1:in `<top (required)>': uninitialized constant Foo (NameError) Foo ^^^ from (irb):1:in `<main>' ``` This commit fixes the issue and simplifies the `edit` command's implementation. https://github.com/ruby/irb/commit/8c16e029d1
2024-02-13[ruby/irb] Refactor eval_path and `SourceFinder::Source`Stan Lo
(https://github.com/ruby/irb/pull/870) * Assign `@eval_path` through `irb_path=` method This simplifies the original caching logic for the `eval_path` method and makes it easier to understand. * Refactor SourceFinder::Source https://github.com/ruby/irb/commit/c63e4c4035
2024-02-12[ruby/irb] Powerup show_source by enabling RubyVM.keep_script_linestomoya ishida
(https://github.com/ruby/irb/pull/862) * Powerup show_source by enabling RubyVM.keep_script_lines * Add file_content field to avoid reading file twice while show_source * Change path passed to eval, don't change irb_path. * Encapsulate source coloring logic and binary file check insode class Source * Add edit command testcase when irb_path does not exist * Memoize irb_path existence to reduce file existence check calculating eval_path https://github.com/ruby/irb/commit/239683a937
2024-02-12[ruby/irb] Fix exit! command warning and method behaviortomoya ishida
(https://github.com/ruby/irb/pull/868) * Fix exit! command warning and method behavior * Remove arg(0) from Kernel.exit and Kernel.exit! https://github.com/ruby/irb/commit/372bc59bf5
2024-02-11[ruby/irb] Polish the exit! command and its testsStan Lo
(https://github.com/ruby/irb/pull/867) * Remove IRB.irb_exit! method It's not necessary to introduce a new method just for the exit! command at this moment. * Rename ExitForcedAction to ForceExit * Move force exit tests to a dedicated file * Fix nested history saving with exit! command Because we switched to use `Kernel#exit` instead of `exit!`, the outer session's ensure block in `Irb#run` will be run, which will save the history. This means the separate check to save history when force exiting is no longer necessary. * execute_lines helper should also capture IRB setup's output This prevents setup warnings from being printed to test output while allowing those output to be tested. * Update readme https://github.com/ruby/irb/commit/899d10ade1
2024-02-10[ruby/irb] Introduce exit! commandIgnacio Chiazzo Cardarello
(https://github.com/ruby/irb/pull/851) * Added failing test for when writing history on exit * Save history on exit * Exit early when calling Kernel.exit * use status 0 for kernel.exit * Added test for nested sessions * Update lib/irb.rb --------- https://github.com/ruby/irb/commit/c0a5f31679 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-02-07[ruby/irb] Bump version to v1.11.2Stan Lo
(https://github.com/ruby/irb/pull/865) https://github.com/ruby/irb/commit/afe1f459cc
2024-02-07[ruby/irb] Polish tracer integration and testsStan Lo
(https://github.com/ruby/irb/pull/864) * Remove useless ivar * Simplify tracer test setup * Treat tracer like a normal development dependency * Only require ext/tracer when value is truthy * Make tracer integration skip IRB traces https://github.com/ruby/irb/commit/a97a4129a7
2024-02-06[ruby/irb] Fix usage of tracer gem and add testsNuno Silva
(https://github.com/ruby/irb/pull/857) The new tests are skipped when ruby below 3.1, as it was a default gem on it, and in a version we do not support. This also move definition of `use_tracer` to module Context instead of monkey patch. https://github.com/ruby/irb/commit/08834fbd5f
2024-02-02[ruby/irb] Require pathname (https://github.com/ruby/irb/pull/860)Stan Lo
https://github.com/ruby/irb/commit/0ab96ed426
2024-02-02[ruby/irb] Add a warning for when the history path doesn't existIgnacio Chiazzo Cardarello
(https://github.com/ruby/irb/pull/852) * Add a warning for when the history path doesn't exist * warn when the directory does not exist * added test for when the history_file does not exist * Update lib/irb/history.rb --------- https://github.com/ruby/irb/commit/9e6fa67212 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-02-01[ruby/irb] Add rubocop with a few basic styling rulesStan Lo
(https://github.com/ruby/irb/pull/849) * Use rubocop to enforce a few styling rules * Add a CI job for linting https://github.com/ruby/irb/commit/4f60cd88bb
2024-02-01[ruby/irb] Reset history counter even when @loaded_history_lines isStan Lo
not defined (https://github.com/ruby/irb/pull/853) The issue (https://github.com/ruby/debug/issues/1064) is caused by a combination of factors: 1. When user starts an IRB session without a history file, the `@loaded_history_lines` ivar is not defined. 2. If the user then starts the `irb:rdbg` session, the history counter is not set, because the `@loaded_history_lines` is not defined. 3. Because `irb:rdbg` saves the history before passing Ruby expression to the debugger, it saves the history with duplicated lines. The number grows in exponential order. 4. When the user exits the `irb:rdbg` session, the history file could be bloated with duplicated lines. This commit fixes the issue by resetting the history counter even when `@loaded_history_lines` is not defined. https://github.com/ruby/irb/commit/4afc98c258
2024-02-01[ruby/irb] Skip re-setup when creating a child sessionNuno Silva
(https://github.com/ruby/irb/pull/850) https://github.com/ruby/irb/commit/06b2d00dd3
2024-01-30[ruby/irb] Fix undef and alias indenttomoya ishida
(https://github.com/ruby/irb/pull/838) https://github.com/ruby/irb/commit/a641746b18
2024-01-25[ruby/irb] Synatx ==> Syntaxydah
https://github.com/ruby/irb/commit/2ffacaa031
2024-01-25[ruby/irb] recever ==> receiverydah
https://github.com/ruby/irb/commit/dbd0e368c4
2024-01-25[ruby/irb] inifinity ==> infinityydah
https://github.com/ruby/irb/commit/78dea58000
2024-01-19[ruby/irb] Bump version to v1.11.1Stan Lo
(https://github.com/ruby/irb/pull/837) https://github.com/ruby/irb/commit/f052097c4b
2024-01-08[ruby/irb] Make SourceFinder ignore binary sourcesStan Lo
(https://github.com/ruby/irb/pull/836) https://github.com/ruby/irb/commit/73b35bb7f4
2024-01-06[ruby/irb] Refactor exit commandStan Lo
(https://github.com/ruby/irb/pull/835) * Remove unnecessary code from the exit command's implementation 1. The parameters of `IRB.irb_exit` were never used. But there are some libraries seem to call it with arguments + it's declared on the top-level IRB constant. So I changed the params to anonymous splat instead of removing them. 2. `Context#exit` was completely unnecessary as `IRB.irb_exit` doesn't use the `@irb` instance it passes. And since it's (or should be treated as) a private method, I simply removed it. 3. The `exit` command doesn't use the status argument it receives at all. But to avoid raising errors on usages like `exit 1`, I changed the argument to anonymous splat instead removing it. * Make exit an actual command * Update readme https://github.com/ruby/irb/commit/452b543a65
2024-01-06[ruby/irb] Require Reline v0.4.2+Stan Lo
(https://github.com/ruby/irb/pull/834) https://github.com/ruby/irb/commit/eff8d0d46a
2024-01-03[ruby/irb] Avoid completing empty inputStan Lo
(https://github.com/ruby/irb/pull/832) The candidate list for empty input is all methods + all variables + all constants + all keywords. It's a long list that is not useful. https://github.com/ruby/irb/commit/812dc2df7b
2024-01-01[ruby/irb] Make show_source resolve top-level constant namesStan Lo
(https://github.com/ruby/irb/pull/831) https://github.com/ruby/irb/commit/5843616c78
2024-01-01[ruby/irb] Fix display_document params in noautocomplete modetomoya ishida
(https://github.com/ruby/irb/pull/826) * Fix display_document params in noautocomplete mode * Fix wrong preposing and target order in display_document The fixed wrong-ordered value is not used in RegexpCompletor, so this change does not affect the test. https://github.com/ruby/irb/commit/08208adb5e
2023-12-20[ruby/irb] Bump version to v1.11.0Stan Lo
(https://github.com/ruby/irb/pull/818) https://github.com/ruby/irb/commit/7421359b92
2023-12-20[ruby/irb] Warn users about errors in loading RC filesStan Lo
(https://github.com/ruby/irb/pull/817) 1. Because `IRB.rc_file` always generates an rc file name, even if the file doesn't exist, we should check the file exists before trying to load it. 2. If any type of errors occur while loading the rc file, we should warn the user about it. https://github.com/ruby/irb/commit/37ffdc6b19
2023-12-13[ruby/irb] Warn and do nothing if block is passed to measure commandtomoya ishida
(https://github.com/ruby/irb/pull/813) https://github.com/ruby/irb/commit/e79a90a1e6
2023-12-12[ruby/irb] [DOC] RDoc for module IRBBurdette Lamar
(https://github.com/ruby/irb/pull/738) [DOC] RDoc for module IRB https://github.com/ruby/irb/commit/f3a0626298
2023-12-10[ruby/irb] Simplify show_source's super calculationStan Lo
(https://github.com/ruby/irb/pull/807) https://github.com/ruby/irb/commit/2cccc448de
2023-12-07[ruby/irb] Debugging command warning should not be specific to theStan Lo
`debug` command (https://github.com/ruby/irb/pull/806) https://github.com/ruby/irb/commit/b7b57311cc
2023-12-05[ruby/irb] Bump version to v1.10.1Stan Lo
(https://github.com/ruby/irb/pull/801) https://github.com/ruby/irb/commit/a1e431bd83
2023-12-05[ruby/irb] Disable pager when TERM is not set tooStan Lo
(https://github.com/ruby/irb/pull/802) https://github.com/ruby/irb/commit/173980974b
2023-12-05[ruby/irb] Pager should be disabled when TERM=dumbStan Lo
(https://github.com/ruby/irb/pull/800) For apps/libs that test against IRB, it's recommended to set `TERM=dumb` so they get minimum disruption from Reline's interactive-focus features. Therefore, we should follow the convention to disable pager when `TERM=dumb`. https://github.com/ruby/irb/commit/8a3002a39e
2023-12-03[ruby/irb] Bump version to v1.10.0Stan Lo
(https://github.com/ruby/irb/pull/798) https://github.com/ruby/irb/commit/4acc9b8d6c
2023-12-02[ruby/irb] Implement `history` commandGary Tou
(https://github.com/ruby/irb/pull/761) * Implement `history` command Lists IRB input history with indices. Also aliased as `hist`. * Add tests for `history` command * Address feedback: `puts` with multiple arguments instead of `join`ing * Address feedback: Handle nil from splitting an empty input string * Refactor line truncation * Add `-g` grep option to `history` command * Add `history` command to README * Remove unused `*args` parameter * Allow spaces to be included in grep * Allow `/` to be included in grep regex * Handle `input` being an empty string * Exclude "#{index}: " from matching the grep regex * Add new line after joining https://github.com/ruby/irb/commit/3f9eacbfa9
2023-12-01[ruby/irb] Scrub past history input before splithogelog
(https://github.com/ruby/irb/pull/795) * Scrub past history input before split * Don't rewrite ENV["LANG"] https://github.com/ruby/irb/commit/0f344f66d9
2023-11-30[ruby/irb] Page evaluation result's outputStan Lo
(https://github.com/ruby/irb/pull/784) * Page evaluation result's output This will make it easier to work with long output that exceeds the terminal's height. * Use consistent TERM in rendering tests This makes sure we get consistent result on all platforms. https://github.com/ruby/irb/commit/4fedce93d3
2023-11-29[ruby/irb] Use gem repl_type_completor, remove type_completiontomoya ishida
implementation (https://github.com/ruby/irb/pull/772) https://github.com/ruby/irb/commit/a4868a5373
2023-11-28[ruby/irb] Change show_source tests into integration testsPeter Zhu
* Remove trailing spaces * Migrate show_source tests to integration tests Because show_source tests often need to define class and/or methods, they can easily leak state to other tests. Changing them to integration tests will ensure that they are run in a clean environment. * Fix NoMethodError caused by SourceFinder#method_target https://github.com/ruby/irb/commit/3c39f13397c72a8db24e50afdcb8942e6c4ea12f
2023-11-28[ruby/irb] This enhancement allows a user to add the -s flag if theypaulreece
want to access a methods origin definition. It allows for chaining of multiple esses to further go up the classes as needed. (https://github.com/ruby/irb/pull/770) https://github.com/ruby/irb/commit/eec1329d5a
2023-11-27[ruby/irb] Hide debugger hint after the input is submittedStan Lo
(https://github.com/ruby/irb/pull/789) If `output_modifier_proc`'s `complete` arg is true, it means the input is submitted. In that case, debugger hint doesn't provide value to users and adds noise to the output. So we hide it in such case. https://github.com/ruby/irb/commit/f86d9dbe2f
2023-11-26[ruby/irb] Display aliases in help messageStan Lo
(https://github.com/ruby/irb/pull/788) Similar to Pry, it displays user-defined aliases in the help message with a dedicated section. With the current default aliases, it looks like: ``` ...other sections... Aliases $ Alias for `show_source` @ Alias for `whereami` ``` https://github.com/ruby/irb/commit/2a0eacc891
2023-11-26[ruby/irb] Support disabling pagerStan Lo
(https://github.com/ruby/irb/pull/783) With either `IRB.conf[:USE_PAGER] = false` or `--no-pager` commnad line flag. I decided use `--no-pager` instead of `--use-pager` because it matches with Pry and git's command line flags. https://github.com/ruby/irb/commit/df1c3b9042
2023-11-23[ruby/irb] Hint debugger command in irb:rdbg sessionStan Lo
(https://github.com/ruby/irb/pull/768) When user enters irb:rdbg session, they don't get the same hint that the `debug` gem provides, like ``` (rdbg) n # next command ``` This means that users may accidentally execute commands when they want to retrieve the value of a variable. So this commit adds a Reline output modifier to add a simiar hint: ``` irb:rdbg(main):002> n # debug command ``` It is not exactly the same as `debug`'s because in this case the importance is to help users distinguish between value evaluation and debugger command execution. https://github.com/ruby/irb/commit/fdf24de851
2023-11-23[ruby/irb] Fix failure of more command with -R optionhogelog
(https://github.com/ruby/irb/pull/781) https://github.com/ruby/irb/commit/7d6849e44e
2023-11-22[ruby/irb] Require prism >= 0.18.0 (MatchWriteNode#targets andtomoya ishida
CaseMatchNode) (https://github.com/ruby/irb/pull/778) https://github.com/ruby/irb/commit/943c14b12e