Skip to content

Repeatedly load sig directory from loaded gems - #32

Draft
tompng wants to merge 1 commit into
mainfrom
load_gem_rbs
Draft

Repeatedly load sig directory from loaded gems#32
tompng wants to merge 1 commit into
mainfrom
load_gem_rbs

Conversation

@tompng

@tompngtompng commented Jun 23, 2024

Copy link
Copy Markdown
Member

Loads rbs defined in gem sig directory.
Adds ReplTypeCompletor.reload_rbs, which should be called from IRB in InputMethod#gets

classIRB::TypeCompletordefreloadReplTypeCompletor.reload_rbsrescuenilendendclassIRB::ReadlineInputMethod < StdioInputMethoddefgets@completor.reload
...
endend

ReplTypeCompletor reloads rbs when additional gem is loaded (by checking $LOADED_FEATURES difference)

# loads sig defined in required gems
irb(main):001> Prism.parse('1').value.statements.b
'1').value.statements.body
irb(main):002> require 'rmagick'
irb(main):003> # Automatically loads rmagic/sig/*.rbs in another thread
irb(main):003> pix = Magick::Pixel.new; pix.red.ab
pix.red.abs pix.red.abs2

@tompngtompng changed the title Add ReplTypeCompletor.reload_rbs to load rbs in newly required gemLoad sig directory from gemJun 23, 2024
@tompngtompng added the enhancement New feature or request label Jun 23, 2024
@tompngtompng changed the title Load sig directory from gemRepeatedly load sig directory from loaded gemsOct 8, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@tompng