summaryrefslogtreecommitdiff
path: root/lib/irb
AgeCommit message (Collapse)Author
2022-12-20[ruby/irb] Version 1.6.2Takashi Kokubun
https://github.com/ruby/irb/commit/a8ea9963c6
2022-12-20[ruby/irb] Respect DLEXT to force-load debug.soTakashi Kokubun
(https://github.com/ruby/irb/pull/481) Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-12-13[ruby/irb] Version 1.6.1Takashi Kokubun
https://github.com/ruby/irb/commit/229476ba76
2022-12-12[ruby/irb] `show_doc` command should take non-string argument tooStan Lo
(https://github.com/ruby/irb/pull/478) Given that `show_doc` already supports syntax like `String#gsub`, it should be able to take it in non-string form too, like `edit` and `show_source` do. This ensures users can have a consistent syntax on argument between different commands.
2022-12-09[ruby/irb] Fix step command (https://github.com/ruby/irb/pull/477)Stan Lo
The current `next` pre-command workaround on IRB source stepping moves the location by 1 extra line. A better way is to make `debug` skip IRB frames completely, which is what this commit does. It also fixes the step command's test. The `|` in regexp was not escaped so it was always incorrectly matched.
2022-12-09[ruby/irb] Version 1.6.0Takashi Kokubun
https://github.com/ruby/irb/commit/d799c5c9da
2022-12-08[ruby/irb] Add show_doc as an alias to the help commandStan Lo
(https://github.com/ruby/irb/pull/475) In the long-term, we want to align with `Pry`, `byebug` and `debug` to use the `help` command to list all commands, which is what `show_cmds` currently does. And `show_doc` will be the command to look up Ruby APIs. By aliasing `show_doc` to the current `help` now, users will have time to get use to it.
2022-12-08[ruby/irb] Gracefully handle missing command argumentStan Lo
(https://github.com/ruby/irb/pull/473) * Handle file loading commands' argument error gracefully Currently, if users don't provide an argument to `source`, `irb_load`, and `irb_require`, IRB raises `ArgumentError` with full stacktrace. This is confusing because it looks similar to when IRB has internal issues. The message also isn't helpful on helping users avoid the error. So in this commit, I add a new `CommandArgumentError` for commands to raise explicitly when users' input doesn't satisfy a command's argument requirement. * Gracefully handle `fg` command's argument requirement
2022-12-08[ruby/irb] Add "show_cmds" command to list all commands'Stan Lo
descriptions (https://github.com/ruby/irb/pull/463) https://github.com/ruby/irb/commit/7e857655ac
2022-12-07[ruby/irb] Lazily load the multi-irb extensionStan Lo
(https://github.com/ruby/irb/pull/472) * Lazily load the multi-irb extension We now have plan to implement a command that prints all commands' information, which will need to load all command files without actually running them. But because the `multi-irb` extension patches IRB's top-level methods, loading it would cause unintentional side-effects. So this commit moves related requires into command execution to avoid the problem. * Make extend_irb_context private Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2022-12-06[ruby/irb] Allow disabling autocompletion withStan Lo
`IRB_USE_AUTOCOMPLETE=false` (https://github.com/ruby/irb/pull/469) * Allow using IRB_USE_AUTOCOMPLETE=false to disable autocompletion Currently, the only 2 ways to disable autocompletion are: 1. Create `.irbrc` and set `IRB.conf[:USE_AUTOCOMPLETE] = false` 2. Add the `--noautocomplete` flag when using the `irb` executable Both of them are less convenient than setting a env var and are lesser known to devs. And given the number of problems the autocompletion has (see #445), I think we should allow disabling it with a simple `IRB_USE_AUTOCOMPLETE=false`. * Mention some env var configs in the README
2022-11-30[ruby/irb] Use class methods of `File` over `Kernel.open`Nobuyoshi Nakada
https://github.com/ruby/irb/commit/e0ec5e1bd8
2022-11-30[ruby/irb] Make sure ls doesn't return an arrayTakashi Kokubun
(https://github.com/ruby/irb/pull/461) https://github.com/ruby/irb/commit/367797bb05
2022-11-28[ruby/irb] Version 1.5.1Takashi Kokubun
https://github.com/ruby/irb/commit/f9507923fa
2022-11-28[ruby/irb] Fix the debug.gem force-loader for Ruby 3.2Takashi Kokubun
(https://github.com/ruby/irb/pull/458) * Fix the debug.gem force-loader for Ruby 3.2 * Support 1.7.0dev format as well
2022-11-21[ruby/irb] Add commands to start and use the debuggerTakashi Kokubun
(https://github.com/ruby/irb/pull/449) * Seamlessly integrate a few debug commands * Improve the break command support * Utilize skip_src option if available * Add step and delete commands * Write end-to-end tests for each debugger command * Add documentation * Add backtrace, info, catch commands https://github.com/ruby/irb/commit/976100c1c2
2022-11-20[ruby/irb] Version 1.5.0Takashi Kokubun
Asked by ko1 to release https://github.com/ruby/irb/pull/444 for simplifying https://github.com/ruby/debug/pull/808, and hsbt made me a gem owner for this. Stan said 1.4.3 should have been 1.5.0, but now that it's already released and it's not worth yanking it, we're not doing that change. However, now that this release includes `debug` and `edit`, I think it's a good opportunity to hit the version 1.5.0. https://github.com/ruby/irb/commit/85937d71f6
2022-11-20[ruby/irb] Add edit command (https://github.com/ruby/irb/pull/453)Stan Lo
* Add edit command * Make find_source a public singleton method * Add document for the edit command * Make find_end private * Remove duplicated private https://github.com/ruby/irb/commit/4321674aa7 Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2022-11-19[ruby/irb] Document a full list of commandsTakashi Kokubun
(https://github.com/ruby/irb/pull/451) * Document a full list of commands * Document debug as well * Make it less duplicated
2022-11-18[ruby/irb] Discover and load debug.gem even if it's not in GemfileTakashi Kokubun
(https://github.com/ruby/irb/pull/448) * Minor fixes on debug command * Discover and load debug.gem even if it's not in Gemfile * Eliminate else for rescue * Discover the latest one from all gem paths
2022-11-18[ruby/irb] Minor fixes on debug commandTakashi Kokubun
(https://github.com/ruby/irb/pull/447) * Minor fixes on debug command * Update lib/irb/cmd/debug.rb
2022-11-18[ruby/irb] Add debug command (https://github.com/ruby/irb/pull/446)Stan Lo
https://github.com/ruby/irb/commit/30faa13fa3
2022-11-17[ruby/irb] Bump up 1.4.3Hiroshi SHIBATA
https://github.com/ruby/irb/commit/1bddbbf602
2022-11-17Drop Ruby 2.5 supportst0012
Because it has reached EOL for more than 1.5 years and it won't be supported by the next reline version either.
2022-11-17[ruby/irb] Fix https://github.com/ruby/irb/pull/295: Ignore JavaPatrick Plenefisch
package reference objects in JRuby https://github.com/ruby/irb/commit/84d030182d
2022-11-15[ruby/irb] Deprecate USE_RELINE and USE_REIDLINEst0012
Based on this commit: https://github.com/ruby/irb/commit/93f87ec65344b44123b0150a5fc07de1fd4c80c4 It appears that the maintainer @aycabta wanted to deprecate any `USE_*LINE` configs in favor of `USE_MULTILINE`. So we should deprecate `USE_RELINE` as well. https://github.com/ruby/irb/commit/478f19f3ae
2022-11-15[ruby/irb] Deprecate reidline flagsst0012
https://github.com/ruby/irb/commit/9957e83f7d
2022-11-15[ruby/irb] Rename leftover Reidline referencesst0012
https://github.com/ruby/irb/commit/0ed8b103ed
2022-11-10[ruby/irb] Transform ls's --grep/-G option to keyword argsTakashi Kokubun
(https://github.com/ruby/irb/pull/437) * Transform ls's --grep/-G option to keyword args * Make --grep less flexible * Support -g instead of --grep * Suppress warnings from symbol aliases
2022-11-10[ruby/irb] Make $ and @ default aliasesTakashi Kokubun
(https://github.com/ruby/irb/pull/438) https://github.com/ruby/irb/commit/0613589476
2022-11-07[ruby/irb] Support non-string input in show_sourceTakashi Kokubun
(https://github.com/ruby/irb/pull/430) * Support non-string input in show_source * Test show_source as a method
2022-11-07[ruby/irb] Don't lazily retrieve gem specs for completionStan Lo
There are a few downsides of the current approach: 1. Because gem specs are lazily retrieved, this computation happens in every irb completion test case, which is not necessary. (In tests we don't cache the result of `retrieve_files_to_require_from_load_path`) 2. Gem::Specification.latest_specs is sensible to the content of LOAD_PATH. And when combined with 1, tests fail "randomly" if they try to mutate LOAD_PATH, even though the test subject it's something else. So by pre-computing and storing the gem paths in a constant, it guarantees that the computation only happens once and it doesn't get affected by test cases. One argument could be made against the change is that, it'll store unnecessary data for users that disable autocompletion. But the counter-arguments are: 1. Since autocompletion is enabled by default, this should not be the case for most users. 2. For users with autocompletion enabled, IRB already caches the result of `retrieve_files_to_require_from_load_path` in memory, which should have a similar size of GEM_SPECS. And we currently haven't received any report about problems caused by such memory consumption. https://github.com/ruby/irb/commit/c671d39020
2022-11-03[ruby/irb] Allow non-identifier aliases like Pry's @ and $Takashi Kokubun
(https://github.com/ruby/irb/pull/426) * Allow non-identifier aliases * Move the configuration to IRB.conf * Avoid abusing method lookup for symbol aliases * Add more alias tests * A small optimization * Assume non-nil Context * Load IRB.conf earlier https://github.com/ruby/irb/commit/e23db5132e
2022-11-03[ruby/irb] Refactor RubyLex and its testsStan Lo
(https://github.com/ruby/irb/pull/427) * Make sure `RubyLex#set_input`'s context is always present in tests In real-world scenarios, the context should always be non-nil: https://github.com/ruby/irb/blob/master/lib/irb.rb#L489 So we should make sure our test setup reflects that. * Make context a required keyword Since in practice, `set_input`'s context should always be non-nil, its parameters should reflect that. And since `RubyLex#check_state` is only called by `#lex` and `#set_input`, both of which now always require context, we can assume its context should be non-nil too. https://github.com/ruby/irb/commit/1aeeb86203
2022-10-28[ruby/irb] Do not make non-existent XDG directory on startNobuyoshi Nakada
(https://github.com/ruby/irb/pull/357) https://github.com/ruby/irb/commit/298b134792
2022-10-28[ruby/irb] Update regarding NO_COLOR valueNobuyoshi Nakada
https://no-color.org has been updated (jcs/no_color#83): > Command-line software which adds ANSI color to its output by default should check for a `NO_COLOR` environment variable that, when present and **not an empty string** (regardless of its value), prevents the addition of ANSI color. https://github.com/ruby/irb/commit/46e0f7e370 Co-authored-by: Stan Lo <stan001212@gmail.com>
2022-10-24[ruby/irb] Move require out of repeated execution pathst0012
SHOW_DOC_DIALOG will be called repeatedly whenever the corresponding key is pressed, but we only need to require rdoc once. So ideally the require can be put outside of the proc. And because when rdoc is not available the entire proc will be nonfunctional, we can stop registering the SHOW_DOC_DIALOG if we failed to require rdoc. https://github.com/ruby/irb/commit/b1278b7320
2022-10-18[ruby/irb] Assert lvars_code doesn't include \nTakashi Kokubun
Removing /\A.+\n/ could have an unexpected impact, depending on how RubyLex.generate_local_variables_assign_code is implemented. It feels like a too much assumption and the intention isn't immediately clear, so I added these changes. https://github.com/ruby/irb/commit/ccc07a35ce
2022-10-18[ruby/irb] Always use local variables in current context to parse code ↵tomoya ishida
(https://github.com/ruby/irb/pull/397) * Use local_variables for colorize, code_block_open check, nesting_level and assignment_expression check * Check if expression is an assignment BEFORE evaluating it. evaluate might define new localvars and change result of assignment_expression? * Add local_variables dependent code test * pend local variable dependent test on truffleruby code_block_open is not working on truffleruby * Always pass context to RubyLex#lex * Rename local_variable_assign_code generator method name * Add assignment expression truncate test * Add Context#local_variables and make generate_local_variables_assign_code more simple * Update lib/irb/input-method.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Add a comment why assignment expression check should be done before evaluate https://github.com/ruby/irb/commit/c8b3877281 Co-authored-by: Stan Lo <stan001212@gmail.com> Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2022-10-18[ruby/irb] Fix code terminated check with heredoc and backtick ↵tomoya ishida
(https://github.com/ruby/irb/pull/390) * Fix backtick method def method call handled as backtick open * Fix handling heredoc in check_string_literal * Sort result of lexer.parse by pos in ruby<2.7. It's not sorted when the given code includes heredoc. * Update lib/irb/ruby-lex.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Update lib/irb/ruby-lex.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Add check_string_literal test for heredoc code that does not end with newline https://github.com/ruby/irb/commit/44bc712460 Co-authored-by: Stan Lo <stan001212@gmail.com>
2022-10-08[ruby/irb] Sort constant completion's candidatesst0012
https://github.com/ruby/irb/commit/ee9b33c817
2022-10-08[ruby/irb] Lazily evaluate candidates localsst0012
https://github.com/ruby/irb/commit/19a2fcbd87
2022-10-05[ruby/irb] Fixed sort of variables in completionImir Kiyamov
https://github.com/ruby/irb/commit/5842888255
2022-10-05[ruby/irb] Update remark of self.install_extend_commands.Kaíque Kandy Koga
Create line https://github.com/ruby/irb/commit/64d6a461d5
2022-10-05[ruby/irb] Use USE_REIDLINE for backword compatibilityHiroshi SHIBATA
https://github.com/ruby/irb/commit/e58a3c1b39
2022-10-05[ruby/irb] Rename IDB::ReidlineInputMethod to IRB::RelineInputMethodGannon McGibbon
Deprecates IDB::ReidlineInputMethod and USE_REIDLINE in favor of IRB::RelineInputMethod and USE_RELINE. The Input method uses Reline to read input from the console, so it can be named directly after the Reline library like other inputs methods are (Readline, Stdio, etc.). https://github.com/ruby/irb/commit/5bcade7130
2022-10-05[ruby/irb] Bump version to 1.4.2st0012
https://github.com/ruby/irb/commit/f9960dbd37
2022-10-05[ruby/irb] Added aycabta to authorsHiroshi SHIBATA
https://github.com/ruby/irb/commit/a6bfa7b2e6
2022-10-03[ruby/irb] Remove unused errorst0012
https://github.com/ruby/irb/commit/f09a1874b6
2022-10-03[ruby/irb] Remove unnecessary Thread presence checkst0012
They were introduced around 20 years ago, when Thread is not yet stabilized. So we don't need them anymore. https://github.com/ruby/irb/commit/4c75e03b2b