use RBS::Environment, RBS::TypeName use Steep::TypeInference::MethodCall module Steep module Services class CompletionProvider include NodeHelper # Cursor position class Position attr_reader line: Integer attr_reader column: Integer def initialize: (line: Integer, column: Integer) -> void def -: (Integer) -> Position end class Range attr_reader start: Position attr_reader end: Position def initialize: (start: Position, end: Position) -> void end class InstanceVariableItem attr_reader identifier: Symbol attr_reader range: Range attr_reader type: AST::Types::t def initialize: (identifier: Symbol, range: Range, type: AST::Types::t) -> void end class KeywordArgumentItem attr_reader identifier: String attr_reader range: Range def initialize: (identifier: String, range: Range) -> void end class LocalVariableItem attr_reader identifier: Symbol attr_reader range: Range attr_reader type: AST::Types::t def initialize: (identifier: Symbol, range: Range, type: AST::Types::t) -> void end class ConstantItem attr_reader env: Environment attr_reader identifier: Symbol attr_reader range: Range attr_reader type: AST::Types::t attr_reader full_name: TypeName def initialize: (env: Environment, identifier: Symbol, range: Range, type: AST::Types::t, full_name: TypeName) -> void def class?: () -> bool def module?: () -> bool def comments: () -> Array[RBS::AST::Comment?] type const_decl = RBS::AST::Declarations::Constant | RBS::AST::Declarations::Class | RBS::AST::Declarations::Module | RBS::AST::Declarations::ClassAlias | RBS::AST::Declarations::ModuleAlias def decl: () -> const_decl end # Method name completion item with *simple* receiver type # # Instance type, Singleton type, Interface type is simple. # The item may have multiple overloads, but must have single method definition source. # class SimpleMethodNameItem attr_reader identifier: Symbol attr_reader range: Range attr_reader receiver_type: AST::Types::Name::Instance | AST::Types::Name::Interface | AST::Types::Name::Singleton attr_reader method_types: Array[RBS::MethodType] attr_reader method_name: method_name attr_reader method_member: RBS::Definition::Method::method_member def initialize: ( identifier: Symbol, range: Range, receiver_type: AST::Types::Name::Instance | AST::Types::Name::Interface | AST::Types::Name::Singleton, method_name: method_name, method_types: Array[RBS::MethodType], method_member: RBS::Definition::Method::method_member ) -> void %a{pure} def comment: () -> RBS::AST::Comment? end # Method name completion item with *complex* receiver type # # The item may have multiple overloads and multiple method declarations. # class ComplexMethodNameItem attr_reader identifier: Symbol attr_reader range: Range attr_reader reeiver_type: AST::Types::t attr_reader method_types: Array[RBS::MethodType] attr_reader method_decls: Array[MethodCall::MethodDecl] def initialize: ( identifier: Symbol, range: Range, method_types: Array[RBS::MethodType], method_decls: Array[MethodCall::MethodDecl], receiver_type: AST::Types::t ) -> void def method_names: () -> Array[method_name] def method_definitions: () -> Hash[method_name, RBS::Definition::Method::method_member] def defining_method_name: (TypeName, Symbol name, RBS::Definition::Method::method_member) -> method_name end # Method name completion item for generated methods, like `#first` in tuple types # # The generated methods doesn't have associated `MethodDecl`. # class GeneratedMethodNameItem attr_reader identifier: Symbol attr_reader range: Range attr_reader reeiver_type: AST::Types::t attr_reader method_types: Array[RBS::MethodType] def initialize: ( identifier: Symbol, range: Range, receiver_type: AST::Types::t, method_types: Array[RBS::MethodType] ) -> void end class TypeNameItem attr_reader env: Environment attr_reader absolute_type_name: TypeName attr_reader relative_type_name: TypeName attr_reader range: Range def initialize: (absolute_type_name: TypeName, relative_type_name: TypeName, env: Environment, range: Range) -> void def decl: () -> Server::LSPFormatter::summarizable_decl def comments: () -> Array[RBS::AST::Comment] end class TextItem attr_reader label: String attr_reader text: String attr_reader help_text: String? attr_reader range: Range def initialize: (text: String, help_text: String?, range: Range, label: String) -> void end type item = InstanceVariableItem | KeywordArgumentItem | LocalVariableItem | ConstantItem | SimpleMethodNameItem | ComplexMethodNameItem | GeneratedMethodNameItem | TypeNameItem | TextItem attr_reader source_text: String attr_reader path: Pathname attr_reader subtyping: Subtyping::Check attr_reader modified_text: String attr_reader source: Source attr_reader typing: Typing def initialize: (source_text: String, path: Pathname, subtyping: Subtyping::Check) -> void def type_check!: (String text, line: Integer, column: Integer) -> void def env: () -> Environment def run: (line: Integer, column: Integer) -> Array[item] def range_from_loc: (Parser::Source::Range loc) -> Range def at_comment?: (Position pos) -> Parser::Source::Comment? def at_end?: (Position pos, of: Parser::Source::Map | Parser::Source::Range | nil) -> boolish def range_for: (Position position, ?prefix: ::String) -> Range def items_for_trigger: (position: Position) -> Array[item] def items_for_dot: (position: Position) -> Array[item] def items_for_qcall: (position: Position) -> Array[item] def items_for_colon2: (position: Position) -> Array[item] def items_for_atmark: (position: Position) -> Array[item] def items_for_rbs: (position: Position, buffer: RBS::Buffer) -> Array[item] def items_for_following_keyword_arguments: (String text, index: Integer, line: Integer, column: Integer, items: Array[item]) -> void def method_items_for_receiver_type: (AST::Types::t, include_private: bool, prefix: String, position: Position, items: Array[item]) -> void def word_name?: (String name) -> bool def local_variable_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[item]) -> void def constant_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[item], ?parent: Parser::AST::Node?) -> void def instance_variable_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[item]) -> void def keyword_argument_items_for_method: (call_node: Parser::AST::Node, send_node: Parser::AST::Node, position: Position, prefix: String, items: Array[item]) -> void def index_for: (String, line: Integer, column: Integer) -> Integer def disallowed_method?: (Symbol name) -> bool def unwrap_optional: (AST::Types::t) -> AST::Types::t end end end