irb icon indicating copy to clipboard operation
irb copied to clipboard

Completion of require_relative path is wrong when `Dir.pwd != __dir__`

Open tompng opened this issue 1 year ago • 1 comments

Description

Prepare these directory and files

$ mkdir foo
$ echo binding.irb > foo/foobar.rb
$ echo "require'./foo/foobar.rb'" > main.rb

Then execute ruby main.rb

$ ruby main.rb
From: /Users/tomoya.ishida/Desktop/tmp/foo/bar.rb @ line 1 :

 => 1: binding.irb

irb(main):002> require_relative 'f
                                'foo/foobar

The completion should be 'foobar, not 'foo/foobar. require_relative will load relative path from __dir__, not from pwd.

Result of irb_info

Ruby version: 3.2.2
IRB version: irb 1.9.0 (2023-11-11)
InputMethod: RelineInputMethod with Reline 0.4.0
Completion: Autocomplete, RegexpCompletor
RUBY_PLATFORM: arm64-darwin22
LANG env: ja_JP.UTF-8
East Asian Ambiguous Width: 1

Terminal Emulator

Terminal.app

Setting Files

No

tompng avatar Nov 18 '23 13:11 tompng

Solved in TypeCompletor(repl_type_completor 0.1.2), problem remains in RegexpCompletor

tompng avatar Dec 29 '23 05:12 tompng