summaryrefslogtreecommitdiff
path: root/lib/irb
AgeCommit message (Collapse)Author
5 days[ruby/irb] Set maximum document dialog height bytomoya ishida
preferred_dialog_height provided by Reline (https://github.com/ruby/irb/pull/591) https://github.com/ruby/irb/commit/df6907aca9
9 days[ruby/irb] Allow `show_source` for private methodsTSUYUSATO Kitsune
(https://github.com/ruby/irb/pull/589) * Allow `show_source` for private methods Fix https://github.com/ruby/irb/pull/577 * Pend tests on TruffleRuby It seems `eval(..., __LINE__ + 1)` does not work. Other similar tests are also pended on TruffleRuby, so I think it is acceptable. * Use `private_method_defined?` instead of `defined?`
13 days[ruby/irb] Simplify each_top_level_statementtomoya ishida
(https://github.com/ruby/irb/pull/576) * Simplify each_top_level_statement, reduce instance vars * Update lib/irb/ruby-lex.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Remove unused ltype from TestRubyLex#check_state response * Remove unnecessary const path of TerminateLineInput * Combine duplicated code state check into method --------- https://github.com/ruby/irb/commit/172453cec4 Co-authored-by: Stan Lo <stan001212@gmail.com>
14 days[ruby/irb] Display mod key as `Option` on Darwin platformsAdam Daniels
(https://github.com/ruby/irb/pull/584) Check RUBY_PLATFORM for `darwin` and modify the mod key from `Alt` to `Option`.
2023-05-18[ruby/irb] Refactor RubyLex's input/io methodsStan Lo
(https://github.com/ruby/irb/pull/583) 1. Make `RubyLex#set_input` simply assign the input block. This matches the behavior of `RubyLex#set_prompt`. 2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent` into `#configure_io`.
2023-05-18[ruby/irb] Print deprecation warning for `help` commandStan Lo
(https://github.com/ruby/irb/pull/567) * Give show_doc its own command class * Print deprecation warning for `help` command
2023-04-28[ruby/irb] Retire magic-file.rbStan Lo
(https://github.com/ruby/irb/pull/574) `MagicFile` was introduced around v0.9.6, which was like 14~15 years ago. It was needed because back then we needed to read a file's magic comment to determine the encoding of it, and read it with that encoding. Commit: 3ee79e89 But now we expect files to be encoded in UTF-8 and don't specify encoding through magic comments anymore, `MagicFile` can be retired.
2023-04-27[ruby/irb] Simplify Locale#loadStan Lo
(https://github.com/ruby/irb/pull/571) * Simplify Locale#load Instead of loading file content with `MagicFile` and then evaluting it, we can just use `Kernel.load` to load the file. * Remove unused optional argument * Remove unused Locale#require and #toplevel_load
2023-04-27[ruby/irb] Stop using MagicFile for printing help messagesStan Lo
(https://github.com/ruby/irb/pull/573) `MagicFile` was introduced around v0.9.6, which was like 14~15 years ago. It was needed because back then we needed to read a file's magic comment to determine the encoding of it, and read it with that encoding. Commit: https://github.com/ruby/irb/commit/3ee79e89adb8e21b63d796e53bcc86281685076d But now both EN and JA's help-message file are UTF-8 and have removed the encoding comment, we don't need to open them with `MagicFile` anymore.
2023-04-26[ruby/irb] Remove encoding_aliases.rbStan Lo
(https://github.com/ruby/irb/pull/569) We don't have to load another file to define the legacy encoding aliases map because there's only one definition of it. We can define it in locale.rb directly.
2023-04-26[ruby/irb] Fix Locale's encoding lookup for Japanese encodingsStan Lo
(https://github.com/ruby/irb/pull/568) In https://github.com/ruby/irb/commit/3ee79e89adb8e21b63d796e53bcc86281685076d, `encoding_aliases.rb` was introduced to return the correct encoding object for `ujis` and `euc` encodings. However, the return value of `@@legacy_encoding_alias_map[@encoding_name]` is always overridden by a second look up with `Encoding.find(@encoding_name)`. So the logic didn't work as expected. This commit fixes the problem.
2023-04-24[ruby/irb] Simplify the help command's implementationStan Lo
(https://github.com/ruby/irb/pull/564) The current method-redefining approach brings little benefit, makes it harder to understand the code, and causes warnings like: > warning: method redefined; discarding old execute This patch simplifies it while displaying more helpful message when rdoc couldn't be loaded.
2023-04-24[ruby/irb] Filter out top-level methods when using `lsStan Lo
<Class/Module>` (https://github.com/ruby/irb/pull/562) Instead of always printing methods inherited from Class or Module, IRB by default should filter them out unless `<Class/Module>` is specified to be either of those.
2023-04-23[ruby/irb] fix typo in tracer (https://github.com/ruby/irb/pull/565)Yusuf Daniju
https://github.com/ruby/irb/commit/2f567f3d3e
2023-04-09[ruby/irb] Bump version to 1.6.4ima1zumi
(https://github.com/ruby/irb/pull/560) https://github.com/ruby/irb/commit/01328da9b6
2023-04-08[ruby/irb] Simplify command method definitionStan Lo
(https://github.com/ruby/irb/pull/559) * Remove unnecessary command argument generation code Now that all the supported Ruby versions handle splat args and splat kwargs, we don't need that args generation code anymore. * Remove unused command definition code If we look at `@EXTEND_COMMANDS`, all commands are defined in a file, which means the `if load_file` branch is always executed. Therefore we can drop the else branch of that condition. * Avoid defining unnecessary command methods There's no need to define another command method just to call `Command.execute`.
2023-04-05[ruby/irb] Drop Ruby 2.6 supportStan Lo
(https://github.com/ruby/irb/pull/555) * Remove all Ruby 2.6 support * Drop Ruby 2.6 specific testing conditions * Only run Ruby 2.7+ on CI * Bump Ruby requirement to 2.7+ https://github.com/ruby/irb/commit/3f714b616c
2023-04-02[ruby/irb] Don't check RUBY_ENGINE when deciding whether to accept kargsStan Lo
Ruby implementations like JRuby and TruffleRuby already indicate their compatibility target with RUBY_VERSION. We don't need to exclude them from accepting keyword arguments as long as they target 2.7+. https://github.com/ruby/irb/commit/bf20faa4e6 Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
2023-04-02[ruby/irb] Remove dead code (https://github.com/ruby/irb/pull/554)Stan Lo
* Remove unused ATTR_TTY and ATTR_PLAIN constants They were added in https://github.com/ruby/irb/commit/d7d26b51bf47a52e4e2339e2ad509ace74f0e4c7 But the references were removed in https://github.com/ruby/irb/commit/1c76845cca59635bb0cf386ced721e34b25d7410 Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com> * Remove unused MethodExtender module It was added in https://github.com/ruby/irb/commit/6cc5d718d7045952ef61d504d624f7e70ce828be but it's not used anywhere. Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com> * Remove unused IRB.irb_at_exit It's not used after https://github.com/ruby/irb/commit/aaf4eb4e9830ae71240ca5d2047c5e3ad20a4044 Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com> * Remove unused InputCompletor.ignored_modules It was added in https://github.com/ruby/irb/commit/88311ce3c84251e6f420246cd14efc96e00888be but the reference was removed in https://github.com/ruby/irb/commit/78c74d24254145a39c4d30168dbcd87dbbbc66dc * Remove unused TracerLoadError constant This constant was added in https://github.com/ruby/irb/commit/cb50fa3738121e4d829cb05b4bcb0d5fb43760c5 but never referenced. --------- https://github.com/ruby/irb/commit/7de0234325 Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
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.