lib/ruby_lsp/requests/support/common.rb in ruby-lsp-0.17.3 vs lib/ruby_lsp/requests/support/common.rb in ruby-lsp-0.17.4
- old
+ new
@@ -24,11 +24,11 @@
),
end: Interface::Position.new(line: loc.end_line - 1, character: loc.end_column),
)
end
- sig { params(location: Prism::Location).returns(Interface::Range) }
+ sig { params(location: T.any(Prism::Location, RubyIndexer::Location)).returns(Interface::Range) }
def range_from_location(location)
Interface::Range.new(
start: Interface::Position.new(
line: location.start_line - 1,
character: location.start_column,
@@ -182,9 +182,27 @@
current = T.let(node, T.nilable(Prism::Node))
while current.is_a?(Prism::ConstantPathNode)
block.call(current)
current = current.parent
+ end
+ end
+
+ sig { params(entry: RubyIndexer::Entry).returns(T.nilable(Integer)) }
+ def kind_for_entry(entry)
+ case entry
+ when RubyIndexer::Entry::Class
+ Constant::SymbolKind::CLASS
+ when RubyIndexer::Entry::Module
+ Constant::SymbolKind::NAMESPACE
+ when RubyIndexer::Entry::Constant
+ Constant::SymbolKind::CONSTANT
+ when RubyIndexer::Entry::Method
+ entry.name == "initialize" ? Constant::SymbolKind::CONSTRUCTOR : Constant::SymbolKind::METHOD
+ when RubyIndexer::Entry::Accessor
+ Constant::SymbolKind::PROPERTY
+ when RubyIndexer::Entry::InstanceVariable
+ Constant::SymbolKind::FIELD
end
end
end
end
end