Repository navigation
irb: TypeCompletor as on CRuby, and ANSI colours in a classic conhost - #68
Merged
Merged
Conversation
…does MRI sets ENABLE_VIRTUAL_TERMINAL_PROCESSING on a console it writes to, so the console itself interprets ANSI escapes. IronRuby never did. Windows Terminal has the mode on anyway, but a classic conhost window starts with it off (stdout mode 0x0003), and irb - IRB::Color.colorable? only asks tty? - sent its colours and reline its cursor movements there as literal text. The console host now ORs the flag into the mode of stdout and stderr when they are a console; pipes and files are left alone, and on Windows before 10, which has no such mode, SetConsoleMode fails and nothing changes. Checked in a fresh conhost window: the mode is 0x0007, as under CRuby 4.0.9.
… rbs 4.0.0.dev.5 irb's default completor on Ruby >= 3.4 is TypeCompletor, from the bundled gem repl_type_completor. IronRuby did not ship it - install-bundled-gems.rb skipped it and rbs as "depends on rbs" - so `require 'repl_type_completor'` was a LoadError and irb fell back to RegexpCompletor without a word. Its candidates and their order differ from CRuby's. rbs runs here now (rbs_extension on librbs), but on the rbs release librbs is built from, 4.0.0.dev.5, not the 3.10.0 CRuby 4.0.9 bundles, and repl_type_completor before 0.1.14 asks for rbs < 4. So both come from rubygems.org instead of the CRuby tarball, through a new FROM_RUBYGEMS table that pins each .gem by SHA-256. repl_type_completor's prism ~> 1.0 needs no change: IronRuby's RubyGems already reads it as >= 1.0 against its prism 2.0.0 (IRONRUBY_LIFTED_REQUIREMENTS), and ruby/repl_type_completor#81 lifts it upstream. With the same mechanism minitest's installed gemspec now says prism >= 1.5, which is what an install under IronRuby writes. Checked with the checkout's build: irb's build_completor returns IRB::TypeCompletor, and its candidates for Stri, 1.ti, "abc".up and [1,2].ma are CRuby's. The other 26 bundled gems already were at CRuby 4.0.9's versions; --check against its tarball reports ok. Util/build-librbs.sh compared the committed bridge byte for byte with the generated one, which fails in a Windows checkout with core.autocrlf; it now ignores CRs.
|
Important Review skippedToo many files! This PR contains 560 files, which is 460 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things irb on Windows did differently from CRuby 4.0.9.
1. irb completes with
TypeCompletorirb's default completor on Ruby >= 3.4 is
TypeCompletor, from the bundled gemrepl_type_completor. IronRuby did not ship it, so irb fell back toRegexpCompletorwithout a word, and its candidates and their order differed from CRuby's.Util/install-bundled-gems.rbgets aFROM_RUBYGEMStable. It installs rbs 4.0.0.dev.5, the releaselibrbs/rbs_extensionis built from, and repl_type_completor 0.1.16; versions before 0.1.14 refuse rbs 4. Both come from rubygems.org, each pinned by SHA-256. CRuby 4.0.9 bundles rbs 3.10.0 and repl_type_completor 0.1.12.prism ~> 1.0. That needs no change: IronRuby's RubyGems already reads it as>= 1.0(IRONRUBY_LIFTED_REQUIREMENTS), and Allow repl_type_completor to be used with Prism 2 ruby/repl_type_completor#81 would lift it upstream. Through the same mechanism, minitest's installed gemspec now says>= 1.5.--checkagainst the 4.0.9 tarball reportsok.Util/build-librbs.shignores CRs when it compares the generated bridge, so it builds in a Windows checkout withcore.autocrlf.2. VT processing in the Windows console
MRI turns on
ENABLE_VIRTUAL_TERMINAL_PROCESSINGfor a console it writes to; IronRuby didn't. In a classic conhost window (mode0x0003), irb's colours and reline's cursor movements were sent as literal text. The console host now sets the flag on stdout and stderr when they are a console.Checked
build_completorreturnsIRB::TypeCompletor, and the candidates forStri,1.ti,"abc".upand[1,2].mamatch CRuby's.0x0007, as under CRuby.IronRuby.TestsandUtil/gems/run.sh; CI will.