summaryrefslogtreecommitdiff
path: root/lib/irb
AgeCommit message (Collapse)Author
2023-03-13[ruby/irb] Replace METHOD_IS_A with ===Stan Lo
(https://github.com/ruby/irb/pull/542) https://github.com/ruby/irb/commit/edd6c30e16
2023-03-13[ruby/irb] Support inspecting BasicObjectStan Lo
(https://github.com/ruby/irb/pull/541) https://github.com/ruby/irb/commit/1dc2a406a3
2023-03-07[ruby/irb] Bump version to 1.6.3Stan Lo
(https://github.com/ruby/irb/pull/537) https://github.com/ruby/irb/commit/110e4a3219
2023-03-06[ruby/irb] Improve method completion for string and regexp thattomoya ishida
includes word break characters (https://github.com/ruby/irb/pull/523) * Improve method completion for string and regexp that includes word break characters * Remove completion-test's assert_not_include because candidates no longer include every possible methods * Add comment about string's method completion regexp Co-authored-by: Stan Lo <stan001212@gmail.com> * Add comment about regexp's method completion regexp Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/irb/commit/aa8128c533 Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-03-04[ruby/irb] Drop chained methods' completion supportStan Lo
(https://github.com/ruby/irb/pull/529) Consider completion for this example: `foo.bar.b` Without type information, it is hard to know the return value of the `bar` method, so the current implementation interates through `ObjectSpace` to get all possible candidates for the second method. In small projects, the performance and accuracy are acceptable. But in bigger projects, the performance is unacceptable and the accuracy is mostly poor. So this commit drops the support for chained methods' completion.
2023-03-03[ruby/irb] Avoid slow symbol completion when completion target is antomoya ishida
empty symbol (https://github.com/ruby/irb/pull/534) https://github.com/ruby/irb/commit/35697f3ef3
2023-03-02[ruby/irb] Specify metadata to provide richer information onStan Lo
rubygems.org (https://github.com/ruby/irb/pull/532) https://github.com/ruby/irb/commit/f01c2a6ac1
2023-02-28[ruby/irb] Display and prioritise instance methods in `lsStan Lo
<module/class>` (https://github.com/ruby/irb/pull/496) https://github.com/ruby/irb/commit/e3d21f9329
2023-02-27[ruby/irb] Add a comment about Rails' patch onStan Lo
Workspace#filter_backtrace (https://github.com/ruby/irb/pull/526) * Add a comment about Rails' patch on Workspace#filter_backtrace * Update lib/irb/workspace.rb Co-authored-by: Sorah Fukumori <sora134@gmail.com> --------- https://github.com/ruby/irb/commit/9443d911fc Co-authored-by: Sorah Fukumori <sora134@gmail.com>
2023-02-27[ruby/irb] Provide more useful message whenStan Lo
`IRB::Inspector#inspect_value` errors (https://github.com/ruby/irb/pull/511) **Before** ``` irb(main):001:0> c = Cat.new "foo" (Object doesn't support #inspect) => ``` **After** ``` irb(main):001:0> c = Cat.new "foo" An error occurred when inspecting the object: #<NoMethodError: undefined method `is_a?' for foo:Cat if obj.is_a?(String) ^^^^^^> Result of Kernel#inspect: #<Cat:0x0000000109090d80 @name="foo"> => ```
2023-02-25[ruby/irb] Remove unused Structima1zumi
(https://github.com/ruby/irb/pull/522) https://github.com/ruby/irb/commit/97dae166ae
2023-02-18[ruby/irb] Remove unused context argument from Worksapce#evaluateStan Lo
(https://github.com/ruby/irb/pull/488) The context argument was introduced in this change: https://github.com/ruby/irb/commit/6806669d178f90f38b99c144bdfee06bdb93a229#diff-296327851fb7a2c307c2d0693b769f58c01aaf315972f290500d10081ee200a9 perhaps for potential usages. But after that it's never used.
2023-02-15[ruby/irb] Fix help-message (https://github.com/ruby/irb/pull/506)HASUMI Hitoshi
https://github.com/ruby/irb/commit/a55ace0791
2023-02-12[ruby/irb] Fix colorize backtick symboltomoya ishida
(https://github.com/ruby/irb/pull/508) https://github.com/ruby/irb/commit/dd7f25cd45 Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-01-14[ruby/irb] Store context in RubyLexStan Lo
Some background for this refactor: 1. Through a RubyLex instance's lifetime, the context passed to its methods should be the same. Given that `Context` is only initialised in `Irb#initialize`, this should be true. 2. When `RubyLex` is initialised, the context object should be accessible. This is also true in all 3 of `RubyLex.new`'s invocations. With the above observations, we should be able to store the context in `RubyLex` as an instance variable. And doing so will make `RubyLex`'s instance methods easier to use and maintain. https://github.com/ruby/irb/commit/5c8d3df2df
2023-01-12[ruby/irb] Avoid calling private methods on the main objectStan Lo
(https://github.com/ruby/irb/pull/498) When the main object is frozen, `IRB` wraps a `SimpleDelegator` around it. But because `SimpleDelegator` doesn't delegate private methods, methods like `require_relative` or `const_get` would cause error, which are needed for lazily loading commands. This commit works around this limitation by avoiding those private method calls when setting up command execution.
2023-01-12[ruby/irb] Remove redundant argument defaults from some RubyLexStan Lo
methods (https://github.com/ruby/irb/pull/502) * Remove unnecessary parameter defaults These methods are always called with tokens specified. So their default `@tokens` value is never used and is misleading. * Remove unnecessary context default * Require tokens for `RubyLex#check_state`
2023-01-11[ruby/irb] Formatting to header stylesHiroshi SHIBATA
https://github.com/ruby/irb/commit/cef125850d
2023-01-11[ruby/irb] After Ruby 2.0, coding is always utf-8Hiroshi SHIBATA
https://github.com/ruby/irb/commit/7a94bc4135
2023-01-11[ruby/irb] Removed Release Version and Revisions for old VCS softwareHiroshi SHIBATA
https://github.com/ruby/irb/commit/07fae94862
2023-01-11[ruby/irb] Drop unused arguments in `RubyLex`Stan Lo
(https://github.com/ruby/irb/pull/504) * Simplify `RubyLex#set_prompt` It's optional argument is never used by any caller. * Remove the optional `p` argument from `RubyLex#set_input` The argument is only used in a test case, which can be easily replaced by a block argument.
2023-01-04[ruby/irb] workspace.rb cleanupStan Lo
(https://github.com/ruby/irb/pull/489) * Remove unnecessary Binding#source_location check `Binding#source_location` was added in 2.6, which is the minimum supported version now. So this check is no longer necessary. * Remove unused IRB.delete_caller This method was added in the earliest version of IRB: https://github.com/ruby/irb/commit/f47808999d24865fba1929dea1a7011ff5a517d6 But it's not currently referenced by anything. We can verify this with a org-wide search result: https://github.com/search?q=org%3Aruby+delete_caller&type=code
2023-01-02[ruby/irb] Fix prompt and code mismatchtomoya ishida
(https://github.com/ruby/irb/pull/386) * fix prompt and code mismatch * Add test for prompt and code mismatch bug https://github.com/ruby/irb/commit/a5765d8177 Co-authored-by: Stan Lo <stan001212@gmail.com>
2022-12-27[ruby/irb] Refactor RubyLex#process_literal_typeMau Magnaguagno
(https://github.com/ruby/irb/pull/350) Simplify part of regex ``[_a-zA-Z0-9]`` with equivalent shorthand ``\w``. Replace case-when with match ``$1`` or default value ``?"``, making intention more clear.
2022-12-27[ruby/irb] Fix wrong conf path with XDG_CONFIG_HOME. It should be under the ↵Hiroshi SHIBATA
HOME directory, not current directory https://github.com/ruby/irb/commit/33a5e55ffd
2022-12-26[ruby/irb] fix indent depth calculation after heredoc and embdoctompng
https://github.com/ruby/irb/commit/b7973dd2d2
2022-12-26[ruby/irb] fix auto-indent after multiline stringtompng
https://github.com/ruby/irb/commit/f65ec49684
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