Граф коммитов

36 Коммитов

Автор SHA1 Сообщение Дата
tomoya ishida f53209f023 [ruby/irb] Cache RDoc::RI::Driver.new
(https://github.com/ruby/irb/pull/911)

* Cache RDoc::RI::Driver.new to improve performance and to avoid flaky test

* Insert sleep to fix flaky rendering test that renders document dialog

https://github.com/ruby/irb/commit/da84e6cb56
2024-03-25 11:48:11 +00:00
tomoya ishida 82f4cff1f3 [ruby/irb] Fix indent test for new reline
(https://github.com/ruby/irb/pull/908)

https://github.com/ruby/irb/commit/7c16ce033e
2024-03-24 12:54:40 +00:00
tomoya ishida bda5b09937 [ruby/irb] Fix irb_history saved to current directory
(https://github.com/ruby/irb/pull/901)

* Always save irb_history in HOME or XDG_CONFIG_HOME

Also split irbrc search logic from irb_history search logic as a refactor

* Remove IRB.conf[:RC_NAME_GENERATOR] because it's not configurable

This conf is used to specify which irbrc to load. Need to configure before irbrc is loaded, so it's actually not configurable.
This conf is also used for history file search, but it is configurable by conf[:HISTORY_FILE].

* remove rc_file_test because it is tested with rc_files, remove useless test setup

* Make internal irbrc searching method private

https://github.com/ruby/irb/commit/11d03a6ff7
2024-03-16 15:20:03 +00:00
Stan Lo 07c774e85c [ruby/irb] Revamp `help` command
(https://github.com/ruby/irb/pull/877)

* Make help command display help for individual commands

Usage: `help [command]`

If the command is not specified, it will display a list of all available commands.

If the command is specified, it will display the banner OR description of the command.

If the command is not found, it will display a message saying that the command is not found.

* Rename test/irb/cmd to test/irb/command

* Add banner to edit and ls commands

* Promote help command in the help message

1. Make `show_cmds` an alias of `help` so it's not displayed in the help message
2. Update description of the help command to reflect `help <command>` syntax

* Rename banner to help_message

https://github.com/ruby/irb/commit/43a2c99f3f
2024-02-18 18:21:08 +00:00
Nuno Silva 1236a74023 [ruby/irb] Skip re-setup when creating a child session
(https://github.com/ruby/irb/pull/850)

https://github.com/ruby/irb/commit/06b2d00dd3
2024-02-01 12:12:06 +00:00
Stan Lo 66e0d92de5 [ruby/irb] Avoid completing empty input
(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-03 13:47:51 +00:00
Stan Lo 5c81fd6886 [ruby/irb] Remove redundant env cleanup in rendering test
(https://github.com/ruby/irb/pull/827)

https://github.com/ruby/irb/commit/99b0017d75
2024-01-01 10:57:17 +00:00
Stan Lo f193f96d31 [ruby/irb] Page evaluation result's output
(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-30 15:22:22 +00:00
Stan Lo a07d84b63c [ruby/irb] Hide debugger hint after the input is submitted
(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-27 10:34:40 +00:00
hogelog 68a03613d8 [ruby/irb] Fix flaky test case
test_autocomplete_with_multiple_doc_namespaces
(https://github.com/ruby/irb/pull/786)

https://github.com/ruby/irb/commit/85c6ddeb7d
2023-11-25 10:14:07 +00:00
Stan Lo e8b9058964 [ruby/irb] Hint debugger command in irb:rdbg session
(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 07:29:12 +00:00
tomoya ishida 631b500dd5 [ruby/irb] Fix irb crash on `{}.` completion
(https://github.com/ruby/irb/pull/764)

https://github.com/ruby/irb/commit/07e4d540cc
2023-11-18 17:49:06 +00:00
Stan Lo 85beca6e41 [ruby/irb] Use IRB's own doc for doc dialog tests
(https://github.com/ruby/irb/pull/743)

* Use IRB's own doc for doc dialog tests

* Run doc dialog tests for older Rubies too

* Remove unnecessary CI setups

https://github.com/ruby/irb/commit/97a2b86f0a
2023-10-30 18:22:02 +00:00
tomoya ishida 062eec7558 [ruby/irb] Add --nomultiline indent and prompt test
(https://github.com/ruby/irb/pull/699)

https://github.com/ruby/irb/commit/9b4aea753b
2023-08-29 15:34:49 +00:00
Summer ☀️ 0cd92819c9
[ruby/irb] Remove unused `PROMPT_N`
(https://github.com/ruby/irb/pull/685)

https://github.com/ruby/irb/commit/66e69fa0dc
2023-08-29 18:15:05 +09:00
Stan Lo 86ac17efde [ruby/irb] Move input processing out of RubyLex
(https://github.com/ruby/irb/pull/683)

* Add a test case for Ctrl-C handling

* Test symbol aliases with integration tests

There are a few places that also need to check symbol aliases before
`Irb#eval_input`. But since the current command test skip them, we
don't have test coverage on them.

* Move each_top_level_statement and readmultiline to Irb

This will save RubyLex from knowning information about commands and aliases.

https://github.com/ruby/irb/commit/69cb5b5615
2023-08-21 15:42:15 +00:00
tomoya ishida e1683b4958 [ruby/irb] Drop showing indent level number in DEFAULT prompt and
INF_RUBY prompt
(https://github.com/ruby/irb/pull/679)

* Drop showing indent level number in DEFAULT prompt and INF_RUBY prompt

* Update prompt part of test_rendering's expected result

https://github.com/ruby/irb/commit/3847532e54
2023-08-12 10:19:24 +00:00
Stan Lo 43721b1d4a [ruby/irb] Don't echo an expression's result when it ends with a
semicolon
(https://github.com/ruby/irb/pull/669)

https://github.com/ruby/irb/commit/50185c2833
2023-08-11 16:18:58 +00:00
Stan Lo 283b2fdab4 [ruby/irb] Page `ls`'s output (https://github.com/ruby/irb/pull/657)
* Page ls command's output

* Use Pager.page_content in show_cmds too

https://github.com/ruby/irb/commit/82d1687302
2023-07-26 08:32:02 +00:00
Stan Lo d8cee55073 [ruby/irb] Display `show_cmds`'s output in a pager when in TTY
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-25 18:33:23 +00:00
Stan Lo 4999a53fe9 [ruby/irb] Unpend RDoc dialog related tests
(https://github.com/ruby/irb/pull/640)

* Unpend rdoc dialog tests

Without these tests, we don't have any coverage on autocompletion's rdoc
dialog, which is what caused #638 to happen.

* Pull ri doc on CI for the doc dialog test

* Assert different screen result on CI and local machine

https://github.com/ruby/irb/commit/3ac96be660
2023-07-13 16:52:13 +00:00
tomoya ishida e25403d0d9 [ruby/irb] Improve indentation: bugfix, heredoc, embdoc, strings
(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-20 15:13:43 +00:00
lukeg 418cf344fb [ruby/irb] Fix 2 minor issues in test suite
* undefine Kernel#irb_original_require in without_rdoc method
* Don't rescue all LoadErrors/NameErrors in test_rendering.rb, just
the one for require 'yamatanooroti'

https://github.com/ruby/irb/commit/52b79806ea
2023-03-17 15:19:40 +00:00
Stan Lo 8abf9e6ad0 [ruby/irb] Test debug commands without yamatanooroti
(https://github.com/ruby/irb/pull/464)

* Add debug command tests that don't require yamatanooroti

* Remove debug command related yamatanooroti tests

As discussed in https://github.com/ruby/irb/pull/449#pullrequestreview-1187255149,
we should avoid adding new tests that need yamatanooroti because it's
not maintained by the Ruby org. And since debug commands are now tested
in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.

* Test against latest debug gem

https://github.com/ruby/irb/commit/78a8aa8834
2022-12-02 01:05:22 +00:00
Stan Lo ec76c9868b [ruby/irb] Activate yamatanooroti tests on CI
(https://github.com/ruby/irb/pull/459)

* Activate yamatanooroti tests on CI

* Fix delete test

https://github.com/ruby/irb/commit/750cf4c480
2022-11-27 06:09:50 +00:00
Takashi Kokubun c9fbc779a6 [ruby/irb] Add commands to start and use the debugger
(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-21 08:46:27 +00:00
tomoya ishida a09f764ce5 [ruby/irb] Always use local variables in current context to parse code (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 05:44:07 +00:00
aycabta 1251edd1db [ruby/irb] Add tests for truncated show doc dialog
But pending them now because they need dummy document data to show doc.

https://github.com/ruby/irb/commit/ac471ee14e
2021-10-08 10:34:20 +09:00
aycabta d86c1a3161 [ruby/irb] Add yamatanooroti test for symbol with backtick
https://github.com/ruby/irb/commit/4d32f0e88e
2021-09-10 04:59:25 +09:00
aycabta f6bc4b9b97 [ruby/irb] Use autocomplete with show doc dialog that uses Reline::Key in tests
https://github.com/ruby/irb/commit/142fc53e9c
2021-09-04 02:32:04 +09:00
aycabta 5458f23de2 [ruby/irb] Add TODO comment to remove disabling autocomplete later
https://github.com/ruby/irb/commit/856f001b60
2021-09-03 04:28:45 +09:00
aycabta 864b40176d [ruby/irb] Disable autocomplete in yamatanooroti test
https://github.com/ruby/irb/commit/cb9c9c64df
2021-09-03 04:28:38 +09:00
aycabta 3bbe860e50 [ruby/irb] Remove path settings for debugging
https://github.com/ruby/irb/commit/48029944a5
2021-08-30 02:33:29 +09:00
aycabta ab89c45b90 [ruby/irb] Evaluate each toplevel statement
https://github.com/ruby/irb/commit/bc1b1d8bc3
2021-04-03 01:17:08 +09:00
aycabta 254cd937c2 [ruby/irb] Add test for multiline paste
https://github.com/ruby/irb/commit/e93c9cb54d
2021-04-03 01:15:46 +09:00
aycabta 0eb1491957 [ruby/irb] Add yamatanooroti test example
https://github.com/ruby/irb/commit/279155fcee
2021-04-03 01:14:31 +09:00