summaryrefslogtreecommitdiff
path: root/lib/irb
AgeCommit message (Collapse)Author
2023-07-25[ruby/irb] Display `show_cmds`'s output in a pager when in TTYStan Lo
environment (https://github.com/ruby/irb/pull/647) This can: - Make it easier to scroll up and down the commands list - Avoid pushing up users' previous output - Allow users to do basic search with `/<word>` https://github.com/ruby/irb/commit/f94e8a66dd
2023-07-18[ruby/irb] Declare rdoc as dependencyStan Lo
(https://github.com/ruby/irb/pull/648) IRB already has several features that rely on rdoc, such as: - Autocompletion's document dialog - Autocompletion's `PerfectMatchedProc` - The `show_doc` command - Easter egg And we could use its pager more in the future too. So it makes sense to declare rdoc as a dependency instead of relying on the one bundled with Ruby. https://github.com/ruby/irb/commit/4dffbb1dd3
2023-07-15[ruby/irb] Indent multiline percent literalstomoya ishida
(https://github.com/ruby/irb/pull/643) https://github.com/ruby/irb/commit/18bb4022a9
2023-07-15[ruby/irb] Bump 1.7.4 (https://github.com/ruby/irb/pull/645)ima1zumi
https://github.com/ruby/irb/commit/b0f650a766
2023-07-14[ruby/irb] Fix history-saving featureStan Lo
(https://github.com/ruby/irb/pull/642) * Define RelineInputMethod::HISTORY The HistorySavingAbility module doesn't do anything if the input method class doesn't define HISTORY. - https://github.com/ruby/irb/blob/3ac96be660bf052902fb4e532c7a46cf294b71eb/lib/irb/history.rb#L10 - https://github.com/ruby/irb/blob/3ac96be660bf052902fb4e532c7a46cf294b71eb/lib/irb/history.rb#L34 This patch defines RelineInputMethod::HISTORY to avoid this. * Improve history-saving's ability check Instead of checking the existence of `input_method_class::HISTORY`, we should make every input method class declare if it supports history saving or not. Since the default value is `false`, it shouldn't break any custom input method that inherits from `IRB::InputMethod`. https://github.com/ruby/irb/commit/aec7a5b3f5
2023-07-13[ruby/irb] Bump version to 1.7.3Stan Lo
(https://github.com/ruby/irb/pull/639) https://github.com/ruby/irb/commit/621c8c2b7d
2023-07-12[ruby/irb] Correct preferred_dialog_height's callerStan Lo
(https://github.com/ruby/irb/pull/638) The caller should be the dialog itself, not Reline. https://github.com/ruby/irb/commit/418c2b945e
2023-07-11[ruby/irb] Bump version to 1.7.2ima1zumi
(https://github.com/ruby/irb/pull/636) https://github.com/ruby/irb/commit/85d6b4d146
2023-07-11[ruby/irb] Require Reline 0.3.6 or higherima1zumi
(https://github.com/ruby/irb/pull/632) * Require Reline 0.3.6 or higher "Multi-line multibyte regular expression raises exception" (https://github.com/ruby/irb/issues/627) is fixed in Reline 0.3.6. * Remove unnecessary conditional
2023-07-09[ruby/irb] Avoid using Reline as a moduleStan Lo
(https://github.com/ruby/irb/pull/633) Using it as a module makes it harder to understand methods' source.
2023-07-04[ruby/irb] Use `max_by` for `longest_cmd_name_length`Andy Waite
(https://github.com/ruby/irb/pull/628) https://github.com/ruby/irb/commit/5e87f3bfdd Co-authored-by: Andy Waite <andyw8@users.noreply.github.com>
2023-07-04[ruby/irb] Refactor eval historyStan Lo
(https://github.com/ruby/irb/pull/623) * Rename `ext/history.rb` to `ext/eval_history.rb` To confusion with `lib/irb/history.rb` * Add eval_history tests * Rename eval_history's History to EvalHistory to avoid confusion
2023-07-03[ruby/irb] Stop treating history-saving logic as extensionStan Lo
(https://github.com/ruby/irb/pull/613) Since `IRB.conf[:SAVE_HISTORY]` is assigned with 1000 by default, history-saving is a feature enabled by default. So it should not be treated as an extension, which adds unnecessary complexity to the code.
2023-07-02[ruby/irb] Bump version to 1.7.1Stan Lo
(https://github.com/ruby/irb/pull/621) https://github.com/ruby/irb/commit/b9a9dd97df
2023-06-30[ruby/irb] Reduce internal operations' exposure to benchmarkingStan Lo
(https://github.com/ruby/irb/pull/618) * Test last value is assigned with measure enabled * Remove unnecessary `result` variable `Context#evaluate` always assigns the result of the evaluation to `_` so we don't need to do it in `Irb#eval_input`. * Move benchmarking logic into `Context#evaluate` Current location of the benchmarking logic is too high up and includes operations like command loading and argument transformation, which should be excluded. So this commit moves it into `Context#evaluate` to reduce the noise. We don't move it further down to `Workspace#evaluate` because `Context` is an argument of the measure block, which is not available in `Workspace`.
2023-06-30[ruby/irb] Re-implement prev_spaces feature for pasted codetomoya ishida
(https://github.com/ruby/irb/pull/607) https://github.com/ruby/irb/commit/9d97a192a5
2023-06-27[ruby/irb] Remove keyword exception from Context#evaluate becausetomoya ishida
the value is always nil (https://github.com/ruby/irb/pull/617) https://github.com/ruby/irb/commit/62691384f8
2023-06-27[ruby/irb] Move input line mutation out of `Context#evaluate`Stan Lo
(https://github.com/ruby/irb/pull/615) This makes sure `Context#evaluate` really just evaluates the input. It will also make #575's implementation cleaner.
2023-06-25[ruby/irb] Fix process_continue(rename to should_continue?) andtomoya ishida
check_code_block(rename to check_code_syntax) (https://github.com/ruby/irb/pull/611) https://github.com/ruby/irb/commit/b7f4bfaaa4
2023-06-24[ruby/irb] Omit nesting_level, use indent_level to build prompttomoya ishida
string (https://github.com/ruby/irb/pull/610) https://github.com/ruby/irb/commit/f01ff0811b
2023-06-20[ruby/irb] Improve indentation: bugfix, heredoc, embdoc, stringstomoya ishida
(https://github.com/ruby/irb/pull/515) * Implement heredoc embdoc and string indentation with bugfix * Fix test_ruby_lex's indentation value * Add embdoc indent test * Add workaround for lines==[nil] passed to auto_indent when exit IRB with CTRL+d
2023-06-19[ruby/irb] Add missing token that ignored by rippertomoya ishida
(https://github.com/ruby/irb/pull/608) https://github.com/ruby/irb/commit/1cd3b45402
2023-06-15[ruby/irb] Rewrite RubyLex to fix some bugs and make it possible totomoya ishida
add new features easily (https://github.com/ruby/irb/pull/500) * Add nesting level parser for multiple use (indent, prompt, termination check) * Rewrite RubyLex using NestingParser * Add nesting parser tests, fix some existing tests * Add description comment, rename method to NestingParser * Add comments and tweak code to RubyLex * Update NestingParser test * Extract list of ltype tokens to constants
2023-06-13[ruby/irb] Use symbol.inspect instead of ":"+symbol.id2name to avoidtomoya ishida
completion candidates including newline characters (https://github.com/ruby/irb/pull/539) https://github.com/ruby/irb/commit/aaf0c46645
2023-06-10[ruby/irb] Use `Kernel.warn` to print command alias warningStan Lo
(https://github.com/ruby/irb/pull/601) This aligns with other warnings in irb and properly channel the message to stderr.
2023-06-10[ruby/irb] Remove the unused fork command definitionStan Lo
(https://github.com/ruby/irb/pull/600) https://github.com/ruby/irb/commit/b039b89343
2023-06-05[ruby/irb] Refactor ExtendCommand::NopStan Lo
(https://github.com/ruby/irb/pull/598) * Rename conf to irb_context * Drop Nop#irb method because it's only used by irb/ext/loader.rb We don't need to expose this method to all command classes, especially when it's just an alias of `irb_context.irb`.
2023-06-05[ruby/irb] Simplify irb_info commandStan Lo
(https://github.com/ruby/irb/pull/597) https://github.com/ruby/irb/commit/0a0409c52b
2023-06-05[ruby/irb] Fixed string escaping omissionsima1zumi
(https://github.com/ruby/irb/pull/599) I received a `RegexpError` when I typed `::Array[`. ::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
2023-06-04[ruby/irb] Bump version to 1.7.0Stan Lo
(https://github.com/ruby/irb/pull/596) https://github.com/ruby/irb/commit/c2e7002867
2023-05-28[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
2023-05-23[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?`
2023-05-19[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>
2023-05-19[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