diff --git a/lib/steep/services/signature_help_provider.rb b/lib/steep/services/signature_help_provider.rb index 515a4c985..b5a12dd38 100644 --- a/lib/steep/services/signature_help_provider.rb +++ b/lib/steep/services/signature_help_provider.rb @@ -14,12 +14,7 @@ def env def initialize(source:, subtyping:) @source = source @subtyping = subtyping - - text = - if source.node - source.node.loc.expression.source - end - @buffer = RBS::Buffer.new(name: source.path, content: text || "") + @buffer = source.buffer end def run(line:, column:) diff --git a/test/signature_help_provider_test.rb b/test/signature_help_provider_test.rb index 22d0df66a..e1f4257e1 100644 --- a/test/signature_help_provider_test.rb +++ b/test/signature_help_provider_test.rb @@ -35,11 +35,12 @@ def self.foo: (String, Integer) -> Array[Symbol] end RBS source = Source.parse(<<~RUBY, path: Pathname("a.rb"), factory: checker.factory) + # Show signature help for a commented method call TestClass.foo("", 123) RUBY SignatureHelpProvider.new(source: source, subtyping: checker).tap do |provider| - items, index = provider.run(line: 1, column: 14) + items, index = provider.run(line: 2, column: 14) assert_equal 0, index assert_equal ["(::String, ::Integer) -> ::Array[::Symbol]", "() -> ::Array[::Symbol]"], items.map(&:method_type).map(&:to_s)