lib/ruby_lsp/requests/workspace_symbol.rb in ruby-lsp-0.17.3 vs lib/ruby_lsp/requests/workspace_symbol.rb in ruby-lsp-0.17.4
- old
+ new
@@ -50,39 +50,19 @@
# short name `Bar`, then searching for `Foo::Bar` would not return any results
*container, _short_name = entry.name.split("::")
Interface::WorkspaceSymbol.new(
name: entry.name,
- container_name: T.must(container).join("::"),
+ container_name: container.join("::"),
kind: kind,
location: Interface::Location.new(
uri: URI::Generic.from_path(path: file_path).to_s,
range: Interface::Range.new(
start: Interface::Position.new(line: loc.start_line - 1, character: loc.start_column),
end: Interface::Position.new(line: loc.end_line - 1, character: loc.end_column),
),
),
)
- end
- end
-
- private
-
- 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