6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/steep/locator.rb', line 6
def type_name_at(position, type)
buffer = type.location&.buffer or raise
locator = RBS::Locator.new(buffer: buffer, decls: [], dirs: [])
components = []
if locator.find_in_type(position, type: type, array: components)
symbol, type, * = components
if symbol.is_a?(Symbol)
case type
when RBS::Types::ClassInstance, RBS::Types::ClassSingleton, RBS::Types::Alias, RBS::Types::Interface
if symbol == :name
type_loc = type.location or raise
name_loc = type.location[:name]
return [type.name, name_loc]
end
end
end
end
end
|