(https://github.com/ruby/irb/pull/737)
* Show easter-egg inside document dialog in autocomplete mode
* Show more easter_egg(dancing or logo) when Alt+d is pressed in autocomplete mode
a8e5cc7354
refactored for future extension
(https://github.com/ruby/irb/pull/707)
* Move completion implementation to completion/regexp_completor for future extension
* Remove constant CompletionProc and PerfectMatchedProc and add a class method
* Move document display logic to InputCompletor. Each completor only need to implement `completion_caididates` and `doc_namespace`
* Move display_document logic to RelineInputMethod
* Use RegexpCompletor directly. Not through class method of InputCompletor.
* RegexpCompletor extends BaseCompletor, move back definition to completion.rb
* Move display_document test to input_method test
* Stop re-initialize completor on each completion phase
* Store completor to ReadlineInputMethod's iver
1e98521483
(https://github.com/ruby/irb/pull/725)
Since `debug` stores and updates the target thread via its Session's
`@tc` variable, we don't need to and shouldn't lock the UI to the thread
that activates the integration.
202efdbf0c
(https://github.com/ruby/irb/pull/684)
After this change, `RubyLex` will not interact with `Context` directly
in any way. This decoupling has a few benefits:
- It makes `RubyLex` easier to test as it no longer has a dependency on
`Context`. We can see this from the removal of `build_context` from
`test_ruby_lex.rb`.
- It will make `RubyLex` easier to understand as it will not be affected
by state changes in `Context` objects.
- It allows `RubyLex` to be used in places where `Context` is not available.
d5b262a076
(https://github.com/ruby/irb/pull/651)
* handle concurrent sessions and saving Readline::HISTORY, fixes https://github.com/ruby/irb/pull/510
* separate tests
* don't mutate the HISTORY object on the class
* avoid repeated .to_i calls
* remove intermediary history array
* work with array, fix test comment
---------
1681ada328
Co-authored-by: Stan Lo <stan001212@gmail.com>
(https://github.com/ruby/irb/pull/704)
1. The newer versions of rdoc requires pysch 4.0+, which could break apps
using Ruby 3.0 or 2.7. #703 has more detailed explanation on this.
2. We actually don't use any version-specific rdoc APIs. So having a version
requirement is not necessary atm.
3e6ba78c42
(https://github.com/ruby/irb/pull/692)
`RubyLex` has always been a private component of IRB, so we should
explicitly discourage usages of it.
Also, it should be placed under the `IRB` module like other components.
069b5625f7
integration
(https://github.com/ruby/irb/pull/688)
* Avoid overriding user's irb_name setting in debugger integration
Instead of always setting `irb_name` to `irb:rdbg`, it should respect
the user's setting and only append `:rdbg` to it.
* Introduce write_rc test helper
2ce7593351
(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.
69cb5b5615
(https://github.com/ruby/irb/pull/686)
* Support `VISUAL` env var, and prefer it over `EDITOR`
* Update test/irb/test_cmd.rb
---------
399b872c31
Co-authored-by: Stan Lo <stan001212@gmail.com>
(https://github.com/ruby/irb/pull/575)
* Support native integration with ruby/debug
* Prevent using multi-irb and activating debugger at the same time
Multi-irb makes a few assumptions:
- IRB will manage all threads that host sub-irb sessions
- All IRB sessions will be run on the threads created by IRB itself
However, when using the debugger these assumptions are broken:
- `debug` will freeze ALL threads when it suspends the session (e.g. when
hitting a breakpoint, or performing step-debugging).
- Since the irb-debug integration runs IRB as the debugger's interface,
it will be run on the debugger's thread, which is not managed by IRB.
So we should prevent the 2 features from being used at the same time.
To do that, we check if the other feature is already activated when
executing the commands that would activate the other feature.
d8fb3246be
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
3847532e54
StdioInputMethod
(https://github.com/ruby/irb/pull/671)
They are both built on top of stdio and are basically extended version
of StdioInputMethod. They also share several attributes and methods with
StdioInputMethod.
c5f5abdbde
(https://github.com/ruby/irb/pull/670)
Since assignment check relies on tokenization with `Ripper`, it feels like
the responsibility of `RubyLex`. `Irb#eval_input` should simply get the result
when calling `each_top_level_statement` on `RubyLex`.
89d1adb3fd
(https://github.com/ruby/irb/pull/652)
1. Dynamically including `HistorySavingAbility` makes things unnecessarily
complicated and should be avoided.
2. Because both `Reline` and `Readline` use a single `HISTORY` constant
to store history data. When nesting IRB sessions, only the first IRB
session should handle history loading and saving so we can avoid
duplicating history.
3. History saving callback should NOT be stored in `IRB.conf` as it's
recreated every time `IRB.setup` is called, which would happen when
nesting IRB sessions.
0fef0ae160
(https://github.com/ruby/irb/pull/635)
* Remove unused InputMethod#initialize
The constructor takes a `file_name` argument, but it is never used. The
only input method that needs a file is `FileInputMethod`, which has its
own constructor to take a file object directly.
So the constructor in `InputMethod` is not needed and its child classes
don't need to call `super` in their constructors.
* Remove unused FileInputMethod#file_name
153b1e9d1c
(https://github.com/ruby/irb/pull/654)
* Deprecate multi-irb commands
- Print deprecated message when any of the commands are used
- Put related commands under `Multi-irb` category with a deprecated
label
* Update readme
861731ac12
(https://github.com/ruby/irb/pull/658)
* Decouple `edit` command from `show_source`
2 commands should not depend on each other. If `edit` command also needs
to find a source, the source finding logic should be extracted into a
separate class.
* Return nil if is not an actual file path
* Refactor SourceFinder
9790517a0c
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>`
f94e8a66dd
(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.
4dffbb1dd3
(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.
- 3ac96be660/lib/irb/history.rb (L10)
- 3ac96be660/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`.
aec7a5b3f5