In the existing implementation, `main_type` and `sub_type` would end up
being called multiple times potentially.
Instead of doing that, save the result so it can be re-used.
179976f7ea
(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
The dedicated method `File.path` to deal with pathname-like objects
has been provided since ruby 1.9.0.
Also adds a test for rubygems/rubygems#6837.
258c6eda80
This reverts commit db80e947a3.
This patch uses `Thread.abort_on_exception = true` and it affects
all of threads. This is why CI systems fails.
How to modify:
- use `thread.abort_on_exception = true` for specific threads
- Run this code in a separated process