From 8fd7dfbeee749ba9ec7bd3c22f7c53ced79859d7 Mon Sep 17 00:00:00 2001 From: Kaan Ozkan Date: Thu, 13 Jun 2024 17:41:00 -0400 Subject: [PATCH 01/30] Introduce DslGenerate#generate_without_booting for LSP addon --- lib/tapioca/commands/abstract_dsl.rb | 2 ++ lib/tapioca/commands/dsl_generate.rb | 12 ++++++++++++ lib/tapioca/dsl/pipeline.rb | 7 +++++++ lib/tapioca/loaders/dsl.rb | 15 +++++++++++++-- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/lib/tapioca/commands/abstract_dsl.rb b/lib/tapioca/commands/abstract_dsl.rb index 3395afd53..78e29092d 100644 --- a/lib/tapioca/commands/abstract_dsl.rb +++ b/lib/tapioca/commands/abstract_dsl.rb @@ -153,8 +153,10 @@ def existing_rbi_filenames(requested_constants, path: @outpath) sig { params(constant_names: T::Array[String], ignore_missing: T::Boolean).returns(T::Array[Module]) } def constantize(constant_names, ignore_missing: false) constant_map = constant_names.to_h do |name| + puts "Constantize: #{name}" [name, Object.const_get(name)] rescue NameError + puts "NameError for #{name}" [name, nil] end diff --git a/lib/tapioca/commands/dsl_generate.rb b/lib/tapioca/commands/dsl_generate.rb index ef1762666..217ac2801 100644 --- a/lib/tapioca/commands/dsl_generate.rb +++ b/lib/tapioca/commands/dsl_generate.rb @@ -4,12 +4,24 @@ module Tapioca module Commands class DslGenerate < AbstractDsl + # LSP entrypoint + sig { void } + def generate_without_booting + Loaders::Dsl.load_subset + generate + end + private + # CLI entrypoint sig { override.void } def execute load_application + generate + end + sig { void } + def generate say("Compiling DSL RBI files...") say("") diff --git a/lib/tapioca/dsl/pipeline.rb b/lib/tapioca/dsl/pipeline.rb index eb620a0d5..6728e42ed 100644 --- a/lib/tapioca/dsl/pipeline.rb +++ b/lib/tapioca/dsl/pipeline.rb @@ -120,6 +120,8 @@ def compilers end, T.nilable(T::Array[T.class_of(Compiler)]), ) + puts "Compilers: #{@compilers}" + @compilers end private @@ -145,10 +147,14 @@ def gather_active_compilers(requested_compilers, excluded_compilers) ).returns(T::Set[Module]) end def gather_constants(requested_constants, requested_paths, skipped_constants) + puts "Requested constants: #{requested_constants}" constants = Set.new.compare_by_identity + + puts "Active compilers: #{active_compilers}" active_compilers.each do |compiler| constants.merge(compiler.processable_constants) end + puts "Gathered constants 1 : #{constants}" constants = filter_anonymous_and_reloaded_constants(constants) constants -= skipped_constants @@ -161,6 +167,7 @@ def gather_constants(requested_constants, requested_paths, skipped_constants) "#{requested_and_skipped}. Check the supplied arguments and your `sorbet/tapioca/config.yml` file.") end end + puts "Gathered constants 2: #{constants}" constants end diff --git a/lib/tapioca/loaders/dsl.rb b/lib/tapioca/loaders/dsl.rb index 8635fff29..162759219 100644 --- a/lib/tapioca/loaders/dsl.rb +++ b/lib/tapioca/loaders/dsl.rb @@ -21,6 +21,19 @@ def load_application(tapioca_path:, eager_load: true, app_root: ".", halt_upon_l ) loader.load end + + sig { void } + def load_subset + loader = new( + tapioca_path: Tapioca::TAPIOCA_DIR, + eager_load: false, + app_root: ".", + halt_upon_load_error: true, + ) + puts "Loader instantiated" + loader.load_dsl_extensions + loader.load_dsl_compilers + end end sig { override.void } @@ -30,8 +43,6 @@ def load load_dsl_compilers end - protected - sig do params(tapioca_path: String, eager_load: T::Boolean, app_root: String, halt_upon_load_error: T::Boolean).void end From 5078e323ffb345961a5012dab2aef964bc02b2d2 Mon Sep 17 00:00:00 2001 From: Kaan Ozkan Date: Wed, 3 Jul 2024 16:02:35 -0400 Subject: [PATCH 02/30] Implement Tapioca::Addon Prototype retrieving stdin from Rails addon, sending messages to it which triggers DSL generation --- lib/ruby_lsp/tapioca/addon.rb | 79 + lib/tapioca/internal.rb | 1 + sorbet/config | 1 + sorbet/rbi/gems/ruby-lsp@0.17.4.rbi | 4864 +++++++++++++++++++++++++++ 4 files changed, 4945 insertions(+) create mode 100644 lib/ruby_lsp/tapioca/addon.rb create mode 100644 sorbet/rbi/gems/ruby-lsp@0.17.4.rbi diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb new file mode 100644 index 000000000..558ddf160 --- /dev/null +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -0,0 +1,79 @@ +# typed: true +# frozen_string_literal: true + +require "tapioca/internal" + +module RubyLsp + module Tapioca + class Addon < ::RubyLsp::Addon + extend T::Sig + + def initialize + super + @index = T.let(nil, T.nilable(RubyIndexer::Index)) + end + + def rails_runner_stdin + stdin = @global_state.instance_variable_get(:@rails_runner_stdin) + @rails_runner_stdin ||= stdin + end + + def activate(global_state, outgoing_queue) + $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") + @index = global_state.index + @global_state = global_state + end + + sig { override.void } + def deactivate + end + + sig { override.returns(String) } + def name + "Tapioca" + end + + def self.dsl(params) + command = ::Tapioca::Commands::DslGenerate.new( + requested_constants: params[:constants], + tapioca_path: ::Tapioca::TAPIOCA_DIR, + requested_paths: [], + outpath: Pathname.new(::Tapioca::DEFAULT_DSL_DIR), + file_header: true, + exclude: [], + only: [], + ) + + command.generate_without_booting + end + + sig { params(changes: T::Array[{ uri: String, type: Integer }]).void } + def workspace_did_change_watched_files(changes) + files_to_entries = @index.instance_variable_get("@files_to_entries") + constants = changes.map do |change| + path = change[:uri].gsub("file://", "") + entries = files_to_entries[path] + return unless entries + entries.map do |entry| + next unless RubyIndexer::Entry::Namespace === entry + + entry.name + end + end.flatten.compact + + $stderr.puts "Tapioca LSP: Sending message with #{constants}" if constants.any? + send_message("tapioca_dsl", constants: constants) if constants.any? + end + + sig { params(request: String, params: T.nilable(T::Hash[Symbol, T.untyped])).void } + def send_message(request, params = nil) + message = { method: request } + message[:params] = params if params + json = message.to_json + + stdin = rails_runner_stdin + stdin.write("Content-Length: #{json.length}\r\n\r\n", json) + end + end + end +end diff --git a/lib/tapioca/internal.rb b/lib/tapioca/internal.rb index 1ad533b6d..a5419f137 100644 --- a/lib/tapioca/internal.rb +++ b/lib/tapioca/internal.rb @@ -18,6 +18,7 @@ require "netrc" require "parallel" require "pathname" +require "ruby_lsp/internal" require "shellwords" require "tempfile" require "thor" diff --git a/sorbet/config b/sorbet/config index c54e716d8..03255b7f6 100644 --- a/sorbet/config +++ b/sorbet/config @@ -3,3 +3,4 @@ --ignore=/vendor --enable-experimental-requires-ancestor --suppress-payload-superclass-redefinition-for=Reline::ANSI +--ignore=/.ruby-lsp/ diff --git a/sorbet/rbi/gems/ruby-lsp@0.17.4.rbi b/sorbet/rbi/gems/ruby-lsp@0.17.4.rbi new file mode 100644 index 000000000..af6e754d6 --- /dev/null +++ b/sorbet/rbi/gems/ruby-lsp@0.17.4.rbi @@ -0,0 +1,4864 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `ruby-lsp` gem. +# Please instead update this file by running `bin/tapioca gem ruby-lsp`. + + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#4 +module RubyIndexer + class << self + # source://ruby-lsp/lib/ruby_indexer/ruby_indexer.rb#23 + sig { returns(::RubyIndexer::Configuration) } + def configuration; end + end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#5 +class RubyIndexer::Configuration + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#20 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#149 + sig { params(config: T::Hash[::String, T.untyped]).void } + def apply_config(config); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#47 + sig { returns(T::Array[::RubyIndexer::IndexablePath]) } + def indexables; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#144 + sig { returns(::Regexp) } + def magic_comment_regex; end + + private + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#177 + sig { returns(T::Array[::String]) } + def initial_excluded_gems; end + + # @raise [ArgumentError] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#162 + sig { params(config: T::Hash[::String, T.untyped]).void } + def validate_config!(config); end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#8 +RubyIndexer::Configuration::CONFIGURATION_SCHEMA = T.let(T.unsafe(nil), Hash) + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#5 +class RubyIndexer::DeclarationListener + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#14 + sig do + params( + index: ::RubyIndexer::Index, + dispatcher: ::Prism::Dispatcher, + parse_result: ::Prism::ParseResult, + file_path: ::String + ).void + end + def initialize(index, dispatcher, parse_result, file_path); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#361 + sig { params(node: ::Prism::AliasMethodNode).void } + def on_alias_method_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#250 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#276 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_leave(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#65 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#106 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_leave(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#238 + sig { params(node: ::Prism::ConstantAndWriteNode).void } + def on_constant_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#244 + sig { params(node: ::Prism::ConstantOperatorWriteNode).void } + def on_constant_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#232 + sig { params(node: ::Prism::ConstantOrWriteNode).void } + def on_constant_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#216 + sig { params(node: ::Prism::ConstantPathAndWriteNode).void } + def on_constant_path_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#206 + sig { params(node: ::Prism::ConstantPathOperatorWriteNode).void } + def on_constant_path_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#196 + sig { params(node: ::Prism::ConstantPathOrWriteNode).void } + def on_constant_path_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#186 + sig { params(node: ::Prism::ConstantPathWriteNode).void } + def on_constant_path_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#226 + sig { params(node: ::Prism::ConstantWriteNode).void } + def on_constant_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#289 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#326 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_leave(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#341 + sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } + def on_instance_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#346 + sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } + def on_instance_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#351 + sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } + def on_instance_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#356 + sig { params(node: ::Prism::InstanceVariableTargetNode).void } + def on_instance_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#336 + sig { params(node: ::Prism::InstanceVariableWriteNode).void } + def on_instance_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#113 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#128 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_leave(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#166 + sig { params(node: ::Prism::MultiWriteNode).void } + def on_multi_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#135 + sig { params(node: ::Prism::SingletonClassNode).void } + def on_singleton_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#159 + sig { params(node: ::Prism::SingletonClassNode).void } + def on_singleton_class_node_leave(node); end + + private + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#482 + sig do + params( + node: T.any(::Prism::ConstantAndWriteNode, ::Prism::ConstantOperatorWriteNode, ::Prism::ConstantOrWriteNode, ::Prism::ConstantPathAndWriteNode, ::Prism::ConstantPathOperatorWriteNode, ::Prism::ConstantPathOrWriteNode, ::Prism::ConstantPathTargetNode, ::Prism::ConstantPathWriteNode, ::Prism::ConstantTargetNode, ::Prism::ConstantWriteNode), + name: ::String, + value: T.nilable(::Prism::Node) + ).void + end + def add_constant(node, name, value = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#507 + sig { params(node: ::Prism::Node).returns(T::Array[::String]) } + def collect_comments(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#605 + sig { returns(::RubyIndexer::Entry::Visibility) } + def current_visibility; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#533 + sig { params(name: ::String).returns(::String) } + def fully_qualify_name(name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#426 + sig { params(node: ::Prism::CallNode).void } + def handle_alias_method(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#542 + sig { params(node: ::Prism::CallNode, reader: T::Boolean, writer: T::Boolean).void } + def handle_attribute(node, reader:, writer:); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#390 + sig do + params( + node: T.any(::Prism::InstanceVariableAndWriteNode, ::Prism::InstanceVariableOperatorWriteNode, ::Prism::InstanceVariableOrWriteNode, ::Prism::InstanceVariableTargetNode, ::Prism::InstanceVariableWriteNode), + loc: ::Prism::Location + ).void + end + def handle_instance_variable(node, loc); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#578 + sig { params(node: ::Prism::CallNode, operation: ::Symbol).void } + def handle_module_operation(node, operation); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#401 + sig { params(node: ::Prism::CallNode).void } + def handle_private_constant(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#610 + sig do + params( + parameters_node: T.nilable(::Prism::ParametersNode) + ).returns(T::Array[::RubyIndexer::Entry::Parameter]) + end + def list_params(parameters_node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#669 + sig { params(node: T.nilable(::Prism::Node)).returns(T.nilable(::Symbol)) } + def parameter_name(node); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#694 + sig { returns(T.nilable(::RubyIndexer::Entry::Class)) } + def singleton_klass; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#9 +RubyIndexer::DeclarationListener::BASIC_OBJECT_NESTING = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#8 +RubyIndexer::DeclarationListener::OBJECT_NESTING = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#5 +class RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#39 + sig do + params( + name: ::String, + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String] + ).void + end + def initialize(name, file_path, location, comments); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#26 + sig { returns(T::Array[::String]) } + def comments; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#66 + sig { returns(::String) } + def file_name; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#20 + sig { returns(::String) } + def file_path; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#23 + sig { returns(::RubyIndexer::Location) } + def location; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#17 + sig { returns(::String) } + def name; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#61 + sig { returns(T::Boolean) } + def private?; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#29 + sig { returns(::RubyIndexer::Entry::Visibility) } + def visibility; end + + # @return [Visibility] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#29 + def visibility=(_arg0); end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#295 +class RubyIndexer::Entry::Accessor < ::RubyIndexer::Entry::Member + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#299 + sig { override.returns(T::Array[::RubyIndexer::Entry::Parameter]) } + def parameters; end +end + +# Alias represents a resolved alias, which points to an existing constant target +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#367 +class RubyIndexer::Entry::Alias < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#374 + sig { params(target: ::String, unresolved_alias: ::RubyIndexer::Entry::UnresolvedAlias).void } + def initialize(target, unresolved_alias); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#371 + sig { returns(::String) } + def target; end +end + +# A block method parameter, e.g. `def foo(&block)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#251 +class RubyIndexer::Entry::BlockParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#255 + sig { override.returns(::Symbol) } + def decorated_name; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#252 +RubyIndexer::Entry::BlockParameter::DEFAULT_NAME = T.let(T.unsafe(nil), Symbol) + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#136 +class RubyIndexer::Entry::Class < ::RubyIndexer::Entry::Namespace + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#153 + sig do + params( + nesting: T::Array[::String], + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String], + parent_class: T.nilable(::String) + ).void + end + def initialize(nesting, file_path, location, comments, parent_class); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#159 + sig { override.returns(::Integer) } + def ancestor_hash; end + + # The unresolved name of the parent class. This may return `nil`, which indicates the lack of an explicit parent + # and therefore ::Object is the correct parent class + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#142 + sig { returns(T.nilable(::String)) } + def parent_class; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#180 +class RubyIndexer::Entry::Constant < ::RubyIndexer::Entry; end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#87 +class RubyIndexer::Entry::Extend < ::RubyIndexer::Entry::ModuleOperation; end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#85 +class RubyIndexer::Entry::Include < ::RubyIndexer::Entry::ModuleOperation; end + +# Represents an instance variable e.g.: @a = 1 +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#383 +class RubyIndexer::Entry::InstanceVariable < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#396 + sig do + params( + name: ::String, + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String], + owner: T.nilable(::RubyIndexer::Entry::Namespace) + ).void + end + def initialize(name, file_path, location, comments, owner); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#385 + sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } + def owner; end +end + +# An required keyword method parameter, e.g. `def foo(a:)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#215 +class RubyIndexer::Entry::KeywordParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#217 + sig { override.returns(::Symbol) } + def decorated_name; end +end + +# A keyword rest method parameter, e.g. `def foo(**a)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#241 +class RubyIndexer::Entry::KeywordRestParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#245 + sig { override.returns(::Symbol) } + def decorated_name; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#242 +RubyIndexer::Entry::KeywordRestParameter::DEFAULT_NAME = T.let(T.unsafe(nil), Symbol) + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#260 +class RubyIndexer::Entry::Member < ::RubyIndexer::Entry + abstract! + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#279 + sig do + params( + name: ::String, + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String], + visibility: ::RubyIndexer::Entry::Visibility, + owner: T.nilable(::RubyIndexer::Entry::Namespace) + ).void + end + def initialize(name, file_path, location, comments, visibility, owner); end + + # Returns a string with the decorated names of the parameters of this member. E.g.: `(a, b = 1, c: 2)` + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#290 + sig { returns(::String) } + def decorated_parameters; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#267 + sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } + def owner; end + + # @abstract + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#286 + sig { abstract.returns(T::Array[::RubyIndexer::Entry::Parameter]) } + def parameters; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#306 +class RubyIndexer::Entry::Method < ::RubyIndexer::Entry::Member + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#323 + sig do + params( + name: ::String, + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String], + parameters: T::Array[::RubyIndexer::Entry::Parameter], + visibility: ::RubyIndexer::Entry::Visibility, + owner: T.nilable(::RubyIndexer::Entry::Namespace) + ).void + end + def initialize(name, file_path, location, comments, parameters, visibility, owner); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#310 + sig { override.returns(T::Array[::RubyIndexer::Entry::Parameter]) } + def parameters; end +end + +# A method alias is a resolved alias entry that points to the exact method target it refers to +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#434 +class RubyIndexer::Entry::MethodAlias < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#441 + sig do + params( + target: T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias), + unresolved_alias: ::RubyIndexer::Entry::UnresolvedMethodAlias + ).void + end + def initialize(target, unresolved_alias); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#468 + sig { returns(::String) } + def decorated_parameters; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#458 + sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } + def owner; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#463 + sig { returns(T::Array[::RubyIndexer::Entry::Parameter]) } + def parameters; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#438 + sig { returns(T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias)) } + def target; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#133 +class RubyIndexer::Entry::Module < ::RubyIndexer::Entry::Namespace; end + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#70 +class RubyIndexer::Entry::ModuleOperation + abstract! + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#80 + sig { params(module_name: ::String).void } + def initialize(module_name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#77 + sig { returns(::String) } + def module_name; end +end + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#89 +class RubyIndexer::Entry::Namespace < ::RubyIndexer::Entry + abstract! + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#106 + sig do + params( + nesting: T::Array[::String], + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String] + ).void + end + def initialize(nesting, file_path, location, comments); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#128 + sig { returns(::Integer) } + def ancestor_hash; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#115 + sig { returns(T::Array[::String]) } + def mixin_operation_module_names; end + + # Stores all explicit prepend, include and extend operations in the exact order they were discovered in the source + # code. Maintaining the order is essential to linearize ancestors the right way when a module is both included + # and prepended + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#123 + sig { returns(T::Array[::RubyIndexer::Entry::ModuleOperation]) } + def mixin_operations; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#96 + sig { returns(T::Array[::String]) } + def nesting; end +end + +# An optional keyword method parameter, e.g. `def foo(a: 123)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#223 +class RubyIndexer::Entry::OptionalKeywordParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#225 + sig { override.returns(::Symbol) } + def decorated_name; end +end + +# An optional method parameter, e.g. `def foo(a = 123)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#207 +class RubyIndexer::Entry::OptionalParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#209 + sig { override.returns(::Symbol) } + def decorated_name; end +end + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#183 +class RubyIndexer::Entry::Parameter + abstract! + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#197 + sig { params(name: ::Symbol).void } + def initialize(name:); end + + # Name includes just the name of the parameter, excluding symbols like splats + # Decorated name is the parameter name including the splat or block prefix, e.g.: `*foo`, `**foo` or `&block` + # + # @return [Symbol] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def decorated_name(*args, **_arg1, &blk); end + + # Name includes just the name of the parameter, excluding symbols like splats + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#191 + sig { returns(::Symbol) } + def name; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#86 +class RubyIndexer::Entry::Prepend < ::RubyIndexer::Entry::ModuleOperation; end + +# A required method parameter, e.g. `def foo(a)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#203 +class RubyIndexer::Entry::RequiredParameter < ::RubyIndexer::Entry::Parameter; end + +# A rest method parameter, e.g. `def foo(*a)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#231 +class RubyIndexer::Entry::RestParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#235 + sig { override.returns(::Symbol) } + def decorated_name; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#232 +RubyIndexer::Entry::RestParameter::DEFAULT_NAME = T.let(T.unsafe(nil), Symbol) + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#164 +class RubyIndexer::Entry::SingletonClass < ::RubyIndexer::Entry::Class + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#168 + sig { params(location: ::Prism::Location, comments: T::Array[::String]).void } + def update_singleton_information(location, comments); end +end + +# An UnresolvedAlias points to a constant alias with a right hand side that has not yet been resolved. For +# example, if we find +# +# ```ruby +# CONST = Foo +# ``` +# Before we have discovered `Foo`, there's no way to eagerly resolve this alias to the correct target constant. +# All aliases are inserted as UnresolvedAlias in the index first and then we lazily resolve them to the correct +# target in [rdoc-ref:Index#resolve]. If the right hand side contains a constant that doesn't exist, then it's not +# possible to resolve the alias and it will remain an UnresolvedAlias until the right hand side constant exists +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#339 +class RubyIndexer::Entry::UnresolvedAlias < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#358 + sig do + params( + target: ::String, + nesting: T::Array[::String], + name: ::String, + file_path: ::String, + location: T.any(::Prism::Location, ::RubyIndexer::Location), + comments: T::Array[::String] + ).void + end + def initialize(target, nesting, name, file_path, location, comments); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#346 + sig { returns(T::Array[::String]) } + def nesting; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#343 + sig { returns(::String) } + def target; end +end + +# An unresolved method alias is an alias entry for which we aren't sure what the right hand side points to yet. For +# example, if we have `alias a b`, we create an unresolved alias for `a` because we aren't sure immediate what `b` +# is referring to +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#405 +class RubyIndexer::Entry::UnresolvedMethodAlias < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#424 + sig do + params( + new_name: ::String, + old_name: ::String, + owner: T.nilable(::RubyIndexer::Entry::Namespace), + file_path: ::String, + location: ::Prism::Location, + comments: T::Array[::String] + ).void + end + def initialize(new_name, old_name, owner, file_path, location, comments); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#409 + sig { returns(::String) } + def new_name; end + + # @return [String] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#409 + def old_name; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#412 + sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } + def owner; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#6 +class RubyIndexer::Entry::Visibility < ::T::Enum + enums do + PUBLIC = new + PROTECTED = new + PRIVATE = new + end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#5 +class RubyIndexer::Index + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#15 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#78 + sig { params(fully_qualified_name: ::String).returns(T.nilable(T::Array[::RubyIndexer::Entry])) } + def [](fully_qualified_name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#69 + sig { params(entry: ::RubyIndexer::Entry, skip_prefix_tree: T::Boolean).void } + def add(entry, skip_prefix_tree: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#41 + sig { params(indexable: ::RubyIndexer::IndexablePath).void } + def delete(indexable); end + + # Follows aliases in a namespace. The algorithm keeps checking if the name is an alias and then recursively follows + # it. The idea is that we test the name in parts starting from the complete name to the first namespace. For + # `Foo::Bar::Baz`, we would test: + # 1. Is `Foo::Bar::Baz` an alias? Get the target and recursively follow its target + # 2. Is `Foo::Bar` an alias? Get the target and recursively follow its target + # 3. Is `Foo` an alias? Get the target and recursively follow its target + # + # If we find an alias, then we want to follow its target. In the same example, if `Foo::Bar` is an alias to + # `Something::Else`, then we first discover `Something::Else::Baz`. But `Something::Else::Baz` might contain other + # aliases, so we have to invoke `follow_aliased_namespace` again to check until we only return a real name + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#268 + sig { params(name: ::String, seen_names: T::Array[::String]).returns(::String) } + def follow_aliased_namespace(name, seen_names = T.unsafe(nil)); end + + # Fuzzy searches index entries based on Jaro-Winkler similarity. If no query is provided, all entries are returned + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#120 + sig { params(query: T.nilable(::String)).returns(T::Array[::RubyIndexer::Entry]) } + def fuzzy_search(query); end + + # Synchronizes a change made to the given indexable path. This method will ensure that new declarations are indexed, + # removed declarations removed and that the ancestor linearization cache is cleared if necessary + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#460 + sig { params(indexable: ::RubyIndexer::IndexablePath).void } + def handle_change(indexable); end + + # Index all files for the given indexable paths, which defaults to what is configured. A block can be used to track + # and control indexing progress. That block is invoked with the current progress percentage and should return `true` + # to continue indexing or `false` to stop indexing. + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#221 + sig do + params( + indexable_paths: T::Array[::RubyIndexer::IndexablePath], + block: T.nilable(T.proc.params(progress: ::Integer).returns(T::Boolean)) + ).void + end + def index_all(indexable_paths: T.unsafe(nil), &block); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#236 + sig { params(indexable_path: ::RubyIndexer::IndexablePath, source: T.nilable(::String)).void } + def index_single(indexable_path, source = T.unsafe(nil)); end + + # Returns a list of possible candidates for completion of instance variables for a given owner name. The name must + # include the `@` prefix + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#448 + sig { params(name: ::String, owner_name: ::String).returns(T::Array[::RubyIndexer::Entry::InstanceVariable]) } + def instance_variable_completion_candidates(name, owner_name); end + + # Linearizes the ancestors for a given name, returning the order of namespaces in which Ruby will search for method + # or constant declarations. + # + # When we add an ancestor in Ruby, that namespace might have ancestors of its own. Therefore, we need to linearize + # everything recursively to ensure that we are placing ancestors in the right order. For example, if you include a + # module that prepends another module, then the prepend module appears before the included module. + # + # The order of ancestors is [linearized_prepends, self, linearized_includes, linearized_superclass] + # + # @raise [NonExistingNamespaceError] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#343 + sig { params(fully_qualified_name: ::String).returns(T::Array[::String]) } + def linearized_ancestors_of(fully_qualified_name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#149 + sig do + params( + name: T.nilable(::String), + receiver_name: ::String + ).returns(T::Array[T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias)]) + end + def method_completion_candidates(name, receiver_name); end + + # Searches entries in the index based on an exact prefix, intended for providing autocomplete. All possible matches + # to the prefix are returned. The return is an array of arrays, where each entry is the array of entries for a given + # name match. For example: + # ## Example + # ```ruby + # # If the index has two entries for `Foo::Bar` and one for `Foo::Baz`, then: + # index.prefix_search("Foo::B") + # # Will return: + # [ + # [#, #], + # [#], + # ] + # ``` + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#101 + sig do + params( + query: ::String, + nesting: T.nilable(T::Array[::String]) + ).returns(T::Array[T::Array[::RubyIndexer::Entry]]) + end + def prefix_search(query, nesting = T.unsafe(nil)); end + + # Resolve a constant to its declaration based on its name and the nesting where the reference was found. Parameter + # documentation: + # + # name: the name of the reference how it was found in the source code (qualified or not) + # nesting: the nesting structure where the reference was found (e.g.: ["Foo", "Bar"]) + # seen_names: this parameter should not be used by consumers of the api. It is used to avoid infinite recursion when + # resolving circular references + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#180 + sig do + params( + name: ::String, + nesting: T::Array[::String], + seen_names: T::Array[::String] + ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + end + def resolve(name, nesting, seen_names = T.unsafe(nil)); end + + # Resolves an instance variable name for a given owner name. This method will linearize the ancestors of the owner + # and find inherited instance variables as well + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#435 + sig do + params( + variable_name: ::String, + owner_name: ::String + ).returns(T.nilable(T::Array[::RubyIndexer::Entry::InstanceVariable])) + end + def resolve_instance_variable(variable_name, owner_name); end + + # Attempts to find methods for a resolved fully qualified receiver name. + # Returns `nil` if the method does not exist on that receiver + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#307 + sig do + params( + method_name: ::String, + receiver_name: ::String + ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias)])) + end + def resolve_method(method_name, receiver_name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#83 + sig { params(query: ::String).returns(T::Array[::RubyIndexer::IndexablePath]) } + def search_require_paths(query); end + + private + + # Removes redudancy from a constant reference's full name. For example, if we find a reference to `A::B::Foo` inside + # of the ["A", "B"] nesting, then we should not concatenate the nesting with the name or else we'll end up with + # `A::B::A::B::Foo`. This method will remove any redundant parts from the final name based on the reference and the + # nesting + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#575 + sig { params(name: ::String, nesting: T::Array[::String]).returns(::String) } + def build_non_redundant_full_name(name, nesting); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#602 + sig do + params( + full_name: ::String, + seen_names: T::Array[::String] + ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + end + def direct_or_aliased_constant(full_name, seen_names); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#551 + sig do + params( + name: ::String, + nesting: T::Array[::String], + seen_names: T::Array[::String] + ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + end + def lookup_ancestor_chain(name, nesting, seen_names); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#526 + sig do + params( + name: ::String, + nesting: T::Array[::String], + seen_names: T::Array[::String] + ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + end + def lookup_enclosing_scopes(name, nesting, seen_names); end + + # Attempts to resolve an UnresolvedAlias into a resolved Alias. If the unresolved alias is pointing to a constant + # that doesn't exist, then we return the same UnresolvedAlias + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#497 + sig do + params( + entry: ::RubyIndexer::Entry::UnresolvedAlias, + seen_names: T::Array[::String] + ).returns(T.any(::RubyIndexer::Entry::Alias, ::RubyIndexer::Entry::UnresolvedAlias)) + end + def resolve_alias(entry, seen_names); end + + # Attempt to resolve a given unresolved method alias. This method returns the resolved alias if we managed to + # identify the target or the same unresolved alias entry if we couldn't + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#620 + sig do + params( + entry: ::RubyIndexer::Entry::UnresolvedMethodAlias, + receiver_name: ::String + ).returns(T.any(::RubyIndexer::Entry::MethodAlias, ::RubyIndexer::Entry::UnresolvedMethodAlias)) + end + def resolve_method_alias(entry, receiver_name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#608 + sig { params(name: ::String, seen_names: T::Array[::String]).returns(T.nilable(T::Array[::RubyIndexer::Entry])) } + def search_top_level(name, seen_names); end +end + +# The minimum Jaro-Winkler similarity score for an entry to be considered a match for a given fuzzy search query +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#12 +RubyIndexer::Index::ENTRY_SIMILARITY_THRESHOLD = T.let(T.unsafe(nil), Float) + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#9 +class RubyIndexer::Index::NonExistingNamespaceError < ::StandardError; end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#8 +class RubyIndexer::Index::UnresolvableAliasError < ::StandardError; end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#5 +class RubyIndexer::IndexablePath + # An IndexablePath is instantiated with a load_path_entry and a full_path. The load_path_entry is where the file can + # be found in the $LOAD_PATH, which we use to determine the require_path. The load_path_entry may be `nil` if the + # indexer is configured to go through files that do not belong in the $LOAD_PATH. For example, + # `sorbet/tapioca/require.rb` ends up being a part of the paths to be indexed because it's a Ruby file inside the + # project, but the `sorbet` folder is not a part of the $LOAD_PATH. That means that both its load_path_entry and + # require_path will be `nil`, since it cannot be required by the project + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#21 + sig { params(load_path_entry: T.nilable(::String), full_path: ::String).void } + def initialize(load_path_entry, full_path); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#12 + sig { returns(::String) } + def full_path; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#9 + sig { returns(T.nilable(::String)) } + def require_path; end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/location.rb#5 +class RubyIndexer::Location + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/location.rb#19 + sig { params(start_line: ::Integer, end_line: ::Integer, start_column: ::Integer, end_column: ::Integer).void } + def initialize(start_line, end_line, start_column, end_column); end + + # @return [Integer] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/location.rb#9 + def end_column; end + + # @return [Integer] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/location.rb#9 + def end_line; end + + # @return [Integer] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/location.rb#9 + def start_column; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/location.rb#9 + sig { returns(::Integer) } + def start_line; end +end + +# A PrefixTree is a data structure that allows searching for partial strings fast. The tree is similar to a nested +# hash structure, where the keys are the characters of the inserted strings. +# +# ## Example +# ```ruby +# tree = PrefixTree[String].new +# # Insert entries using the same key and value +# tree.insert("bar", "bar") +# tree.insert("baz", "baz") +# # Internally, the structure is analogous to this, but using nodes: +# # { +# # "b" => { +# # "a" => { +# # "r" => "bar", +# # "z" => "baz" +# # } +# # } +# # } +# # When we search it, it finds all possible values based on partial (or complete matches): +# tree.search("") # => ["bar", "baz"] +# tree.search("b") # => ["bar", "baz"] +# tree.search("ba") # => ["bar", "baz"] +# tree.search("bar") # => ["bar"] +# ``` +# +# A PrefixTree is useful for autocomplete, since we always want to find all alternatives while the developer hasn't +# finished typing yet. This PrefixTree implementation allows for string keys and any arbitrary value using the generic +# `Value` type. +# +# See https://en.wikipedia.org/wiki/Trie for more information +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#35 +class RubyIndexer::PrefixTree + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#42 + sig { void } + def initialize; end + + # Deletes the entry identified by `key` from the tree. Notice that a partial match will still delete all entries + # that match it. For example, if the tree contains `foo` and we ask to delete `fo`, then `foo` will be deleted + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#77 + sig { params(key: ::String).void } + def delete(key); end + + # Inserts a `value` using the given `key` + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#60 + sig { params(key: ::String, value: T.untyped).void } + def insert(key, value); end + + # Search the PrefixTree based on a given `prefix`. If `foo` is an entry in the tree, then searching for `fo` will + # return it as a result. The result is always an array of the type of value attribute to the generic `Value` type. + # Notice that if the `Value` is an array, this method will return an array of arrays, where each entry is the array + # of values for a given match + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#51 + sig { params(prefix: ::String).returns(T::Array[T.untyped]) } + def search(prefix); end + + private + + # Find a node that matches the given `key` + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#97 + sig { params(key: ::String).returns(T.nilable(RubyIndexer::PrefixTree::Node[T.untyped])) } + def find_node(key); end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#110 +class RubyIndexer::PrefixTree::Node + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#132 + sig { params(key: ::String, value: T.untyped, parent: T.nilable(RubyIndexer::PrefixTree::Node[T.untyped])).void } + def initialize(key, value, parent = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#117 + sig { returns(T::Hash[::String, RubyIndexer::PrefixTree::Node[T.untyped]]) } + def children; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#141 + sig { returns(T::Array[T.untyped]) } + def collect; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#120 + sig { returns(::String) } + def key; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#126 + sig { returns(T::Boolean) } + def leaf; end + + # @return [Boolean] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#126 + def leaf=(_arg0); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#129 + sig { returns(T.nilable(RubyIndexer::PrefixTree::Node[T.untyped])) } + def parent; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#123 + sig { returns(T.untyped) } + def value; end + + # @return [Value] + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#123 + def value=(_arg0); end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#5 +class RubyIndexer::RBSIndexer + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#9 + sig { params(index: ::RubyIndexer::Index).void } + def initialize(index); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#14 + sig { void } + def index_ruby_core; end + + private + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#93 + sig do + params( + declaration: T.any(::RBS::AST::Declarations::Class, ::RBS::AST::Declarations::Module), + entry: ::RubyIndexer::Entry::Namespace + ).void + end + def add_declaration_mixins_to_entry(declaration, entry); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#130 + sig { params(owner: ::RubyIndexer::Entry::Namespace).returns(T.nilable(::RubyIndexer::Entry::Class)) } + def existing_or_new_singleton_klass(owner); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#45 + sig { params(declaration: ::RBS::AST::Declarations::Class, pathname: ::Pathname).void } + def handle_class_declaration(declaration, pathname); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#110 + sig { params(member: ::RBS::AST::Members::MethodDefinition, owner: ::RubyIndexer::Entry::Namespace).void } + def handle_method(member, owner); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#62 + sig { params(declaration: ::RBS::AST::Declarations::Module, pathname: ::Pathname).void } + def handle_module_declaration(declaration, pathname); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#33 + sig { params(declaration: ::RBS::AST::Declarations::Base, pathname: ::Pathname).void } + def process_declaration(declaration, pathname); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#26 + sig { params(source: T.untyped, pathname: ::Pathname, declarations: T::Array[::RBS::AST::Declarations::Base]).void } + def process_signature(source, pathname, declarations); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#78 + sig { params(rbs_location: ::RBS::Location).returns(::RubyIndexer::Location) } + def to_ruby_indexer_location(rbs_location); end +end + +# source://ruby-lsp/lib/ruby-lsp.rb#4 +module RubyLsp; end + +# To register an addon, inherit from this class and implement both `name` and `activate` +# +# # Example +# +# ```ruby +# module MyGem +# class MyAddon < Addon +# def activate +# # Perform any relevant initialization +# end +# +# def name +# "My addon name" +# end +# end +# end +# ``` +# +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/addon.rb#22 +class RubyLsp::Addon + abstract! + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#78 + sig { void } + def initialize; end + + # Each addon should implement `MyAddon#activate` and use to perform any sort of initialization, such as + # reading information into memory or even spawning a separate process + # + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#109 + sig { abstract.params(global_state: ::RubyLsp::GlobalState, outgoing_queue: ::Thread::Queue).void } + def activate(global_state, outgoing_queue); end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#83 + sig { params(error: ::StandardError).returns(T.self_type) } + def add_error(error); end + + # Creates a new CodeLens listener. This method is invoked on every CodeLens request + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#128 + sig do + overridable + .params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CodeLens], + uri: ::URI::Generic, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_code_lens_listener(response_builder, uri, dispatcher); end + + # Creates a new Completion listener. This method is invoked on every Completion request + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#177 + sig do + overridable + .params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CompletionItem], + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher, + uri: ::URI::Generic + ).void + end + def create_completion_listener(response_builder, node_context, dispatcher, uri); end + + # Creates a new Definition listener. This method is invoked on every Definition request + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#166 + sig do + overridable + .params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::Location], + uri: ::URI::Generic, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_definition_listener(response_builder, uri, node_context, dispatcher); end + + # Creates a new DocumentSymbol listener. This method is invoked on every DocumentSymbol request + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#147 + sig do + overridable + .params( + response_builder: RubyLsp::ResponseBuilders::DocumentSymbol, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_document_symbol_listener(response_builder, dispatcher); end + + # Creates a new Hover listener. This method is invoked on every Hover request + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#138 + sig do + overridable + .params( + response_builder: RubyLsp::ResponseBuilders::Hover, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_hover_listener(response_builder, node_context, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#155 + sig do + overridable + .params( + response_builder: RubyLsp::ResponseBuilders::SemanticHighlighting, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_semantic_highlighting_listener(response_builder, dispatcher); end + + # Each addon should implement `MyAddon#deactivate` and use to perform any clean up, like shutting down a + # child process + # + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#114 + sig { abstract.void } + def deactivate; end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#89 + sig { returns(T::Boolean) } + def error?; end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#102 + sig { returns(::String) } + def errors_details; end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#94 + sig { returns(::String) } + def formatted_errors; end + + # Addons should override the `name` method to return the addon name + # + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#118 + sig { abstract.returns(::String) } + def name; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/addon.rb#43 + sig { returns(T::Array[T.class_of(RubyLsp::Addon)]) } + def addon_classes; end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#37 + sig { returns(T::Array[::RubyLsp::Addon]) } + def addons; end + + # @return [Array] + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#37 + def addons=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/addon.rb#40 + sig { returns(T::Array[::RubyLsp::Addon]) } + def file_watcher_addons; end + + # @return [Array] + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#40 + def file_watcher_addons=(_arg0); end + + # Automatically track and instantiate addon classes + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#47 + sig { params(child_class: T.class_of(RubyLsp::Addon)).void } + def inherited(child_class); end + + # Discovers and loads all addons. Returns the list of activated addons + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#54 + sig do + params( + global_state: ::RubyLsp::GlobalState, + outgoing_queue: ::Thread::Queue + ).returns(T::Array[::RubyLsp::Addon]) + end + def load_addons(global_state, outgoing_queue); end + end +end + +# Used to indicate that a request shouldn't return a response +# +# source://ruby-lsp/lib/ruby_lsp/utils.rb#12 +RubyLsp::BUNDLE_PATH = T.let(T.unsafe(nil), String) + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/base_server.rb#5 +class RubyLsp::BaseServer + abstract! + + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#12 + sig { params(test_mode: T::Boolean).void } + def initialize(test_mode: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#114 + sig { returns(::Thread) } + def new_worker; end + + # This method is only intended to be used in tests! Pops the latest response that would be sent to the client + # + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#103 + sig { returns(T.untyped) } + def pop_response; end + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#108 + sig { abstract.params(message: T::Hash[::Symbol, T.untyped]).void } + def process_message(message); end + + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#89 + sig { void } + def run_shutdown; end + + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#145 + sig { params(id: ::Integer).void } + def send_empty_response(id); end + + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#134 + sig { params(message: T.any(::RubyLsp::Error, ::RubyLsp::Notification, ::RubyLsp::Request, ::RubyLsp::Result)).void } + def send_message(message); end + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#111 + sig { abstract.void } + def shutdown; end + + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#38 + sig { void } + def start; end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#7 +RubyLsp::Constant = LanguageServer::Protocol::Constant + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/document.rb#5 +class RubyLsp::Document + abstract! + + # source://ruby-lsp/lib/ruby_lsp/document.rb#27 + sig { params(source: ::String, version: ::Integer, uri: ::URI::Generic, encoding: ::Encoding).void } + def initialize(source:, version:, uri:, encoding: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#48 + sig { params(other: ::RubyLsp::Document).returns(T::Boolean) } + def ==(other); end + + # TODO: remove this method once all nonpositional requests have been migrated to the listener pattern + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#60 + sig do + type_parameters(:T) + .params( + request_name: ::String, + block: T.proc.params(document: ::RubyLsp::Document).returns(T.type_parameter(:T)) + ).returns(T.type_parameter(:T)) + end + def cache_fetch(request_name, &block); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#75 + sig { params(request_name: ::String).returns(T.untyped) } + def cache_get(request_name); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#70 + sig { type_parameters(:T).params(request_name: ::String, value: T.type_parameter(:T)).returns(T.type_parameter(:T)) } + def cache_set(request_name, value); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#43 + sig { returns(T::Array[::Prism::Comment]) } + def comments; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#105 + sig { returns(::RubyLsp::Document::Scanner) } + def create_scanner; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#24 + sig { returns(::Encoding) } + def encoding; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#126 + sig do + params( + node: ::Prism::Node, + char_position: ::Integer, + node_types: T::Array[T.class_of(Prism::Node)] + ).returns(::RubyLsp::NodeContext) + end + def locate(node, char_position, node_types: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#115 + sig do + params( + position: T::Hash[::Symbol, T.untyped], + node_types: T::Array[T.class_of(Prism::Node)] + ).returns(::RubyLsp::NodeContext) + end + def locate_node(position, node_types: T.unsafe(nil)); end + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#97 + sig { abstract.returns(::Prism::ParseResult) } + def parse; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#12 + sig { returns(::Prism::ParseResult) } + def parse_result; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#80 + sig { params(edits: T::Array[T::Hash[::Symbol, T.untyped]], version: ::Integer).void } + def push_edits(edits, version:); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#229 + sig { returns(T::Boolean) } + def sorbet_sigil_is_true_or_higher; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#15 + sig { returns(::String) } + def source; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#100 + sig { returns(T::Boolean) } + def syntax_error?; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#38 + sig { returns(::Prism::ProgramNode) } + def tree; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#21 + sig { returns(::URI::Generic) } + def uri; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#18 + sig { returns(::Integer) } + def version; end +end + +# source://ruby-lsp/lib/ruby_lsp/document.rb#235 +class RubyLsp::Document::Scanner + # source://ruby-lsp/lib/ruby_lsp/document.rb#243 + sig { params(source: ::String, encoding: ::Encoding).void } + def initialize(source, encoding); end + + # Finds the character index inside the source string for a given line and column + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#252 + sig { params(position: T::Hash[::Symbol, T.untyped]).returns(::Integer) } + def find_char_position(position); end + + # Subtract 1 for each character after 0xFFFF in the current line from the column position, so that we hit the + # right character in the UTF-8 representation + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#274 + sig { params(current_position: ::Integer, requested_position: ::Integer).returns(::Integer) } + def utf_16_character_position_correction(current_position, requested_position); end +end + +# source://ruby-lsp/lib/ruby_lsp/document.rb#238 +RubyLsp::Document::Scanner::LINE_BREAK = T.let(T.unsafe(nil), Integer) + +# After character 0xFFFF, UTF-16 considers characters to have length 2 and we have to account for that +# +# source://ruby-lsp/lib/ruby_lsp/document.rb#240 +RubyLsp::Document::Scanner::SURROGATE_PAIR_START = T.let(T.unsafe(nil), Integer) + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#90 +class RubyLsp::Error + # source://ruby-lsp/lib/ruby_lsp/utils.rb#97 + sig { params(id: ::Integer, code: ::Integer, message: ::String, data: T.nilable(T::Hash[::Symbol, T.untyped])).void } + def initialize(id:, code:, message:, data: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#94 + sig { returns(::String) } + def message; end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#105 + sig { returns(T::Hash[::Symbol, T.untyped]) } + def to_hash; end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#20 +RubyLsp::GEMFILE_NAME = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/ruby_lsp/global_state.rb#5 +class RubyLsp::GlobalState + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#30 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#50 + sig { returns(T.nilable(::RubyLsp::Requests::Support::Formatter)) } + def active_formatter; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#55 + sig { returns(T::Array[::RubyLsp::Requests::Support::Formatter]) } + def active_linters; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#60 + sig { params(options: T::Hash[::Symbol, T.untyped]).void } + def apply_options(options); end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#21 + sig { returns(::Encoding) } + def encoding; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#98 + sig { returns(::String) } + def encoding_name; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#12 + sig { returns(::String) } + def formatter; end + + # @return [String] + # + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#12 + def formatter=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#15 + sig { returns(T::Boolean) } + def has_type_checker; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#18 + sig { returns(::RubyIndexer::Index) } + def index; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#45 + sig { params(identifier: ::String, instance: ::RubyLsp::Requests::Support::Formatter).void } + def register_formatter(identifier, instance); end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#24 + sig { returns(T::Boolean) } + def supports_watching_files; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#9 + sig { returns(::String) } + def test_library; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#27 + sig { returns(::RubyLsp::TypeInferrer) } + def type_inferrer; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#93 + sig { returns(::String) } + def workspace_path; end + + private + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#173 + sig { returns(T::Boolean) } + def bin_rails_present; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#112 + sig { params(direct_dependencies: T::Array[::String], all_dependencies: T::Array[::String]).returns(::String) } + def detect_formatter(direct_dependencies, all_dependencies); end + + # Try to detect if there are linters in the project's dependencies. For auto-detection, we always only consider a + # single linter. To have multiple linters running, the user must configure them manually + # + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#128 + sig { params(dependencies: T::Array[::String]).returns(T::Array[::String]) } + def detect_linters(dependencies); end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#135 + sig { params(dependencies: T::Array[::String]).returns(::String) } + def detect_test_library(dependencies); end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#155 + sig { params(dependencies: T::Array[::String]).returns(T::Boolean) } + def detect_typechecker(dependencies); end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#178 + sig { returns(T::Boolean) } + def dot_rubocop_yml_present; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#198 + sig { returns(T::Array[::String]) } + def gather_direct_and_indirect_dependencies; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#183 + sig { returns(T::Array[::String]) } + def gather_direct_dependencies; end + + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#191 + sig { returns(T::Array[::String]) } + def gemspec_dependencies; end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#6 +RubyLsp::Interface = LanguageServer::Protocol::Interface + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#5 +module RubyLsp::Listeners; end + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#8 +class RubyLsp::Listeners::CodeLens + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#35 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CodeLens], + global_state: ::RubyLsp::GlobalState, + uri: ::URI::Generic, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(response_builder, global_state, uri, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#134 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#164 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#62 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#81 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#93 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#115 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#120 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#129 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_leave(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#269 + sig { params(node: ::Prism::CallNode, kind: ::Symbol).void } + def add_spec_code_lens(node, kind:); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#175 + sig { params(node: ::Prism::Node, name: ::String, command: ::String, kind: ::Symbol).void } + def add_test_code_lens(node, name:, command:, kind:); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#226 + sig do + params( + group_stack: T::Array[::String], + spec_name: T.nilable(::String), + method_name: T.nilable(::String) + ).returns(::String) + end + def generate_test_command(group_stack: T.unsafe(nil), spec_name: T.unsafe(nil), method_name: T.unsafe(nil)); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#21 +RubyLsp::Listeners::CodeLens::ACCESS_MODIFIERS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#12 +RubyLsp::Listeners::CodeLens::BASE_COMMAND = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#23 +RubyLsp::Listeners::CodeLens::DESCRIBE_KEYWORD = T.let(T.unsafe(nil), Symbol) + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#25 +RubyLsp::Listeners::CodeLens::DYNAMIC_REFERENCE_MARKER = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#24 +RubyLsp::Listeners::CodeLens::IT_KEYWORD = T.let(T.unsafe(nil), Symbol) + +# source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#22 +RubyLsp::Listeners::CodeLens::SUPPORTED_TEST_LIBRARIES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#6 +class RubyLsp::Listeners::Completion + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#21 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CompletionItem], + global_state: ::RubyLsp::GlobalState, + node_context: ::RubyLsp::NodeContext, + typechecker_enabled: T::Boolean, + dispatcher: ::Prism::Dispatcher, + uri: ::URI::Generic, + trigger_character: T.nilable(::String) + ).void + end + def initialize(response_builder, global_state, node_context, typechecker_enabled, dispatcher, uri, trigger_character); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#86 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # Handle completion on namespaced constant references (e.g. `Foo::Bar`) + # + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#76 + sig { params(node: ::Prism::ConstantPathNode).void } + def on_constant_path_node_enter(node); end + + # Handle completion on regular constant references (e.g. `Bar`) + # + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#55 + sig { params(node: ::Prism::ConstantReadNode).void } + def on_constant_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#136 + sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } + def on_instance_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#141 + sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } + def on_instance_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#146 + sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } + def on_instance_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#126 + sig { params(node: ::Prism::InstanceVariableReadNode).void } + def on_instance_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#151 + sig { params(node: ::Prism::InstanceVariableTargetNode).void } + def on_instance_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#131 + sig { params(node: ::Prism::InstanceVariableWriteNode).void } + def on_instance_variable_write_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#336 + sig do + params( + label: ::String, + node: ::Prism::StringNode + ).returns(::LanguageServer::Protocol::Interface::CompletionItem) + end + def build_completion(label, node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#359 + sig do + params( + real_name: ::String, + incomplete_name: ::String, + range: ::LanguageServer::Protocol::Interface::Range, + entries: T::Array[::RubyIndexer::Entry], + top_level: T::Boolean + ).returns(::LanguageServer::Protocol::Interface::CompletionItem) + end + def build_entry_completion(real_name, incomplete_name, range, entries, top_level); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#316 + sig do + params( + entry: T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias), + node: ::Prism::CallNode + ).returns(::LanguageServer::Protocol::Interface::CompletionItem) + end + def build_method_completion(entry, node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#274 + sig { params(node: ::Prism::CallNode, name: ::String).void } + def complete_methods(node, name); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#229 + sig { params(node: ::Prism::CallNode).void } + def complete_require(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#245 + sig { params(node: ::Prism::CallNode).void } + def complete_require_relative(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#158 + sig { params(name: ::String, range: ::LanguageServer::Protocol::Interface::Range).void } + def constant_path_completion(name, range); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#205 + sig { params(name: ::String, location: ::Prism::Location).void } + def handle_instance_variable_completion(name, location); end + + # Check if there are any conflicting names for `entry_name`, which would require us to use a top level reference. + # For example: + # + # ```ruby + # class Bar; end + # + # module Foo + # class Bar; end + # + # # in this case, the completion for `Bar` conflicts with `Foo::Bar`, so we can't suggest `Bar` as the + # # completion, but instead need to suggest `::Bar` + # B + # end + # ``` + # + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#442 + sig { params(entry_name: ::String).returns(T::Boolean) } + def top_level?(entry_name); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#6 +class RubyLsp::Listeners::Definition + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#22 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::Location], + global_state: ::RubyLsp::GlobalState, + uri: ::URI::Generic, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher, + typechecker_enabled: T::Boolean + ).void + end + def initialize(response_builder, global_state, uri, node_context, dispatcher, typechecker_enabled); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#67 + sig { params(node: ::Prism::BlockArgumentNode).void } + def on_block_argument_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#48 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#78 + sig { params(node: ::Prism::ConstantPathNode).void } + def on_constant_path_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#86 + sig { params(node: ::Prism::ConstantReadNode).void } + def on_constant_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#104 + sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } + def on_instance_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#109 + sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } + def on_instance_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#114 + sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } + def on_instance_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#94 + sig { params(node: ::Prism::InstanceVariableReadNode).void } + def on_instance_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#119 + sig { params(node: ::Prism::InstanceVariableTargetNode).void } + def on_instance_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#99 + sig { params(node: ::Prism::InstanceVariableWriteNode).void } + def on_instance_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#56 + sig { params(node: ::Prism::StringNode).void } + def on_string_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#211 + sig { params(value: ::String).void } + def find_in_index(value); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#126 + sig { params(name: ::String).void } + def handle_instance_variable_definition(name); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#149 + sig { params(message: ::String, receiver_type: T.nilable(::String)).void } + def handle_method_definition(message, receiver_type); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#176 + sig { params(node: ::Prism::StringNode, message: ::Symbol).void } + def handle_require_definition(node, message); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#10 +RubyLsp::Listeners::Definition::MAX_NUMBER_OF_DEFINITION_CANDIDATES_WITHOUT_RECEIVER = T.let(T.unsafe(nil), Integer) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#6 +class RubyLsp::Listeners::DocumentHighlight + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#97 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::DocumentHighlight], + target: T.nilable(::Prism::Node), + parent: T.nilable(::Prism::Node), + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(response_builder, target, parent, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#236 + sig { params(node: ::Prism::BlockParameterNode).void } + def on_block_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#180 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#250 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#420 + sig { params(node: ::Prism::ClassVariableAndWriteNode).void } + def on_class_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#413 + sig { params(node: ::Prism::ClassVariableOperatorWriteNode).void } + def on_class_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#406 + sig { params(node: ::Prism::ClassVariableOrWriteNode).void } + def on_class_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#292 + sig { params(node: ::Prism::ClassVariableReadNode).void } + def on_class_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#222 + sig { params(node: ::Prism::ClassVariableTargetNode).void } + def on_class_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#399 + sig { params(node: ::Prism::ClassVariableWriteNode).void } + def on_class_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#476 + sig { params(node: ::Prism::ConstantAndWriteNode).void } + def on_constant_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#441 + sig { params(node: ::Prism::ConstantOperatorWriteNode).void } + def on_constant_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#434 + sig { params(node: ::Prism::ConstantOrWriteNode).void } + def on_constant_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#320 + sig { params(node: ::Prism::ConstantPathAndWriteNode).void } + def on_constant_path_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#271 + sig { params(node: ::Prism::ConstantPathNode).void } + def on_constant_path_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#327 + sig { params(node: ::Prism::ConstantPathOperatorWriteNode).void } + def on_constant_path_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#313 + sig { params(node: ::Prism::ConstantPathOrWriteNode).void } + def on_constant_path_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#208 + sig { params(node: ::Prism::ConstantPathTargetNode).void } + def on_constant_path_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#306 + sig { params(node: ::Prism::ConstantPathWriteNode).void } + def on_constant_path_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#278 + sig { params(node: ::Prism::ConstantReadNode).void } + def on_constant_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#215 + sig { params(node: ::Prism::ConstantTargetNode).void } + def on_constant_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#427 + sig { params(node: ::Prism::ConstantWriteNode).void } + def on_constant_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#187 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#497 + sig { params(node: ::Prism::GlobalVariableAndWriteNode).void } + def on_global_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#504 + sig { params(node: ::Prism::GlobalVariableOperatorWriteNode).void } + def on_global_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#490 + sig { params(node: ::Prism::GlobalVariableOrWriteNode).void } + def on_global_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#299 + sig { params(node: ::Prism::GlobalVariableReadNode).void } + def on_global_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#194 + sig { params(node: ::Prism::GlobalVariableTargetNode).void } + def on_global_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#483 + sig { params(node: ::Prism::GlobalVariableWriteNode).void } + def on_global_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#462 + sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } + def on_instance_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#469 + sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } + def on_instance_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#455 + sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } + def on_instance_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#285 + sig { params(node: ::Prism::InstanceVariableReadNode).void } + def on_instance_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#201 + sig { params(node: ::Prism::InstanceVariableTargetNode).void } + def on_instance_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#448 + sig { params(node: ::Prism::InstanceVariableWriteNode).void } + def on_instance_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#370 + sig { params(node: ::Prism::KeywordRestParameterNode).void } + def on_keyword_rest_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#378 + sig { params(node: ::Prism::LocalVariableAndWriteNode).void } + def on_local_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#385 + sig { params(node: ::Prism::LocalVariableOperatorWriteNode).void } + def on_local_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#392 + sig { params(node: ::Prism::LocalVariableOrWriteNode).void } + def on_local_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#264 + sig { params(node: ::Prism::LocalVariableReadNode).void } + def on_local_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#229 + sig { params(node: ::Prism::LocalVariableTargetNode).void } + def on_local_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#334 + sig { params(node: ::Prism::LocalVariableWriteNode).void } + def on_local_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#257 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#348 + sig { params(node: ::Prism::OptionalKeywordParameterNode).void } + def on_optional_keyword_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#363 + sig { params(node: ::Prism::OptionalParameterNode).void } + def on_optional_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#341 + sig { params(node: ::Prism::RequiredKeywordParameterNode).void } + def on_required_keyword_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#243 + sig { params(node: ::Prism::RequiredParameterNode).void } + def on_required_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#355 + sig { params(node: ::Prism::RestParameterNode).void } + def on_rest_parameter_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#518 + sig { params(kind: ::Integer, location: ::Prism::Location).void } + def add_highlight(kind, location); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#513 + sig { params(node: ::Prism::Node, classes: T::Array[T.class_of(Prism::Node)]).returns(T.nilable(T::Boolean)) } + def matches?(node, classes); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#523 + sig { params(node: T.nilable(::Prism::Node)).returns(T.nilable(::String)) } + def node_value(node); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#58 +RubyLsp::Listeners::DocumentHighlight::CLASS_VARIABLE_NODES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#34 +RubyLsp::Listeners::DocumentHighlight::CONSTANT_NODES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#46 +RubyLsp::Listeners::DocumentHighlight::CONSTANT_PATH_NODES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#10 +RubyLsp::Listeners::DocumentHighlight::GLOBAL_VARIABLE_NODES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#22 +RubyLsp::Listeners::DocumentHighlight::INSTANCE_VARIABLE_NODES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#70 +RubyLsp::Listeners::DocumentHighlight::LOCAL_NODES = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#8 +class RubyLsp::Listeners::DocumentLink + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#68 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::DocumentLink], + uri: ::URI::Generic, + comments: T::Array[::Prism::Comment], + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(response_builder, uri, comments, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#98 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#113 + sig { params(node: ::Prism::ConstantPathWriteNode).void } + def on_constant_path_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#108 + sig { params(node: ::Prism::ConstantWriteNode).void } + def on_constant_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#93 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#103 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#120 + sig { params(node: ::Prism::Node).void } + def extract_document_link(node); end + + # Try to figure out the gem version for a source:// link. The order of precedence is: + # 1. The version in the URI + # 2. The version in the RBI file name + # 3. The version from the gemspec + # + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#146 + sig { params(uri: ::URI::Source).returns(T.nilable(::String)) } + def resolve_version(uri); end + + class << self + # source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#23 + sig { returns(T::Hash[::String, T::Hash[::String, T::Hash[::String, ::String]]]) } + def gem_paths; end + end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_link.rb#12 +RubyLsp::Listeners::DocumentLink::GEM_TO_VERSION_MAP = T.let(T.unsafe(nil), Hash) + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#6 +class RubyLsp::Listeners::DocumentSymbol + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#19 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::DocumentSymbol, + uri: ::URI::Generic, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(response_builder, uri, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#273 + sig { params(node: ::Prism::AliasMethodNode).void } + def on_alias_method_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#84 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#98 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#52 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#62 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#263 + sig { params(node: ::Prism::ClassVariableWriteNode).void } + def on_class_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#167 + sig { params(node: ::Prism::ConstantAndWriteNode).void } + def on_constant_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#177 + sig { params(node: ::Prism::ConstantOperatorWriteNode).void } + def on_constant_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#157 + sig { params(node: ::Prism::ConstantOrWriteNode).void } + def on_constant_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#127 + sig { params(node: ::Prism::ConstantPathAndWriteNode).void } + def on_constant_path_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#147 + sig { params(node: ::Prism::ConstantPathOperatorWriteNode).void } + def on_constant_path_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#137 + sig { params(node: ::Prism::ConstantPathOrWriteNode).void } + def on_constant_path_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#197 + sig { params(node: ::Prism::ConstantPathTargetNode).void } + def on_constant_path_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#107 + sig { params(node: ::Prism::ConstantPathWriteNode).void } + def on_constant_path_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#187 + sig { params(node: ::Prism::ConstantTargetNode).void } + def on_constant_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#117 + sig { params(node: ::Prism::ConstantWriteNode).void } + def on_constant_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#222 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#207 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#253 + sig { params(node: ::Prism::InstanceVariableWriteNode).void } + def on_instance_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#212 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#248 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#67 + sig { params(node: ::Prism::SingletonClassNode).void } + def on_singleton_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#79 + sig { params(node: ::Prism::SingletonClassNode).void } + def on_singleton_class_node_leave(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#298 + sig do + params( + name: ::String, + kind: ::Integer, + range_location: ::Prism::Location, + selection_range_location: ::Prism::Location + ).returns(::LanguageServer::Protocol::Interface::DocumentSymbol) + end + def create_document_symbol(name:, kind:, range_location:, selection_range_location:); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#347 + sig { params(node: ::Prism::CallNode).void } + def handle_alias_method(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#314 + sig { params(node: ::Prism::CallNode).void } + def handle_attr_accessor(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#380 + sig { params(node: ::Prism::CallNode).void } + def handle_rake_namespace(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#406 + sig { params(node: ::Prism::CallNode).void } + def handle_rake_task(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#441 + sig { returns(T::Boolean) } + def rake?; end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/document_symbol.rb#10 +RubyLsp::Listeners::DocumentSymbol::ATTR_ACCESSORS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#6 +class RubyLsp::Listeners::FoldingRanges + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#17 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::FoldingRange], + comments: T::Array[::Prism::Comment], + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(response_builder, comments, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#51 + sig { void } + def finalize_response!; end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#85 + sig { params(node: ::Prism::ArrayNode).void } + def on_array_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#155 + sig { params(node: ::Prism::BeginNode).void } + def on_begin_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#90 + sig { params(node: ::Prism::BlockNode).void } + def on_block_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#175 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#100 + sig { params(node: ::Prism::CaseMatchNode).void } + def on_case_match_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#95 + sig { params(node: ::Prism::CaseNode).void } + def on_case_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#105 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#160 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#145 + sig { params(node: ::Prism::ElseNode).void } + def on_else_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#150 + sig { params(node: ::Prism::EnsureNode).void } + def on_ensure_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#115 + sig { params(node: ::Prism::ForNode).void } + def on_for_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#120 + sig { params(node: ::Prism::HashNode).void } + def on_hash_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#57 + sig { params(node: ::Prism::IfNode).void } + def on_if_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#62 + sig { params(node: ::Prism::InNode).void } + def on_in_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#77 + sig { params(node: ::Prism::InterpolatedStringNode).void } + def on_interpolated_string_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#188 + sig { params(node: ::Prism::LambdaNode).void } + def on_lambda_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#110 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#67 + sig { params(node: ::Prism::RescueNode).void } + def on_rescue_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#125 + sig { params(node: ::Prism::SingletonClassNode).void } + def on_singleton_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#130 + sig { params(node: ::Prism::UnlessNode).void } + def on_unless_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#135 + sig { params(node: ::Prism::UntilNode).void } + def on_until_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#72 + sig { params(node: ::Prism::WhenNode).void } + def on_when_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#140 + sig { params(node: ::Prism::WhileNode).void } + def on_while_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#255 + sig { params(start_line: ::Integer, end_line: ::Integer).void } + def add_lines_range(start_line, end_line); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#249 + sig { params(node: ::Prism::Node).void } + def add_simple_range(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#238 + sig { params(node: T.any(::Prism::IfNode, ::Prism::InNode, ::Prism::RescueNode, ::Prism::WhenNode)).void } + def add_statements_range(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#211 + sig { void } + def emit_requires_range; end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#195 + sig { void } + def push_comment_ranges; end + + # source://ruby-lsp/lib/ruby_lsp/listeners/folding_ranges.rb#224 + sig { params(node: ::Prism::CallNode).returns(T::Boolean) } + def require?(node); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#6 +class RubyLsp::Listeners::Hover + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#46 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::Hover, + global_state: ::RubyLsp::GlobalState, + uri: ::URI::Generic, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher, + typechecker_enabled: T::Boolean + ).void + end + def initialize(response_builder, global_state, uri, node_context, dispatcher, typechecker_enabled); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#98 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#88 + sig { params(node: ::Prism::ConstantPathNode).void } + def on_constant_path_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#71 + sig { params(node: ::Prism::ConstantReadNode).void } + def on_constant_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#81 + sig { params(node: ::Prism::ConstantWriteNode).void } + def on_constant_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#133 + sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } + def on_instance_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#138 + sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } + def on_instance_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#143 + sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } + def on_instance_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#123 + sig { params(node: ::Prism::InstanceVariableReadNode).void } + def on_instance_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#148 + sig { params(node: ::Prism::InstanceVariableTargetNode).void } + def on_instance_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#128 + sig { params(node: ::Prism::InstanceVariableWriteNode).void } + def on_instance_variable_write_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#185 + sig { params(node: ::Prism::CallNode).void } + def generate_gem_hover(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#170 + sig { params(name: ::String, location: ::Prism::Location).void } + def generate_hover(name, location); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#155 + sig { params(name: ::String).void } + def handle_instance_variable_hover(name); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#28 +RubyLsp::Listeners::Hover::ALLOWED_REMOTE_PROVIDERS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#10 +RubyLsp::Listeners::Hover::ALLOWED_TARGETS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#6 +class RubyLsp::Listeners::InlayHints + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#20 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::InlayHint], + range: T::Range[::Integer], + hints_configuration: ::RubyLsp::RequestConfig, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(response_builder, range, hints_configuration, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#45 + sig { params(node: ::Prism::ImplicitNode).void } + def on_implicit_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#29 + sig { params(node: ::Prism::RescueNode).void } + def on_rescue_node_enter(node); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#10 +RubyLsp::Listeners::InlayHints::RESCUE_STRING_LENGTH = T.let(T.unsafe(nil), Integer) + +# source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#6 +class RubyLsp::Listeners::SemanticHighlighting + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#28 + sig do + params( + dispatcher: ::Prism::Dispatcher, + response_builder: RubyLsp::ResponseBuilders::SemanticHighlighting, + range: T.nilable(T::Range[::Integer]) + ).void + end + def initialize(dispatcher, response_builder, range: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#174 + sig { params(node: ::Prism::BlockLocalVariableNode).void } + def on_block_local_variable_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#164 + sig { params(node: ::Prism::BlockNode).void } + def on_block_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#169 + sig { params(node: ::Prism::BlockNode).void } + def on_block_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#179 + sig { params(node: ::Prism::BlockParameterNode).void } + def on_block_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#75 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#303 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#123 + sig { params(node: ::Prism::ConstantAndWriteNode).void } + def on_constant_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#130 + sig { params(node: ::Prism::ConstantOperatorWriteNode).void } + def on_constant_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#137 + sig { params(node: ::Prism::ConstantOrWriteNode).void } + def on_constant_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#379 + sig { params(node: ::Prism::ConstantPathNode).void } + def on_constant_path_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#108 + sig { params(node: ::Prism::ConstantReadNode).void } + def on_constant_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#144 + sig { params(node: ::Prism::ConstantTargetNode).void } + def on_constant_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#116 + sig { params(node: ::Prism::ConstantWriteNode).void } + def on_constant_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#151 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#159 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#367 + sig { params(node: ::Prism::ImplicitNode).void } + def on_implicit_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#374 + sig { params(node: ::Prism::ImplicitNode).void } + def on_implicit_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#203 + sig { params(node: ::Prism::KeywordRestParameterNode).void } + def on_keyword_rest_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#269 + sig { params(node: ::Prism::LocalVariableAndWriteNode).void } + def on_local_variable_and_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#276 + sig { params(node: ::Prism::LocalVariableOperatorWriteNode).void } + def on_local_variable_operator_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#283 + sig { params(node: ::Prism::LocalVariableOrWriteNode).void } + def on_local_variable_or_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#255 + sig { params(node: ::Prism::LocalVariableReadNode).void } + def on_local_variable_read_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#290 + sig { params(node: ::Prism::LocalVariableTargetNode).void } + def on_local_variable_target_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#248 + sig { params(node: ::Prism::LocalVariableWriteNode).void } + def on_local_variable_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#93 + sig { params(node: ::Prism::MatchWriteNode).void } + def on_match_write_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#103 + sig { params(node: ::Prism::MatchWriteNode).void } + def on_match_write_node_leave(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#344 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#194 + sig { params(node: ::Prism::OptionalKeywordParameterNode).void } + def on_optional_keyword_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#214 + sig { params(node: ::Prism::OptionalParameterNode).void } + def on_optional_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#185 + sig { params(node: ::Prism::RequiredKeywordParameterNode).void } + def on_required_keyword_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#222 + sig { params(node: ::Prism::RequiredParameterNode).void } + def on_required_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#230 + sig { params(node: ::Prism::RestParameterNode).void } + def on_rest_parameter_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#241 + sig { params(node: ::Prism::SelfNode).void } + def on_self_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#396 + sig { params(node: ::Prism::CallNode).void } + def process_regexp_locals(node); end + + # Textmate provides highlighting for a subset of these special Ruby-specific methods. We want to utilize that + # highlighting, so we avoid making a semantic token for it. + # + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#391 + sig { params(method_name: ::String).returns(T::Boolean) } + def special_method?(method_name); end +end + +# source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#10 +RubyLsp::Listeners::SemanticHighlighting::SPECIAL_RUBY_METHODS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/listeners/signature_help.rb#6 +class RubyLsp::Listeners::SignatureHelp + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/listeners/signature_help.rb#19 + sig do + params( + response_builder: RubyLsp::ResponseBuilders::SignatureHelp, + global_state: ::RubyLsp::GlobalState, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher, + typechecker_enabled: T::Boolean + ).void + end + def initialize(response_builder, global_state, node_context, dispatcher, typechecker_enabled); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/signature_help.rb#30 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end +end + +# A notification to be sent to the client +# +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/utils.rb#30 +class RubyLsp::Message + abstract! + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#43 + sig { params(method: ::String, params: ::Object).void } + def initialize(method:, params:); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#35 + sig { returns(::String) } + def method; end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#38 + sig { returns(::Object) } + def params; end + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/utils.rb#49 + sig { abstract.returns(T::Hash[::Symbol, T.untyped]) } + def to_hash; end +end + +# This class allows listeners to access contextual information about a node in the AST, such as its parent, +# its namespace nesting, and the surrounding CallNode (e.g. a method call). +# +# source://ruby-lsp/lib/ruby_lsp/node_context.rb#7 +class RubyLsp::NodeContext + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#31 + sig do + params( + node: T.nilable(::Prism::Node), + parent: T.nilable(::Prism::Node), + nesting: T::Array[::String], + call_node: T.nilable(::Prism::CallNode), + surrounding_method: T.nilable(::String) + ).void + end + def initialize(node, parent, nesting, call_node, surrounding_method); end + + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#17 + sig { returns(T.nilable(::Prism::CallNode)) } + def call_node; end + + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#40 + sig { returns(::String) } + def fully_qualified_name; end + + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#14 + sig { returns(T::Array[::String]) } + def nesting; end + + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#11 + sig { returns(T.nilable(::Prism::Node)) } + def node; end + + # @return [Prism::Node, nil] + # + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#11 + def parent; end + + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#20 + sig { returns(T.nilable(::String)) } + def surrounding_method; end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#52 +class RubyLsp::Notification < ::RubyLsp::Message + # source://ruby-lsp/lib/ruby_lsp/utils.rb#70 + sig { override.returns(T::Hash[::Symbol, T.untyped]) } + def to_hash; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/utils.rb#56 + sig { params(message: ::String).returns(::RubyLsp::Notification) } + def window_show_error(message); end + end +end + +# source://ruby-lsp/lib/ruby_lsp/parameter_scope.rb#5 +class RubyLsp::ParameterScope + # source://ruby-lsp/lib/ruby_lsp/parameter_scope.rb#12 + sig { params(parent: T.nilable(::RubyLsp::ParameterScope)).void } + def initialize(parent = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/parameter_scope.rb#18 + sig { params(name: T.any(::String, ::Symbol)).void } + def <<(name); end + + # source://ruby-lsp/lib/ruby_lsp/parameter_scope.rb#28 + sig { params(name: T.any(::String, ::Symbol)).returns(T::Boolean) } + def parameter?(name); end + + # source://ruby-lsp/lib/ruby_lsp/parameter_scope.rb#9 + sig { returns(T.nilable(::RubyLsp::ParameterScope)) } + def parent; end + + # source://ruby-lsp/lib/ruby_lsp/parameter_scope.rb#23 + sig { params(name: T.any(::String, ::Symbol)).returns(::Symbol) } + def type_for(name); end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#75 +class RubyLsp::Request < ::RubyLsp::Message + # source://ruby-lsp/lib/ruby_lsp/utils.rb#79 + sig { params(id: T.any(::Integer, ::String), method: ::String, params: ::Object).void } + def initialize(id:, method:, params:); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#85 + sig { override.returns(T::Hash[::Symbol, T.untyped]) } + def to_hash; end +end + +# A request configuration, to turn on/off features +# +# source://ruby-lsp/lib/ruby_lsp/utils.rb#137 +class RubyLsp::RequestConfig + # source://ruby-lsp/lib/ruby_lsp/utils.rb#144 + sig { params(configuration: T::Hash[::Symbol, T::Boolean]).void } + def initialize(configuration); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#141 + sig { returns(T::Hash[::Symbol, T::Boolean]) } + def configuration; end + + # @return [Hash{Symbol => Boolean}] + # + # source://ruby-lsp/lib/ruby_lsp/utils.rb#141 + def configuration=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#149 + sig { params(feature: ::Symbol).returns(T.nilable(T::Boolean)) } + def enabled?(feature); end +end + +# Supported features +# +# - [DocumentSymbol](rdoc-ref:RubyLsp::Requests::DocumentSymbol) +# - [DocumentLink](rdoc-ref:RubyLsp::Requests::DocumentLink) +# - [Hover](rdoc-ref:RubyLsp::Requests::Hover) +# - [FoldingRange](rdoc-ref:RubyLsp::Requests::FoldingRanges) +# - [SelectionRange](rdoc-ref:RubyLsp::Requests::SelectionRanges) +# - [SemanticHighlighting](rdoc-ref:RubyLsp::Requests::SemanticHighlighting) +# - [Formatting](rdoc-ref:RubyLsp::Requests::Formatting) +# - [OnTypeFormatting](rdoc-ref:RubyLsp::Requests::OnTypeFormatting) +# - [Diagnostic](rdoc-ref:RubyLsp::Requests::Diagnostics) +# - [CodeAction](rdoc-ref:RubyLsp::Requests::CodeActions) +# - [CodeActionResolve](rdoc-ref:RubyLsp::Requests::CodeActionResolve) +# - [DocumentHighlight](rdoc-ref:RubyLsp::Requests::DocumentHighlight) +# - [InlayHint](rdoc-ref:RubyLsp::Requests::InlayHints) +# - [Completion](rdoc-ref:RubyLsp::Requests::Completion) +# - [CompletionResolve](rdoc-ref:RubyLsp::Requests::CompletionResolve) +# - [CodeLens](rdoc-ref:RubyLsp::Requests::CodeLens) +# - [Definition](rdoc-ref:RubyLsp::Requests::Definition) +# - [ShowSyntaxTree](rdoc-ref:RubyLsp::Requests::ShowSyntaxTree) +# - [WorkspaceSymbol](rdoc-ref:RubyLsp::Requests::WorkspaceSymbol) +# - [SignatureHelp](rdoc-ref:RubyLsp::Requests::SignatureHelp) +# +# source://ruby-lsp/lib/ruby_lsp/requests.rb#28 +module RubyLsp::Requests; end + +# ![Code action resolve demo](../../code_action_resolve.gif) +# +# The [code action resolve](https://microsoft.github.io/language-server-protocol/specification#codeAction_resolve) +# request is used to to resolve the edit field for a given code action, if it is not already provided in the +# textDocument/codeAction response. We can use it for scenarios that require more computation such as refactoring. +# +# # Example: Extract to variable +# +# ```ruby +# # Before: +# 1 + 1 # Select the text and use Refactor: Extract Variable +# +# # After: +# new_variable = 1 + 1 +# new_variable +# +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#24 +class RubyLsp::Requests::CodeActionResolve < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#40 + sig { params(document: ::RubyLsp::Document, code_action: T::Hash[::Symbol, T.untyped]).void } + def initialize(document, code_action); end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#47 + sig do + override + .returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) + end + def perform; end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#155 + sig do + returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) + end + def refactor_method; end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#59 + sig do + returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) + end + def refactor_variable; end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#212 + sig do + params( + range: T::Hash[::Symbol, T.untyped], + new_text: ::String + ).returns(::LanguageServer::Protocol::Interface::TextEdit) + end + def create_text_edit(range, new_text); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#29 +class RubyLsp::Requests::CodeActionResolve::CodeActionError < ::StandardError; end + +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#31 +class RubyLsp::Requests::CodeActionResolve::Error < ::T::Enum + enums do + EmptySelection = new + InvalidTargetRange = new + UnknownCodeAction = new + end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#27 +RubyLsp::Requests::CodeActionResolve::NEW_METHOD_NAME = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#26 +RubyLsp::Requests::CodeActionResolve::NEW_VARIABLE_NAME = T.let(T.unsafe(nil), String) + +# ![Code actions demo](../../code_actions.gif) +# +# The [code actions](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction) +# request informs the editor of RuboCop quick fixes that can be applied. These are accessible by hovering over a +# specific diagnostic. +# +# # Example +# +# ```ruby +# def say_hello +# puts "Hello" # --> code action: quick fix indentation +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#19 +class RubyLsp::Requests::CodeActions < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#41 + sig do + params( + document: ::RubyLsp::Document, + range: T::Hash[::Symbol, T.untyped], + context: T::Hash[::Symbol, T.untyped] + ).void + end + def initialize(document, range, context); end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#50 + sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::CodeAction]))) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#29 + sig { returns(::LanguageServer::Protocol::Interface::CodeActionOptions) } + def provider; end + end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#23 +RubyLsp::Requests::CodeActions::EXTRACT_TO_METHOD_TITLE = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#22 +RubyLsp::Requests::CodeActions::EXTRACT_TO_VARIABLE_TITLE = T.let(T.unsafe(nil), String) + +# ![Code lens demo](../../code_lens.gif) +# +# The +# [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens) +# request informs the editor of runnable commands such as testing and debugging +# +# # Example +# +# ```ruby +# # Run | Run in Terminal | Debug +# class Test < Minitest::Test +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#23 +class RubyLsp::Requests::CodeLens < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#42 + sig { params(global_state: ::RubyLsp::GlobalState, uri: ::URI::Generic, dispatcher: ::Prism::Dispatcher).void } + def initialize(global_state, uri, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#56 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::CodeLens]) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#30 + sig { returns(::LanguageServer::Protocol::Interface::CodeLensOptions) } + def provider; end + end +end + +# ![Completion demo](../../completion.gif) +# +# The [completion](https://microsoft.github.io/language-server-protocol/specification#textDocument_completion) +# suggests possible completions according to what the developer is typing. +# +# Currently supported targets: +# +# - Classes +# - Modules +# - Constants +# - Require paths +# - Methods invoked on self only +# - Instance variables +# +# # Example +# +# ```ruby +# require "ruby_lsp/requests" # --> completion: suggests `base_request`, `code_actions`, ... +# +# RubyLsp::Requests:: # --> completion: suggests `Completion`, `Hover`, ... +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#29 +class RubyLsp::Requests::Completion < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#56 + sig do + params( + document: ::RubyLsp::Document, + global_state: ::RubyLsp::GlobalState, + params: T::Hash[::Symbol, T.untyped], + typechecker_enabled: T::Boolean, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(document, global_state, params, typechecker_enabled, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#109 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::CompletionItem]) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#36 + sig { returns(::LanguageServer::Protocol::Interface::CompletionOptions) } + def provider; end + end +end + +# ![Completion resolve demo](../../completion_resolve.gif) +# +# The [completionItem/resolve](https://microsoft.github.io/language-server-protocol/specification#completionItem_resolve) +# request provides additional information about the currently selected completion. Specifically, the `labelDetails` +# and `documentation` fields are provided, which are omitted from the completion items returned by +# `textDocument/completion`. +# +# The `labelDetails` field lists the files where the completion item is defined, and the `documentation` field +# includes any available documentation for those definitions. +# +# At most 10 definitions are included, to ensure low latency during request processing and rendering the completion +# item. +# +# # Example +# +# ```ruby +# A # -> as the user cycles through completion items, the documentation will be resolved and displayed +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/completion_resolve.rb#24 +class RubyLsp::Requests::CompletionResolve < ::RubyLsp::Requests::Request + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/requests/completion_resolve.rb#33 + sig { params(global_state: ::RubyLsp::GlobalState, item: T::Hash[::Symbol, T.untyped]).void } + def initialize(global_state, item); end + + # source://ruby-lsp/lib/ruby_lsp/requests/completion_resolve.rb#40 + sig { override.returns(T::Hash[::Symbol, T.untyped]) } + def perform; end +end + +# set a limit on the number of documentation entries returned, to avoid rendering performance issues +# https://github.com/Shopify/ruby-lsp/pull/1798 +# +# source://ruby-lsp/lib/ruby_lsp/requests/completion_resolve.rb#30 +RubyLsp::Requests::CompletionResolve::MAX_DOCUMENTATION_ENTRIES = T.let(T.unsafe(nil), Integer) + +# ![Definition demo](../../definition.gif) +# +# The [definition +# request](https://microsoft.github.io/language-server-protocol/specification#textDocument_definition) jumps to the +# definition of the symbol under the cursor. +# +# Currently supported targets: +# +# - Classes +# - Modules +# - Constants +# - Require paths +# - Methods invoked on self only and on receivers where the type is unknown +# - Instance variables +# +# # Example +# +# ```ruby +# require "some_gem/file" # <- Request go to definition on this string will take you to the file +# Product.new # <- Request go to definition on this class name will take you to its declaration. +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#29 +class RubyLsp::Requests::Definition < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#42 + sig do + params( + document: ::RubyLsp::Document, + global_state: ::RubyLsp::GlobalState, + position: T::Hash[::Symbol, T.untyped], + dispatcher: ::Prism::Dispatcher, + typechecker_enabled: T::Boolean + ).void + end + def initialize(document, global_state, position, dispatcher, typechecker_enabled); end + + # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#108 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::Location]) } + def perform; end +end + +# ![Diagnostics demo](../../diagnostics.gif) +# +# The +# [diagnostics](https://microsoft.github.io/language-server-protocol/specification#textDocument_publishDiagnostics) +# request informs the editor of RuboCop offenses for a given file. +# +# # Example +# +# ```ruby +# def say_hello +# puts "Hello" # --> diagnostics: incorrect indentation +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#19 +class RubyLsp::Requests::Diagnostics < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#35 + sig { params(global_state: ::RubyLsp::GlobalState, document: ::RubyLsp::Document).void } + def initialize(global_state, document); end + + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#43 + sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::Diagnostic]))) } + def perform; end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#84 + sig { returns(T::Array[::LanguageServer::Protocol::Interface::Diagnostic]) } + def syntax_error_diagnostics; end + + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#61 + sig { returns(T::Array[::LanguageServer::Protocol::Interface::Diagnostic]) } + def syntax_warning_diagnostics; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#26 + sig { returns(T::Hash[::Symbol, T::Boolean]) } + def provider; end + end +end + +# ![Document highlight demo](../../document_highlight.gif) +# +# The [document highlight](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight) +# informs the editor all relevant elements of the currently pointed item for highlighting. For example, when +# the cursor is on the `F` of the constant `FOO`, the editor should identify other occurrences of `FOO` +# and highlight them. +# +# For writable elements like constants or variables, their read/write occurrences should be highlighted differently. +# This is achieved by sending different "kind" attributes to the editor (2 for read and 3 for write). +# +# # Example +# +# ```ruby +# FOO = 1 # should be highlighted as "write" +# +# def foo +# FOO # should be highlighted as "read" +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#27 +class RubyLsp::Requests::DocumentHighlight < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#37 + sig do + params( + document: ::RubyLsp::Document, + position: T::Hash[::Symbol, T.untyped], + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(document, position, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#48 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::DocumentHighlight]) } + def perform; end +end + +# ![Document link demo](../../document_link.gif) +# +# The [document link](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentLink) +# makes `# source://PATH_TO_FILE#line` comments in a Ruby/RBI file clickable if the file exists. +# When the user clicks the link, it'll open that location. +# +# # Example +# +# ```ruby +# # source://syntax_tree/3.2.1/lib/syntax_tree.rb#51 <- it will be clickable and will take the user to that location +# def format(source, maxwidth = T.unsafe(nil)) +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#21 +class RubyLsp::Requests::DocumentLink < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#40 + sig { params(uri: ::URI::Generic, comments: T::Array[::Prism::Comment], dispatcher: ::Prism::Dispatcher).void } + def initialize(uri, comments, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#50 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::DocumentLink]) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#28 + sig { returns(::LanguageServer::Protocol::Interface::DocumentLinkOptions) } + def provider; end + end +end + +# ![Document symbol demo](../../document_symbol.gif) +# +# The [document +# symbol](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol) request +# informs the editor of all the important symbols, such as classes, variables, and methods, defined in a file. With +# this information, the editor can populate breadcrumbs, file outline and allow for fuzzy symbol searches. +# +# In VS Code, fuzzy symbol search can be accessed by opening the command palette and inserting an `@` symbol. +# +# # Example +# +# ```ruby +# class Person # --> document symbol: class +# attr_reader :age # --> document symbol: field +# +# def initialize +# @age = 0 # --> document symbol: variable +# end +# +# def age # --> document symbol: method +# end +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#31 +class RubyLsp::Requests::DocumentSymbol < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#49 + sig { params(uri: ::URI::Generic, dispatcher: ::Prism::Dispatcher).void } + def initialize(uri, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#60 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#38 + sig { returns(::LanguageServer::Protocol::Interface::DocumentSymbolClientCapabilities) } + def provider; end + end +end + +# ![Folding ranges demo](../../folding_ranges.gif) +# +# The [folding ranges](https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange) +# request informs the editor of the ranges where and how code can be folded. +# +# # Example +# +# ```ruby +# def say_hello # <-- folding range start +# puts "Hello" +# end # <-- folding range end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#20 +class RubyLsp::Requests::FoldingRanges < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#33 + sig { params(comments: T::Array[::Prism::Comment], dispatcher: ::Prism::Dispatcher).void } + def initialize(comments, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#46 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::FoldingRange]) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#27 + sig { returns(::LanguageServer::Protocol::Interface::FoldingRangeClientCapabilities) } + def provider; end + end +end + +# ![Formatting symbol demo](../../formatting.gif) +# +# The [formatting](https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting) +# request uses RuboCop to fix auto-correctable offenses in the document. This requires enabling format on save and +# registering the ruby-lsp as the Ruby formatter. +# +# The `rubyLsp.formatter` setting specifies which formatter to use. +# If set to `auto` then it behaves as follows: +# * It will use RuboCop if it is part of the bundle. +# * If RuboCop is not available, and `syntax_tree` is a direct dependency, it will use that. +# * Otherwise, no formatting will be applied. +# +# # Example +# +# ```ruby +# def say_hello +# puts "Hello" # --> formatting: fixes the indentation on save +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#25 +class RubyLsp::Requests::Formatting < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#31 + sig { params(global_state: ::RubyLsp::GlobalState, document: ::RubyLsp::Document).void } + def initialize(global_state, document); end + + # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#39 + sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::TextEdit]))) } + def perform; end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#28 +class RubyLsp::Requests::Formatting::Error < ::StandardError; end + +# ![Hover demo](../../hover.gif) +# +# The [hover request](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover) +# displays the documentation for the symbol currently under the cursor. +# +# # Example +# +# ```ruby +# String # -> Hovering over the class reference will show all declaration locations and the documentation +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#18 +class RubyLsp::Requests::Hover < ::RubyLsp::Requests::Request + extend T::Generic + + ResponseType = type_member { { fixed: T.nilable(::LanguageServer::Protocol::Interface::Hover) } } + + # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#42 + sig do + params( + document: ::RubyLsp::Document, + global_state: ::RubyLsp::GlobalState, + position: T::Hash[::Symbol, T.untyped], + dispatcher: ::Prism::Dispatcher, + typechecker_enabled: T::Boolean + ).void + end + def initialize(document, global_state, position, dispatcher, typechecker_enabled); end + + # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#77 + sig { override.returns(ResponseType) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#26 + sig { returns(::LanguageServer::Protocol::Interface::HoverClientCapabilities) } + def provider; end + end +end + +# ![Inlay hint demo](../../inlay_hints.gif) +# +# [Inlay hints](https://microsoft.github.io/language-server-protocol/specification#textDocument_inlayHint) +# are labels added directly in the code that explicitly show the user something that might +# otherwise just be implied. +# +# # Configuration +# +# To enable rescue hints, set `rubyLsp.featuresConfiguration.inlayHint.implicitRescue` to `true`. +# +# To enable hash value hints, set `rubyLsp.featuresConfiguration.inlayHint.implicitHashValue` to `true`. +# +# To enable all hints, set `rubyLsp.featuresConfiguration.inlayHint.enableAll` to `true`. +# +# # Example +# +# ```ruby +# begin +# puts "do something that might raise" +# rescue # Label "StandardError" goes here as a bare rescue implies rescuing StandardError +# puts "handle some rescue" +# end +# ``` +# +# # Example +# +# ```ruby +# var = "foo" +# { +# var: var, # Label "var" goes here in cases where the value is omitted +# a: "hello", +# } +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#41 +class RubyLsp::Requests::InlayHints < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#61 + sig do + params( + document: ::RubyLsp::Document, + range: T::Hash[::Symbol, T.untyped], + hints_configuration: ::RubyLsp::RequestConfig, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(document, range, hints_configuration, dispatcher); end + + # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#74 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::InlayHint]) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#48 + sig { returns(::LanguageServer::Protocol::Interface::InlayHintOptions) } + def provider; end + end +end + +# ![On type formatting demo](../../on_type_formatting.gif) +# +# The [on type formatting](https://microsoft.github.io/language-server-protocol/specification#textDocument_onTypeFormatting) +# request formats code as the user is typing. For example, automatically adding `end` to class definitions. +# +# # Example +# +# ```ruby +# class Foo # <-- upon adding a line break, on type formatting is triggered +# # <-- cursor ends up here +# end # <-- end is automatically added +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#18 +class RubyLsp::Requests::OnTypeFormatting < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#49 + sig do + params( + document: ::RubyLsp::Document, + position: T::Hash[::Symbol, T.untyped], + trigger_character: ::String, + client_name: ::String + ).void + end + def initialize(document, position, trigger_character, client_name); end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#64 + sig { override.returns(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::TextEdit])) } + def perform; end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#167 + sig { params(text: ::String, position: T::Hash[::Symbol, T.untyped]).void } + def add_edit_with_text(text, position = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#214 + sig { void } + def auto_indent_after_end_keyword; end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#201 + sig { params(line: ::String).returns(::Integer) } + def find_indentation(line); end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#162 + sig { params(spaces: ::String).void } + def handle_comment_line(spaces); end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#124 + sig { void } + def handle_curly_brace; end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#154 + sig { params(delimiter: ::String).void } + def handle_heredoc_end(delimiter); end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#93 + sig { void } + def handle_pipe; end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#132 + sig { void } + def handle_statement_end; end + + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#180 + sig { params(line: ::Integer, character: ::Integer).void } + def move_cursor_to(line, character); end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#25 + sig { returns(::LanguageServer::Protocol::Interface::DocumentOnTypeFormattingOptions) } + def provider; end + end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#33 +RubyLsp::Requests::OnTypeFormatting::END_REGEXES = T.let(T.unsafe(nil), Array) + +# ![Prepare type hierarchy demo](../../prepare_type_hierarchy.gif) +# +# The [prepare type hierarchy +# request](https://microsoft.github.io/language-server-protocol/specification#textDocument_prepareTypeHierarchy) +# displays the list of ancestors (supertypes) and descendants (subtypes) for the selected type. +# +# Currently only supports supertypes due to a limitation of the index. +# +# # Example +# +# ```ruby +# class Foo; end +# class Bar < Foo; end +# +# puts Bar # <-- right click on `Bar` and select "Show Type Hierarchy" +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/prepare_type_hierarchy.rb#22 +class RubyLsp::Requests::PrepareTypeHierarchy < ::RubyLsp::Requests::Request + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/requests/prepare_type_hierarchy.rb#43 + sig do + params( + document: ::RubyLsp::Document, + index: ::RubyIndexer::Index, + position: T::Hash[::Symbol, T.untyped] + ).void + end + def initialize(document, index, position); end + + # source://ruby-lsp/lib/ruby_lsp/requests/prepare_type_hierarchy.rb#52 + sig { override.returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::TypeHierarchyItem])) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/prepare_type_hierarchy.rb#31 + sig { returns(::LanguageServer::Protocol::Interface::TypeHierarchyOptions) } + def provider; end + end +end + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/requests/request.rb#7 +class RubyLsp::Requests::Request + abstract! + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/requests/request.rb#16 + sig { abstract.returns(T.anything) } + def perform; end + + private + + # Checks if a location covers a position + # + # source://ruby-lsp/lib/ruby_lsp/requests/request.rb#22 + sig { params(location: ::Prism::Location, position: T.untyped).returns(T::Boolean) } + def cover?(location, position); end + + # Checks if a given location covers the position requested + # + # source://ruby-lsp/lib/ruby_lsp/requests/request.rb#71 + sig { params(location: T.nilable(::Prism::Location), position: T::Hash[::Symbol, T.untyped]).returns(T::Boolean) } + def covers_position?(location, position); end + + # Based on a constant node target, a constant path node parent and a position, this method will find the exact + # portion of the constant path that matches the requested position, for higher precision in hover and + # definition. For example: + # + # ```ruby + # Foo::Bar::Baz + # # ^ Going to definition here should go to Foo::Bar::Baz + # # ^ Going to definition here should go to Foo::Bar + # #^ Going to definition here should go to Foo + # ``` + # + # source://ruby-lsp/lib/ruby_lsp/requests/request.rb#55 + sig do + params( + target: ::Prism::Node, + parent: ::Prism::Node, + position: T::Hash[::Symbol, ::Integer] + ).returns(::Prism::Node) + end + def determine_target(target, parent, position); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/request.rb#11 +class RubyLsp::Requests::Request::InvalidFormatter < ::StandardError; end + +# ![Selection ranges demo](../../selection_ranges.gif) +# +# The [selection ranges](https://microsoft.github.io/language-server-protocol/specification#textDocument_selectionRange) +# request informs the editor of ranges that the user may want to select based on the location(s) +# of their cursor(s). +# +# Trigger this request with: Ctrl + Shift + -> or Ctrl + Shift + <- +# +# Note that if using VSCode Neovim, you will need to be in Insert mode for this to work correctly. +# +# # Example +# +# ```ruby +# def foo # --> The next selection range encompasses the entire method definition. +# puts "Hello, world!" # --> Cursor is on this line +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#23 +class RubyLsp::Requests::SelectionRanges < ::RubyLsp::Requests::Request + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#27 + sig { params(document: ::RubyLsp::Document).void } + def initialize(document); end + + # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#35 + sig { override.returns(T.all(::Object, T::Array[::RubyLsp::Requests::Support::SelectionRange])) } + def perform; end +end + +# ![Semantic highlighting demo](../../semantic_highlighting.gif) +# +# The [semantic +# highlighting](https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens) +# request informs the editor of the correct token types to provide consistent and accurate highlighting for themes. +# +# # Example +# +# ```ruby +# def foo +# var = 1 # --> semantic highlighting: local variable +# some_invocation # --> semantic highlighting: method invocation +# var # --> semantic highlighting: local variable +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#23 +class RubyLsp::Requests::SemanticHighlighting < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#44 + sig do + params( + global_state: ::RubyLsp::GlobalState, + dispatcher: ::Prism::Dispatcher, + range: T.nilable(T::Range[::Integer]) + ).void + end + def initialize(global_state, dispatcher, range: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#58 + sig { override.returns(::LanguageServer::Protocol::Interface::SemanticTokens) } + def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#30 + sig { returns(::LanguageServer::Protocol::Interface::SemanticTokensRegistrationOptions) } + def provider; end + end +end + +# ![Show syntax tree demo](../../show_syntax_tree.gif) +# +# Show syntax tree is a custom [LSP +# request](https://microsoft.github.io/language-server-protocol/specification#requestMessage) that displays the AST +# for the current document or for the current selection in a new tab. +# +# # Example +# +# ```ruby +# # Executing the Ruby LSP: Show syntax tree command will display the AST for the document +# 1 + 1 +# # (program (statements ((binary (int "1") + (int "1"))))) +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#20 +class RubyLsp::Requests::ShowSyntaxTree < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#24 + sig { params(document: ::RubyLsp::Document, range: T.nilable(T::Hash[::Symbol, T.untyped])).void } + def initialize(document, range); end + + # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#31 + sig { override.returns(::String) } + def perform; end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#42 + sig { returns(::String) } + def ast_for_range; end +end + +# ![Signature help demo](../../signature_help.gif) +# +# The [signature help +# request](https://microsoft.github.io/language-server-protocol/specification#textDocument_signatureHelp) displays +# information about the parameters of a method as you type an invocation. +# +# Currently only supports methods invoked directly on `self` without taking inheritance into account. +# +# # Example +# +# ```ruby +# class Foo +# def bar(a, b, c) +# end +# +# def baz +# bar( # -> Signature help will show the parameters of `bar` +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#27 +class RubyLsp::Requests::SignatureHelp < ::RubyLsp::Requests::Request + # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#52 + sig do + params( + document: ::RubyLsp::Document, + global_state: ::RubyLsp::GlobalState, + position: T::Hash[::Symbol, T.untyped], + context: T.nilable(T::Hash[::Symbol, T.untyped]), + dispatcher: ::Prism::Dispatcher, + typechecker_enabled: T::Boolean + ).void + end + def initialize(document, global_state, position, context, dispatcher, typechecker_enabled); end + + # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#68 + sig { override.returns(T.nilable(::LanguageServer::Protocol::Interface::SignatureHelp)) } + def perform; end + + private + + # Adjust the target of signature help in the case where we have nested method calls. This is necessary so that we + # select the right target in a situation like this: + # + # foo(another_method_call) + # + # In that case, we want to provide signature help for `foo` and not `another_method_call`. + # + # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#90 + sig do + params( + target: T.nilable(::Prism::Node), + parent: T.nilable(::Prism::Node), + position: T::Hash[::Symbol, T.untyped] + ).returns(T.nilable(::Prism::Node)) + end + def adjust_for_nested_target(target, parent, position); end + + # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#106 + sig { params(node: ::Prism::Node, position: T::Hash[::Symbol, T.untyped]).returns(T::Boolean) } + def node_covers?(node, position); end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#34 + sig { returns(::LanguageServer::Protocol::Interface::SignatureHelpOptions) } + def provider; end + end +end + +# source://ruby-lsp/lib/ruby_lsp/requests.rb#54 +module RubyLsp::Requests::Support; end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#7 +class RubyLsp::Requests::Support::Annotation + # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#15 + sig { params(arity: T.any(::Integer, T::Range[::Integer]), receiver: T::Boolean).void } + def initialize(arity:, receiver: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#21 + sig { params(node: ::Prism::CallNode).returns(T::Boolean) } + def match?(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#34 + sig { params(node: ::Prism::CallNode).returns(T::Boolean) } + def arity_matches?(node); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#28 + sig { params(node: ::Prism::CallNode).returns(T::Boolean) } + def receiver_matches?(node); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#7 +module RubyLsp::Requests::Support::Common + requires_ancestor { Kernel } + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#92 + sig do + params( + title: ::String, + entries: T.any(::RubyIndexer::Entry, T::Array[::RubyIndexer::Entry]), + max_entries: T.nilable(::Integer) + ).returns(T::Hash[::Symbol, ::String]) + end + def categorized_markdown_from_index_entries(title, entries, max_entries = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#156 + sig do + params( + node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantPathTargetNode, ::Prism::ConstantReadNode) + ).returns(T.nilable(::String)) + end + def constant_name(node); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#58 + sig do + params( + node: ::Prism::Node, + title: ::String, + command_name: ::String, + arguments: T.nilable(T::Array[T.untyped]), + data: T.nilable(T::Hash[T.untyped, T.untyped]) + ).returns(::LanguageServer::Protocol::Interface::CodeLens) + end + def create_code_lens(node, title:, command_name:, arguments:, data:); end + + # Iterates over each part of a constant path, so that we can easily push response items for each section of the + # name. For example, for `Foo::Bar::Baz`, this method will invoke the block with `Foo`, then `Bar` and finally + # `Baz`. + # + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#181 + sig { params(node: ::Prism::Node, block: T.proc.params(part: ::Prism::Node).void).void } + def each_constant_path_part(node, &block); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#191 + sig { params(entry: ::RubyIndexer::Entry).returns(T.nilable(::Integer)) } + def kind_for_entry(entry); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#135 + sig do + params( + title: ::String, + entries: T.any(::RubyIndexer::Entry, T::Array[::RubyIndexer::Entry]), + max_entries: T.nilable(::Integer) + ).returns(::String) + end + def markdown_from_index_entries(title, entries, max_entries = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#164 + sig { params(node: T.any(::Prism::ClassNode, ::Prism::ModuleNode)).returns(T.nilable(::String)) } + def namespace_constant_name(node); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#73 + sig { params(file_path: ::String).returns(T.nilable(T::Boolean)) } + def not_in_dependencies?(file_path); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#30 + sig do + params( + location: T.any(::Prism::Location, ::RubyIndexer::Location) + ).returns(::LanguageServer::Protocol::Interface::Range) + end + def range_from_location(location); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#17 + sig { params(node: ::Prism::Node).returns(::LanguageServer::Protocol::Interface::Range) } + def range_from_node(node); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#80 + sig { params(node: ::Prism::CallNode).returns(T::Boolean) } + def self_receiver?(node); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#41 + sig { params(node: T.nilable(::Prism::Node), range: T.nilable(T::Range[::Integer])).returns(T::Boolean) } + def visible?(node, range); end +end + +# @abstract Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/requests/support/formatter.rb#7 +module RubyLsp::Requests::Support::Formatter + interface! + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/requests/support/formatter.rb#22 + sig do + abstract + .params( + uri: ::URI::Generic, + document: ::RubyLsp::Document + ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::Diagnostic])) + end + def run_diagnostic(uri, document); end + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/requests/support/formatter.rb#14 + sig { abstract.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(T.nilable(::String)) } + def run_formatting(uri, document); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#23 +class RubyLsp::Requests::Support::InternalRuboCopError < ::StandardError + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#33 + sig { params(rubocop_error: T.any(::RuboCop::ErrorWithAnalyzedFileLocation, ::StandardError)).void } + def initialize(rubocop_error); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#26 +RubyLsp::Requests::Support::InternalRuboCopError::MESSAGE = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#7 +class RubyLsp::Requests::Support::RuboCopDiagnostic + # TODO: avoid passing document once we have alternative ways to get at + # encoding and file source + # + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#35 + sig { params(document: ::RubyLsp::Document, offense: ::RuboCop::Cop::Offense, uri: ::URI::Generic).void } + def initialize(document, offense, uri); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#42 + sig { returns(T::Array[::LanguageServer::Protocol::Interface::CodeAction]) } + def to_lsp_code_actions; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#52 + sig { params(config: ::RuboCop::Config).returns(::LanguageServer::Protocol::Interface::Diagnostic) } + def to_lsp_diagnostic(config); end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#107 + sig { returns(::LanguageServer::Protocol::Interface::CodeAction) } + def autocorrect_action; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#94 + sig { params(config: ::RuboCop::Config).returns(T.nilable(::LanguageServer::Protocol::Interface::CodeDescription)) } + def code_description(config); end + + # When `RuboCop::LSP.enable` is called, contextual autocorrect will not offer itself + # as `correctable?` to prevent annoying changes while typing. Instead check if + # a corrector is present. If it is, then that means some code transformation can be applied. + # + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#201 + sig { returns(T::Boolean) } + def correctable?; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#140 + sig { returns(::LanguageServer::Protocol::Interface::CodeAction) } + def disable_line_action; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#182 + sig { params(line: ::String).returns(::Integer) } + def length_of_line(line); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#159 + sig { returns(T::Array[::LanguageServer::Protocol::Interface::TextEdit]) } + def line_disable_comment; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#82 + sig { returns(::String) } + def message; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#127 + sig { returns(T::Array[::LanguageServer::Protocol::Interface::TextEdit]) } + def offense_replacements; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#89 + sig { returns(T.nilable(::Integer)) } + def severity; end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#22 +RubyLsp::Requests::Support::RuboCopDiagnostic::ENHANCED_DOC_URL = T.let(T.unsafe(nil), TrueClass) + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#10 +RubyLsp::Requests::Support::RuboCopDiagnostic::RUBOCOP_TO_LSP_SEVERITY = T.let(T.unsafe(nil), Hash) + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatter.rb#9 +class RubyLsp::Requests::Support::RuboCopFormatter + include ::RubyLsp::Requests::Support::Formatter + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatter.rb#14 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatter.rb#35 + sig do + override + .params( + uri: ::URI::Generic, + document: ::RubyLsp::Document + ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::Diagnostic])) + end + def run_diagnostic(uri, document); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatter.rb#21 + sig { override.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(T.nilable(::String)) } + def run_formatting(uri, document); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#45 +class RubyLsp::Requests::Support::RuboCopRunner < ::RuboCop::Runner + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#75 + sig { params(args: ::String).void } + def initialize(*args); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#54 + sig { returns(::RuboCop::Config) } + def config_for_working_directory; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#112 + sig { returns(::String) } + def formatted_source; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#51 + sig { returns(T::Array[::RuboCop::Cop::Offense]) } + def offenses; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#90 + sig { params(path: ::String, contents: ::String).void } + def run(path, contents); end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#138 + sig { params(_file: ::String, offenses: T::Array[::RuboCop::Cop::Offense]).void } + def file_finished(_file, offenses); end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#120 + sig { params(cop_name: ::String).returns(T.nilable(T.class_of(RuboCop::Cop::Base))) } + def find_cop_by_name(cop_name); end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#127 + sig { returns(T::Hash[::String, [T.class_of(RuboCop::Cop::Base)]]) } + def cop_registry; end + end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#48 +class RubyLsp::Requests::Support::RuboCopRunner::ConfigurationError < ::StandardError; end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#56 +RubyLsp::Requests::Support::RuboCopRunner::DEFAULT_ARGS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp/lib/ruby_lsp/requests/support/selection_range.rb#7 +class RubyLsp::Requests::Support::SelectionRange < ::LanguageServer::Protocol::Interface::SelectionRange + # source://ruby-lsp/lib/ruby_lsp/requests/support/selection_range.rb#11 + sig { params(position: T::Hash[::Symbol, T.untyped]).returns(T::Boolean) } + def cover?(position); end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#7 +class RubyLsp::Requests::Support::Sorbet + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#48 + sig { params(node: ::Prism::CallNode).returns(T::Boolean) } + def annotation?(node); end + end +end + +# ![Type hierarchy supertypes demo](../../type_hierarchy_supertypes.gif) +# +# The [type hierarchy supertypes +# request](https://microsoft.github.io/language-server-protocol/specification#typeHierarchy_supertypes) +# displays the list of ancestors (supertypes) for the selected type. +# +# # Example +# +# ```ruby +# class Foo; end +# class Bar < Foo; end +# +# puts Bar # <-- right click on `Bar` and select "Show Type Hierarchy" +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb#20 +class RubyLsp::Requests::TypeHierarchySupertypes < ::RubyLsp::Requests::Request + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb#26 + sig { params(index: ::RubyIndexer::Index, item: T::Hash[::Symbol, T.untyped]).void } + def initialize(index, item); end + + # source://ruby-lsp/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb#34 + sig { override.returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::TypeHierarchyItem])) } + def perform; end + + private + + # source://ruby-lsp/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb#77 + sig { params(entry: ::RubyIndexer::Entry).returns(::LanguageServer::Protocol::Interface::TypeHierarchyItem) } + def hierarchy_item(entry); end +end + +# ![Workspace symbol demo](../../workspace_symbol.gif) +# +# The [workspace symbol](https://microsoft.github.io/language-server-protocol/specification#workspace_symbol) +# request allows fuzzy searching declarations in the entire project. On VS Code, use CTRL/CMD + T to search for +# symbols. +# +# # Example +# +# ```ruby +# # Searching for `Floo` will fuzzy match and return all declarations according to the query, including this `Foo` +# class +# class Foo +# end +# ``` +# +# source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#21 +class RubyLsp::Requests::WorkspaceSymbol < ::RubyLsp::Requests::Request + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#26 + sig { params(global_state: ::RubyLsp::GlobalState, query: T.nilable(::String)).void } + def initialize(global_state, query); end + + # source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#34 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::WorkspaceSymbol]) } + def perform; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders.rb#5 +module RubyLsp::ResponseBuilders; end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/collection_response_builder.rb#6 +class RubyLsp::ResponseBuilders::CollectionResponseBuilder < ::RubyLsp::ResponseBuilders::ResponseBuilder + extend T::Generic + + ResponseType = type_member { { upper: Object } } + + # source://ruby-lsp/lib/ruby_lsp/response_builders/collection_response_builder.rb#13 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/collection_response_builder.rb#19 + sig { params(item: ResponseType).void } + def <<(item); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/collection_response_builder.rb#24 + sig { override.returns(T::Array[ResponseType]) } + def response; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#6 +class RubyLsp::ResponseBuilders::DocumentSymbol < ::RubyLsp::ResponseBuilders::ResponseBuilder + extend T::Generic + + ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol] } } + + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#24 + sig { void } + def initialize; end + + # @param symbol [Interface::DocumentSymbol] + # @return [void] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def <<(*args, **_arg1, &blk); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#47 + sig do + returns(T.any(::LanguageServer::Protocol::Interface::DocumentSymbol, ::RubyLsp::ResponseBuilders::DocumentSymbol::SymbolHierarchyRoot)) + end + def last; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#40 + sig { returns(T.nilable(::LanguageServer::Protocol::Interface::DocumentSymbol)) } + def pop; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#33 + sig { params(symbol: ::LanguageServer::Protocol::Interface::DocumentSymbol).void } + def push(symbol); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#52 + sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]) } + def response; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#9 +class RubyLsp::ResponseBuilders::DocumentSymbol::SymbolHierarchyRoot + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#16 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#13 + sig { returns(T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]) } + def children; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/hover.rb#6 +class RubyLsp::ResponseBuilders::Hover < ::RubyLsp::ResponseBuilders::ResponseBuilder + extend T::Generic + + ResponseType = type_member { { fixed: String } } + + # source://ruby-lsp/lib/ruby_lsp/response_builders/hover.rb#13 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/hover.rb#35 + sig { returns(T::Boolean) } + def empty?; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/hover.rb#27 + sig { params(content: ::String, category: ::Symbol).void } + def push(content, category:); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/hover.rb#40 + sig { override.returns(ResponseType) } + def response; end +end + +# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_lsp/response_builders/response_builder.rb#6 +class RubyLsp::ResponseBuilders::ResponseBuilder + abstract! + + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/response_builders/response_builder.rb#13 + sig { abstract.returns(T.anything) } + def response; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#6 +class RubyLsp::ResponseBuilders::SemanticHighlighting < ::RubyLsp::ResponseBuilders::ResponseBuilder + extend T::Generic + + ResponseType = type_member { { fixed: LanguageServer::Protocol::Interface::SemanticTokens } } + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#59 + sig { params(encoding: ::Encoding).void } + def initialize(encoding); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#66 + sig { params(location: ::Prism::Location, type: ::Symbol, modifiers: T::Array[::Symbol]).void } + def add_token(location, type, modifiers = T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#90 + sig { returns(T.nilable(::RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken)) } + def last; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#81 + sig { params(location: ::Prism::Location).returns(T::Boolean) } + def last_token_matches?(location); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#95 + sig { override.returns(::LanguageServer::Protocol::Interface::SemanticTokens) } + def response; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#99 +class RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#126 + sig do + params( + start_line: ::Integer, + start_code_unit_column: ::Integer, + length: ::Integer, + type: ::Integer, + modifier: T::Array[::Integer] + ).void + end + def initialize(start_line:, start_code_unit_column:, length:, type:, modifier:); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#109 + sig { returns(::Integer) } + def length; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#115 + sig { returns(T::Array[::Integer]) } + def modifier; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#143 + sig { params(modifier_symbols: T::Array[::Symbol]).void } + def replace_modifier(modifier_symbols); end + + # @raise [UndefinedTokenType] + # + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#135 + sig { params(type_symbol: ::Symbol).void } + def replace_type(type_symbol); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#106 + sig { returns(::Integer) } + def start_code_unit_column; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#103 + sig { returns(::Integer) } + def start_line; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#112 + sig { returns(::Integer) } + def type; end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#153 +class RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticTokenEncoder + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#157 + sig { void } + def initialize; end + + # For more information on how each number is calculated, read: + # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens + # + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#192 + sig { params(token: ::RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken).returns(T::Array[::Integer]) } + def compute_delta(token); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#167 + sig do + params( + tokens: T::Array[::RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken] + ).returns(::LanguageServer::Protocol::Interface::SemanticTokens) + end + def encode(tokens); end + + # Encode an array of modifiers to positions onto a bit flag + # For example, [:default_library] will be encoded as + # 0b1000000000, as :default_library is the 10th bit according + # to the token modifiers index map. + # + # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#214 + sig { params(modifiers: T::Array[::Integer]).returns(::Integer) } + def encode_modifiers(modifiers); end +end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#38 +RubyLsp::ResponseBuilders::SemanticHighlighting::TOKEN_MODIFIERS = T.let(T.unsafe(nil), Hash) + +# source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#9 +RubyLsp::ResponseBuilders::SemanticHighlighting::TOKEN_TYPES = T.let(T.unsafe(nil), Hash) + +# source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#7 +class RubyLsp::ResponseBuilders::SemanticHighlighting::UndefinedTokenType < ::StandardError; end + +# source://ruby-lsp/lib/ruby_lsp/response_builders/signature_help.rb#6 +class RubyLsp::ResponseBuilders::SignatureHelp < ::RubyLsp::ResponseBuilders::ResponseBuilder + extend T::Generic + + ResponseType = type_member { { fixed: T.nilable(::LanguageServer::Protocol::Interface::SignatureHelp) } } + + # source://ruby-lsp/lib/ruby_lsp/response_builders/signature_help.rb#12 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/signature_help.rb#18 + sig { params(signature_help: ResponseType).void } + def replace(signature_help); end + + # source://ruby-lsp/lib/ruby_lsp/response_builders/signature_help.rb#23 + sig { override.returns(ResponseType) } + def response; end +end + +# The final result of running a request before its IO is finalized +# +# source://ruby-lsp/lib/ruby_lsp/utils.rb#118 +class RubyLsp::Result + # source://ruby-lsp/lib/ruby_lsp/utils.rb#125 + sig { params(id: ::Integer, response: T.untyped).void } + def initialize(id:, response:); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#122 + sig { returns(T.untyped) } + def response; end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#131 + sig { returns(T::Hash[::Symbol, T.untyped]) } + def to_hash; end +end + +# source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#5 +class RubyLsp::RubyDocument < ::RubyLsp::Document + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#7 + sig { override.returns(::Prism::ParseResult) } + def parse; end +end + +# source://ruby-lsp/lib/ruby_lsp/server.rb#5 +class RubyLsp::Server < ::RubyLsp::BaseServer + # source://ruby-lsp/lib/ruby_lsp/server.rb#13 + sig { params(test_mode: T::Boolean).void } + def initialize(test_mode: T.unsafe(nil)); end + + # Only for testing + # + # source://ruby-lsp/lib/ruby_lsp/server.rb#10 + sig { returns(::RubyLsp::GlobalState) } + def global_state; end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#108 + sig { void } + def load_addons; end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#19 + sig { override.params(message: T::Hash[::Symbol, T.untyped]).void } + def process_message(message); end + + private + + # source://ruby-lsp/lib/ruby_lsp/server.rb#769 + sig { params(id: ::String, title: ::String, percentage: ::Integer).void } + def begin_progress(id, title, percentage: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#830 + sig { void } + def check_formatter_is_available; end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#505 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def code_action_resolve(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#812 + sig { params(id: ::String).void } + def end_progress(id); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#740 + sig { params(config_hash: T::Hash[::String, T.untyped]).void } + def perform_initial_indexing(config_hash); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#793 + sig { params(id: ::String, percentage: ::Integer).void } + def progress(id, percentage); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#340 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def run_combined_requests(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#130 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def run_initialize(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#242 + sig { void } + def run_initialized; end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#735 + sig { override.void } + def shutdown; end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#488 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_code_action(message); end + + # @param message [Hash{Symbol => T.untyped}] + # @return [void] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def text_document_code_lens(*args, **_arg1, &blk); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#564 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_completion(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#584 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_completion_item_resolve(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#613 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_definition(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#535 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_diagnostic(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#309 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_did_change(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#293 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_did_close(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#280 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_did_open(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#425 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_document_highlight(message); end + + # @param message [Hash{Symbol => T.untyped}] + # @return [void] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def text_document_document_link(*args, **_arg1, &blk); end + + # @param message [Hash{Symbol => T.untyped}] + # @return [void] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def text_document_document_symbol(*args, **_arg1, &blk); end + + # @param message [Hash{Symbol => T.untyped}] + # @return [void] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def text_document_folding_range(*args, **_arg1, &blk); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#398 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_formatting(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#452 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_hover(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#477 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_inlay_hint(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#435 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_on_type_formatting(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#685 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_prepare_type_hierarchy(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#319 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_selection_range(message); end + + # @param message [Hash{Symbol => T.untyped}] + # @return [void] + # + # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + def text_document_semantic_tokens_full(*args, **_arg1, &blk); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#381 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_semantic_tokens_range(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#673 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_show_syntax_tree(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#592 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_signature_help(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#705 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def type_hierarchy_subtypes(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#696 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def type_hierarchy_supertypes(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#472 + sig { params(document: ::RubyLsp::Document).returns(T::Boolean) } + def typechecker_enabled?(document); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#712 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def workspace_dependencies(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#633 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def workspace_did_change_watched_files(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#660 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def workspace_symbol(message); end +end + +# source://ruby-lsp/lib/ruby_lsp/store.rb#5 +class RubyLsp::Store + # source://ruby-lsp/lib/ruby_lsp/store.rb#21 + sig { void } + def initialize; end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#82 + sig do + type_parameters(:T) + .params( + uri: ::URI::Generic, + request_name: ::String, + block: T.proc.params(document: ::RubyLsp::Document).returns(T.type_parameter(:T)) + ).returns(T.type_parameter(:T)) + end + def cache_fetch(uri, request_name, &block); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#60 + sig { void } + def clear; end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#18 + sig { returns(::String) } + def client_name; end + + # @return [String] + # + # source://ruby-lsp/lib/ruby_lsp/store.rb#18 + def client_name=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#70 + sig { params(uri: ::URI::Generic).void } + def delete(uri); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#65 + sig { returns(T::Boolean) } + def empty?; end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#12 + sig { returns(T::Boolean) } + def experimental_features; end + + # @return [Boolean] + # + # source://ruby-lsp/lib/ruby_lsp/store.rb#12 + def experimental_features=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#15 + sig { returns(T::Hash[::Symbol, ::RubyLsp::RequestConfig]) } + def features_configuration; end + + # @return [Hash{Symbol => RequestConfig}] + # + # source://ruby-lsp/lib/ruby_lsp/store.rb#15 + def features_configuration=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#39 + sig { params(uri: ::URI::Generic).returns(::RubyLsp::Document) } + def get(uri); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#55 + sig { params(uri: ::URI::Generic, edits: T::Array[T::Hash[::Symbol, T.untyped]], version: ::Integer).void } + def push_edits(uri:, edits:, version:); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#49 + sig { params(uri: ::URI::Generic, source: ::String, version: ::Integer, encoding: ::Encoding).void } + def set(uri:, source:, version:, encoding: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/store.rb#9 + sig { returns(T::Boolean) } + def supports_progress; end + + # @return [Boolean] + # + # source://ruby-lsp/lib/ruby_lsp/store.rb#9 + def supports_progress=(_arg0); end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#8 +RubyLsp::Transport = LanguageServer::Protocol::Transport + +# A minimalistic type checker to try to resolve types that can be inferred without requiring a type system or +# annotations +# +# source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#7 +class RubyLsp::TypeInferrer + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#11 + sig { params(index: ::RubyIndexer::Index).void } + def initialize(index); end + + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#16 + sig { params(node_context: ::RubyLsp::NodeContext).returns(T.nilable(::String)) } + def infer_receiver_type(node_context); end + + private + + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#79 + sig { params(node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantReadNode)).returns(T.nilable(::String)) } + def constant_name(node); end + + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#39 + sig { params(node: ::Prism::CallNode, node_context: ::RubyLsp::NodeContext).returns(T.nilable(::String)) } + def infer_receiver_for_call_node(node, node_context); end +end + +# source://ruby-lsp/lib/ruby-lsp.rb#5 +RubyLsp::VERSION = T.let(T.unsafe(nil), String) + +# source://ruby-lsp/lib/core_ext/uri.rb#4 +module URI + include ::URI::RFC2396_REGEXP +end + +# source://ruby-lsp/lib/core_ext/uri.rb#5 +class URI::Generic + include ::URI::RFC2396_REGEXP + include ::URI +end + +# Must be kept in sync with the one in Tapioca +# +# source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#8 +class URI::Source < ::URI::File + # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#62 + sig { params(v: T.nilable(::String)).returns(T::Boolean) } + def check_host(v); end + + # source://uri/0.13.0lib/uri/generic.rb#243 + def gem_name; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#26 + sig { returns(T.nilable(::String)) } + def gem_version; end + + # source://uri/0.13.0lib/uri/generic.rb#283 + def line_number; end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#52 + sig { params(v: T.nilable(::String)).void } + def set_path(v); end + + # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#74 + sig { returns(::String) } + def to_s; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#39 + sig do + params( + gem_name: ::String, + gem_version: T.nilable(::String), + path: ::String, + line_number: T.nilable(::String) + ).returns(::URI::Source) + end + def build(gem_name:, gem_version:, path:, line_number:); end + end +end + +# source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#11 +URI::Source::COMPONENT = T.let(T.unsafe(nil), Array) + +class URI::WSS < ::URI::WS; end From e9a8802dcd87eeb988b64efcb572714e805d3b94 Mon Sep 17 00:00:00 2001 From: Kaan Ozkan Date: Thu, 8 Aug 2024 09:27:19 -0400 Subject: [PATCH 03/30] Simplify send_message --- lib/ruby_lsp/tapioca/addon.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 558ddf160..9d2321061 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -34,6 +34,7 @@ def name end def self.dsl(params) + File.write("output.txt", "DSL called: #{params[:constants]}", mode: "a") command = ::Tapioca::Commands::DslGenerate.new( requested_constants: params[:constants], tapioca_path: ::Tapioca::TAPIOCA_DIR, @@ -55,22 +56,22 @@ def workspace_did_change_watched_files(changes) entries = files_to_entries[path] return unless entries entries.map do |entry| - next unless RubyIndexer::Entry::Namespace === entry + next unless entry.class == RubyIndexer::Entry::Class || + entry.class == RubyIndexer::Entry::Module entry.name end end.flatten.compact - $stderr.puts "Tapioca LSP: Sending message with #{constants}" if constants.any? send_message("tapioca_dsl", constants: constants) if constants.any? end - sig { params(request: String, params: T.nilable(T::Hash[Symbol, T.untyped])).void } - def send_message(request, params = nil) - message = { method: request } - message[:params] = params if params + sig { params(request: String, params: T::Hash[Symbol, T.untyped]).void } + def send_message(request, params) + message = { method: request, params: params } json = message.to_json + $stderr.puts "Tapioca LSP: Sending message with #{params}: #{json}" stdin = rails_runner_stdin stdin.write("Content-Length: #{json.length}\r\n\r\n", json) end From 42a36edfb56936d43753b87bbaaf2475971ff2b5 Mon Sep 17 00:00:00 2001 From: Kaan Ozkan Date: Thu, 8 Aug 2024 12:15:32 -0400 Subject: [PATCH 04/30] Incorrect puts --- lib/tapioca/dsl/pipeline.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/tapioca/dsl/pipeline.rb b/lib/tapioca/dsl/pipeline.rb index 6728e42ed..568edd672 100644 --- a/lib/tapioca/dsl/pipeline.rb +++ b/lib/tapioca/dsl/pipeline.rb @@ -147,14 +147,11 @@ def gather_active_compilers(requested_compilers, excluded_compilers) ).returns(T::Set[Module]) end def gather_constants(requested_constants, requested_paths, skipped_constants) - puts "Requested constants: #{requested_constants}" constants = Set.new.compare_by_identity - puts "Active compilers: #{active_compilers}" active_compilers.each do |compiler| constants.merge(compiler.processable_constants) end - puts "Gathered constants 1 : #{constants}" constants = filter_anonymous_and_reloaded_constants(constants) constants -= skipped_constants @@ -167,7 +164,6 @@ def gather_constants(requested_constants, requested_paths, skipped_constants) "#{requested_and_skipped}. Check the supplied arguments and your `sorbet/tapioca/config.yml` file.") end end - puts "Gathered constants 2: #{constants}" constants end From b866d34b77a510d579a3f56746cf539774283162 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:47:28 -0400 Subject: [PATCH 05/30] Add line break and timestamp to log --- lib/ruby_lsp/tapioca/addon.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 9d2321061..9afcecdd7 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -34,7 +34,7 @@ def name end def self.dsl(params) - File.write("output.txt", "DSL called: #{params[:constants]}", mode: "a") + File.write("output.txt", "#{Time.now} DSL called: #{params[:constants]}\n", mode: "a") command = ::Tapioca::Commands::DslGenerate.new( requested_constants: params[:constants], tapioca_path: ::Tapioca::TAPIOCA_DIR, @@ -55,6 +55,7 @@ def workspace_did_change_watched_files(changes) path = change[:uri].gsub("file://", "") entries = files_to_entries[path] return unless entries + entries.map do |entry| next unless entry.class == RubyIndexer::Entry::Class || entry.class == RubyIndexer::Entry::Module From 46924738299cc542984892c17346ae4fd2715c30 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:41:06 -0400 Subject: [PATCH 06/30] Conditionally load addon --- lib/ruby_lsp/tapioca/addon.rb | 6 ++++++ lib/tapioca.rb | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 9afcecdd7..42616d76f 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -1,6 +1,12 @@ # typed: true # frozen_string_literal: true +begin + require "ruby-lsp-rails" +rescue LoadError + return +end + require "tapioca/internal" module RubyLsp diff --git a/lib/tapioca.rb b/lib/tapioca.rb index 459dab077..32822f98f 100644 --- a/lib/tapioca.rb +++ b/lib/tapioca.rb @@ -63,3 +63,4 @@ class Error < StandardError; end end require "tapioca/version" +require "ruby_lsp/tapioca/addon" From 5f192a82891e2430018e97538c9aeda74552eb5d Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:03:59 -0400 Subject: [PATCH 07/30] Add note about possible bug --- lib/ruby_lsp/tapioca/addon.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 42616d76f..e9aa01268 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -9,6 +9,8 @@ require "tapioca/internal" +# bug? saving file before rails boots causes crash + module RubyLsp module Tapioca class Addon < ::RubyLsp::Addon From f70f26028b3bc63e4de74e20620d3274b5e97da5 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:29:18 -0400 Subject: [PATCH 08/30] Remove unused method --- lib/ruby_lsp/tapioca/addon.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index e9aa01268..6ceceecb8 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -21,11 +21,6 @@ def initialize @index = T.let(nil, T.nilable(RubyIndexer::Index)) end - def rails_runner_stdin - stdin = @global_state.instance_variable_get(:@rails_runner_stdin) - @rails_runner_stdin ||= stdin - end - def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") @index = global_state.index From c63faa6cef1417c285616c088ca4e6c66743ebe8 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:30:00 -0400 Subject: [PATCH 09/30] Stop ignoring .ruby-lsp --- sorbet/config | 1 - 1 file changed, 1 deletion(-) diff --git a/sorbet/config b/sorbet/config index 03255b7f6..c54e716d8 100644 --- a/sorbet/config +++ b/sorbet/config @@ -3,4 +3,3 @@ --ignore=/vendor --enable-experimental-requires-ancestor --suppress-payload-superclass-redefinition-for=Reline::ANSI ---ignore=/.ruby-lsp/ From b9d44f471bdcd8038fbcaadfe6ad7383e2ad4cd0 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:41:31 -0400 Subject: [PATCH 10/30] Rename --- lib/ruby_lsp/tapioca/addon.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 6ceceecb8..2410f89b9 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -36,8 +36,7 @@ def name "Tapioca" end - def self.dsl(params) - File.write("output.txt", "#{Time.now} DSL called: #{params[:constants]}\n", mode: "a") + def dsl(params) command = ::Tapioca::Commands::DslGenerate.new( requested_constants: params[:constants], tapioca_path: ::Tapioca::TAPIOCA_DIR, @@ -67,7 +66,7 @@ def workspace_did_change_watched_files(changes) end end.flatten.compact - send_message("tapioca_dsl", constants: constants) if constants.any? + send_message("tapioca.dsl", constants: constants) if constants.any? end sig { params(request: String, params: T::Hash[Symbol, T.untyped]).void } From 56c1c6a8c9821e0f58eb25c9a9400d39f6ffdeb1 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:43:55 -0400 Subject: [PATCH 11/30] Remove comments --- lib/tapioca/commands/abstract_dsl.rb | 1 - lib/tapioca/dsl/pipeline.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/tapioca/commands/abstract_dsl.rb b/lib/tapioca/commands/abstract_dsl.rb index 78e29092d..595c7cf3d 100644 --- a/lib/tapioca/commands/abstract_dsl.rb +++ b/lib/tapioca/commands/abstract_dsl.rb @@ -153,7 +153,6 @@ def existing_rbi_filenames(requested_constants, path: @outpath) sig { params(constant_names: T::Array[String], ignore_missing: T::Boolean).returns(T::Array[Module]) } def constantize(constant_names, ignore_missing: false) constant_map = constant_names.to_h do |name| - puts "Constantize: #{name}" [name, Object.const_get(name)] rescue NameError puts "NameError for #{name}" diff --git a/lib/tapioca/dsl/pipeline.rb b/lib/tapioca/dsl/pipeline.rb index 568edd672..a0eebbedf 100644 --- a/lib/tapioca/dsl/pipeline.rb +++ b/lib/tapioca/dsl/pipeline.rb @@ -120,7 +120,6 @@ def compilers end, T.nilable(T::Array[T.class_of(Compiler)]), ) - puts "Compilers: #{@compilers}" @compilers end From 5d1dfa23ce7caa2b68b9abbca9c7773cbb1888b6 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:44:29 -0400 Subject: [PATCH 12/30] Minor refactor --- lib/ruby_lsp/tapioca/addon.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 2410f89b9..f90c6b923 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -58,12 +58,10 @@ def workspace_did_change_watched_files(changes) entries = files_to_entries[path] return unless entries - entries.map do |entry| - next unless entry.class == RubyIndexer::Entry::Class || + entries.select do |entry| + entry.class == RubyIndexer::Entry::Class || entry.class == RubyIndexer::Entry::Module - - entry.name - end + end.map(&:name) end.flatten.compact send_message("tapioca.dsl", constants: constants) if constants.any? From 35caba8cec38b20ef6ae1ccdb4d6d56b8f5e279a Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:45:07 -0400 Subject: [PATCH 13/30] Don't use rails_runner_stdin method --- lib/ruby_lsp/tapioca/addon.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index f90c6b923..9b5043b5b 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -72,9 +72,8 @@ def send_message(request, params) message = { method: request, params: params } json = message.to_json - $stderr.puts "Tapioca LSP: Sending message with #{params}: #{json}" - stdin = rails_runner_stdin - stdin.write("Content-Length: #{json.length}\r\n\r\n", json) + $stderr.puts "Tapioca LSP: Sending request '#{request}' with params #{params}" + @global_state.rails_runner_stdin.write("Content-Length: #{json.length}\r\n\r\n", json) end end end From 71d1621ce6360f0dc0812b7c273c2dfcf8299333 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:21:18 -0400 Subject: [PATCH 14/30] Reminder --- lib/ruby_lsp/tapioca/addon.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 9b5043b5b..5b2f1320b 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -52,6 +52,7 @@ def dsl(params) sig { params(changes: T::Array[{ uri: String, type: Integer }]).void } def workspace_did_change_watched_files(changes) + # TODO: avoid direct access files_to_entries = @index.instance_variable_get("@files_to_entries") constants = changes.map do |change| path = change[:uri].gsub("file://", "") From 6357acaf61591a3cf5463dc4f43a4de4e51921e5 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:21:28 -0400 Subject: [PATCH 15/30] Skip lint --- lib/ruby_lsp/tapioca/addon.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 5b2f1320b..ff5288042 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -57,7 +57,7 @@ def workspace_did_change_watched_files(changes) constants = changes.map do |change| path = change[:uri].gsub("file://", "") entries = files_to_entries[path] - return unless entries + return unless entries # rubocop:disable Lint/NonLocalExitFromIterator entries.select do |entry| entry.class == RubyIndexer::Entry::Class || From df41419561009f6427f8206b6ad85a1f7ecc10e4 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:48:27 -0400 Subject: [PATCH 16/30] wip --- lib/ruby_lsp/tapioca/addon.rb | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index ff5288042..dd227354e 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -25,6 +25,7 @@ def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") @index = global_state.index @global_state = global_state + @addon = RubyLsp::Addon.get("Ruby LSP Rails") end sig { override.void } @@ -52,29 +53,27 @@ def dsl(params) sig { params(changes: T::Array[{ uri: String, type: Integer }]).void } def workspace_did_change_watched_files(changes) - # TODO: avoid direct access + # TODO: avoid direct access? files_to_entries = @index.instance_variable_get("@files_to_entries") constants = changes.map do |change| path = change[:uri].gsub("file://", "") entries = files_to_entries[path] + + # entries = @index.entries_for(path, RubyIndexer::Entry::Namespace) return unless entries # rubocop:disable Lint/NonLocalExitFromIterator entries.select do |entry| + # TODO: RubyIndexer::Entry::Namespace entry.class == RubyIndexer::Entry::Class || entry.class == RubyIndexer::Entry::Module end.map(&:name) end.flatten.compact - send_message("tapioca.dsl", constants: constants) if constants.any? - end - - sig { params(request: String, params: T::Hash[Symbol, T.untyped]).void } - def send_message(request, params) - message = { method: request, params: params } - json = message.to_json + # TODO: confirm with kaan if we expect a response here? (i.e. should it be a notificatio or a request) - $stderr.puts "Tapioca LSP: Sending request '#{request}' with params #{params}" - @global_state.rails_runner_stdin.write("Content-Length: #{json.length}\r\n\r\n", json) + # TODO: `tapioca/dsl` instead? + $stderr.puts "Tapioca LSP: Sending request 'tapioca.dsl' with constants #{constants}" + @addon.client.send_notification("tapioca.dsl", constants: constants) if constants.any? end end end From 312aef1892db781b8616343147417847c872c93e Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:07:41 -0400 Subject: [PATCH 17/30] wip --- lib/ruby_lsp/tapioca/addon.rb | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index dd227354e..c3d6fdfaa 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -25,7 +25,7 @@ def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") @index = global_state.index @global_state = global_state - @addon = RubyLsp::Addon.get("Ruby LSP Rails") + @rails_addon = RubyLsp::Addon.get("Ruby LSP Rails") end sig { override.void } @@ -53,27 +53,20 @@ def dsl(params) sig { params(changes: T::Array[{ uri: String, type: Integer }]).void } def workspace_did_change_watched_files(changes) - # TODO: avoid direct access? - files_to_entries = @index.instance_variable_get("@files_to_entries") constants = changes.map do |change| path = change[:uri].gsub("file://", "") - entries = files_to_entries[path] - # entries = @index.entries_for(path, RubyIndexer::Entry::Namespace) + entries = @index.entries_for(path, RubyIndexer::Entry::Namespace) return unless entries # rubocop:disable Lint/NonLocalExitFromIterator - entries.select do |entry| - # TODO: RubyIndexer::Entry::Namespace - entry.class == RubyIndexer::Entry::Class || - entry.class == RubyIndexer::Entry::Module - end.map(&:name) + entries.map(&:name) end.flatten.compact # TODO: confirm with kaan if we expect a response here? (i.e. should it be a notificatio or a request) # TODO: `tapioca/dsl` instead? $stderr.puts "Tapioca LSP: Sending request 'tapioca.dsl' with constants #{constants}" - @addon.client.send_notification("tapioca.dsl", constants: constants) if constants.any? + @rails_addon.rails_runner_client.send_notification("tapioca.dsl", constants: constants) if constants.any? end end end From f723998f2b31fc78d073f27987a256528f0936db Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:23:41 -0400 Subject: [PATCH 18/30] entries_for no longer returns nil --- lib/ruby_lsp/tapioca/addon.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index c3d6fdfaa..479d6825e 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -57,7 +57,6 @@ def workspace_did_change_watched_files(changes) path = change[:uri].gsub("file://", "") entries = @index.entries_for(path, RubyIndexer::Entry::Namespace) - return unless entries # rubocop:disable Lint/NonLocalExitFromIterator entries.map(&:name) end.flatten.compact From 2eae75dfa86fb7a20774e2513b8ae34b151f573e Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:46:48 -0400 Subject: [PATCH 19/30] Use make_request instead of send_notification --- lib/ruby_lsp/tapioca/addon.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 479d6825e..88a8addca 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -61,11 +61,9 @@ def workspace_did_change_watched_files(changes) entries.map(&:name) end.flatten.compact - # TODO: confirm with kaan if we expect a response here? (i.e. should it be a notificatio or a request) - # TODO: `tapioca/dsl` instead? - $stderr.puts "Tapioca LSP: Sending request 'tapioca.dsl' with constants #{constants}" - @rails_addon.rails_runner_client.send_notification("tapioca.dsl", constants: constants) if constants.any? + $stderr.puts "Tapioca LSP: Making DSL request with constants #{constants}" + @rails_addon.rails_runner_client.make_request("tapioca.dsl", constants: constants) if constants.any? end end end From c7d91998637f3a9014c11877690a97ed7fb8a275 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 28 Aug 2024 13:45:11 -0400 Subject: [PATCH 20/30] Filter out SingletonClass --- lib/ruby_lsp/tapioca/addon.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 88a8addca..233491c02 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -56,7 +56,7 @@ def workspace_did_change_watched_files(changes) constants = changes.map do |change| path = change[:uri].gsub("file://", "") - entries = @index.entries_for(path, RubyIndexer::Entry::Namespace) + entries = @index.entries_for(path, RubyIndexer::Entry::Namespace).grep_v(RubyIndexer::Entry::SingletonClass) entries.map(&:name) end.flatten.compact From 904a21552364927cf901d95385e7778de8dd12d6 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:41:18 -0400 Subject: [PATCH 21/30] Output an error if the Rails LSP is not found --- lib/ruby_lsp/tapioca/addon.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 233491c02..46fff7f07 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -26,6 +26,8 @@ def activate(global_state, outgoing_queue) @index = global_state.index @global_state = global_state @rails_addon = RubyLsp::Addon.get("Ruby LSP Rails") + rescue AddonNotFoundError + $stderr.puts("Tapioca LSP: The LSP will not be available as the Ruby LSP Rails addon was not found") end sig { override.void } From 8e89ee288cc002f8c391704112644289cb7d5678 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:11:25 -0400 Subject: [PATCH 22/30] Point to local ruby-lsp --- Gemfile | 2 ++ Gemfile.lock | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Gemfile b/Gemfile index 0355afcd1..d230e8cce 100644 --- a/Gemfile +++ b/Gemfile @@ -59,3 +59,5 @@ group :test do end gem "kramdown", "~> 2.4" + +gem "ruby-lsp", path: "../ruby-lsp" diff --git a/Gemfile.lock b/Gemfile.lock index ca1fa2e21..9a52e7d0d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,6 +5,15 @@ GIT specs: cityhash (0.6.0) +PATH + remote: ../ruby-lsp + specs: + ruby-lsp (0.17.17) + language_server-protocol (~> 3.17.0) + prism (>= 0.29.0, < 0.31) + rbs (>= 3, < 4) + sorbet-runtime (>= 0.5.10782) + PATH remote: . specs: @@ -271,6 +280,8 @@ GEM rbi (0.1.14) prism (>= 0.18.0, < 1.0.0) sorbet-runtime (>= 0.5.9204) + rbs (3.5.3) + logger rdoc (6.7.0) psych (>= 4.0.0) redis (5.0.8) @@ -386,6 +397,7 @@ DEPENDENCIES rubocop-rspec rubocop-shopify rubocop-sorbet (>= 0.4.1) + ruby-lsp! shopify-money sidekiq smart_properties From f704de10395bcc39294be7f35493ba6e19f9ad0e Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:55:02 -0400 Subject: [PATCH 23/30] Inherit from RubyLsp::Rails::ServerAddon --- lib/ruby_lsp/tapioca/addon.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 46fff7f07..3984c52ad 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -11,9 +11,11 @@ # bug? saving file before rails boots causes crash +require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon + module RubyLsp module Tapioca - class Addon < ::RubyLsp::Addon + class Addon < ::RubyLsp::Rails::ServerAddon extend T::Sig def initialize @@ -25,11 +27,20 @@ def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") @index = global_state.index @global_state = global_state - @rails_addon = RubyLsp::Addon.get("Ruby LSP Rails") + # @rails_addon = RubyLsp::Addon.get("Ruby LSP Rails") + # @server.execute("register_server_addon", server_addon_path: File.expand_path("server_addon.rb")) + # @rails_addon.rails_runner_client.make_request("register_server_addon", server_addon_path: File.expand_path("addon.rb")) rescue AddonNotFoundError $stderr.puts("Tapioca LSP: The LSP will not be available as the Ruby LSP Rails addon was not found") end + def execute(request, params) + case request + when "tapioca.dsl" + dsl(params) + end + end + sig { override.void } def deactivate end @@ -65,7 +76,8 @@ def workspace_did_change_watched_files(changes) # TODO: `tapioca/dsl` instead? $stderr.puts "Tapioca LSP: Making DSL request with constants #{constants}" - @rails_addon.rails_runner_client.make_request("tapioca.dsl", constants: constants) if constants.any? + # @rails_addon.rails_runner_client.make_request("tapioca.dsl", constants: constants) if constants.any? + execute("tapioca.dsl", constants: constants) if constants.any? end end end From 496c21e2a33d6ccc4c3db7512a62c0f831e44371 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:06:11 -0400 Subject: [PATCH 24/30] wip (pair w. vini) --- .rubocop.yml | 2 + Gemfile | 1 + Gemfile.lock | 11 +- lib/ruby_lsp/tapioca/addon.rb | 52 +- lib/ruby_lsp/tapioca/server_addon.rb | 39 + sorbet/config | 1 + sorbet/rbi/gems/ruby-lsp-rails@0.3.14.rbi | 671 ++++++ ...by-lsp@0.17.4.rbi => ruby-lsp@0.17.18.rbi} | 2110 +++++++++++------ sorbet/tapioca/require.rb | 1 + 9 files changed, 2117 insertions(+), 771 deletions(-) create mode 100644 lib/ruby_lsp/tapioca/server_addon.rb create mode 100644 sorbet/rbi/gems/ruby-lsp-rails@0.3.14.rbi rename sorbet/rbi/gems/{ruby-lsp@0.17.4.rbi => ruby-lsp@0.17.18.rbi} (76%) diff --git a/.rubocop.yml b/.rubocop.yml index 833d564b9..c7afc3a72 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -45,6 +45,8 @@ Sorbet/TrueSigil: Include: - "**/*.rb" - "**/*.rake" + Exclude: + - "lib/ruby_lsp/tapioca/server_addon.rb" Style/CaseEquality: Enabled: false diff --git a/Gemfile b/Gemfile index d230e8cce..c773d6c0f 100644 --- a/Gemfile +++ b/Gemfile @@ -61,3 +61,4 @@ end gem "kramdown", "~> 2.4" gem "ruby-lsp", path: "../ruby-lsp" +gem "ruby-lsp-rails", path: "../ruby-lsp-rails" diff --git a/Gemfile.lock b/Gemfile.lock index f6cac4218..f31d7c4f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,12 +5,18 @@ GIT specs: cityhash (0.6.0) +PATH + remote: ../ruby-lsp-rails + specs: + ruby-lsp-rails (0.3.14) + ruby-lsp (>= 0.17.12, < 0.18.0) + PATH remote: ../ruby-lsp specs: - ruby-lsp (0.17.17) + ruby-lsp (0.17.18) language_server-protocol (~> 3.17.0) - prism (>= 0.29.0, < 0.31) + prism (~> 1.0) rbs (>= 3, < 4) sorbet-runtime (>= 0.5.10782) @@ -398,6 +404,7 @@ DEPENDENCIES rubocop-shopify rubocop-sorbet (>= 0.4.1) ruby-lsp! + ruby-lsp-rails! shopify-money sidekiq smart_properties diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 3984c52ad..14f84ab0b 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -1,6 +1,7 @@ # typed: true # frozen_string_literal: true +require "ruby_lsp/addon" begin require "ruby-lsp-rails" rescue LoadError @@ -11,36 +12,32 @@ # bug? saving file before rails boots causes crash -require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon +# require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon + +# TODO: Use async pattern in Rails addo module RubyLsp module Tapioca - class Addon < ::RubyLsp::Rails::ServerAddon + class Addon < ::RubyLsp::Addon extend T::Sig def initialize super @index = T.let(nil, T.nilable(RubyIndexer::Index)) + @rails_addon = T.let(nil, T.nilable(::RubyLsp::Rails::Addon)) end def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") @index = global_state.index @global_state = global_state - # @rails_addon = RubyLsp::Addon.get("Ruby LSP Rails") - # @server.execute("register_server_addon", server_addon_path: File.expand_path("server_addon.rb")) - # @rails_addon.rails_runner_client.make_request("register_server_addon", server_addon_path: File.expand_path("addon.rb")) + addon = T.cast(::RubyLsp::Addon.get("Ruby LSP Rails"), T.nilable(::RubyLsp::Rails::Addon)) + @rails_addon = addon + T.must(@rails_addon).rails_runner_client.register_server_addon(File.expand_path("server_addon.rb", __dir__)) rescue AddonNotFoundError $stderr.puts("Tapioca LSP: The LSP will not be available as the Ruby LSP Rails addon was not found") end - def execute(request, params) - case request - when "tapioca.dsl" - dsl(params) - end - end - sig { override.void } def deactivate end @@ -50,34 +47,27 @@ def name "Tapioca" end - def dsl(params) - command = ::Tapioca::Commands::DslGenerate.new( - requested_constants: params[:constants], - tapioca_path: ::Tapioca::TAPIOCA_DIR, - requested_paths: [], - outpath: Pathname.new(::Tapioca::DEFAULT_DSL_DIR), - file_header: true, - exclude: [], - only: [], - ) - - command.generate_without_booting - end - sig { params(changes: T::Array[{ uri: String, type: Integer }]).void } def workspace_did_change_watched_files(changes) - constants = changes.map do |change| + constants = changes.filter_map do |change| path = change[:uri].gsub("file://", "") - entries = @index.entries_for(path, RubyIndexer::Entry::Namespace).grep_v(RubyIndexer::Entry::SingletonClass) + entries = T.must(@index).entries_for(path, RubyIndexer::Entry::Namespace) + next unless entries - entries.map(&:name) - end.flatten.compact + entries.grep_v(RubyIndexer::Entry::SingletonClass).map(&:name) + end.flatten # TODO: `tapioca/dsl` instead? $stderr.puts "Tapioca LSP: Making DSL request with constants #{constants}" # @rails_addon.rails_runner_client.make_request("tapioca.dsl", constants: constants) if constants.any? - execute("tapioca.dsl", constants: constants) if constants.any? + # execute("tapioca.dsl", constants: constants) if constants.any? + client = T.must(@rails_addon).rails_runner_client + client.send_notification( + "server_addon/delegate", + server_addon_name: "Tapioca", + constants: constants, + ) if constants.any? end end end diff --git a/lib/ruby_lsp/tapioca/server_addon.rb b/lib/ruby_lsp/tapioca/server_addon.rb new file mode 100644 index 000000000..1bf53eb70 --- /dev/null +++ b/lib/ruby_lsp/tapioca/server_addon.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require "tapioca/internal" +# require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon + +module RubyLsp + module Tapioca + class ServerAddon < ::RubyLsp::Rails::ServerAddon + def name + "Tapioca" + end + + def execute(request, params) + $stderr.puts("Tapioca DSL execute") + case request + when "tapioca.dsl" # TODO: remove tapioca. prefix + dsl(params) + end + end + + private + + def dsl(params) + $stderr.puts("dsl...") + command = ::Tapioca::Commands::DslGenerate.new( + requested_constants: params[:constants], + tapioca_path: ::Tapioca::TAPIOCA_DIR, + requested_paths: [], + outpath: Pathname.new(::Tapioca::DEFAULT_DSL_DIR), + file_header: true, + exclude: [], + only: [], + ) + + command.generate_without_booting + end + end + end +end diff --git a/sorbet/config b/sorbet/config index c54e716d8..aa38b45d5 100644 --- a/sorbet/config +++ b/sorbet/config @@ -1,5 +1,6 @@ --dir . --ignore=/vendor +--ignore=lib/ruby_lsp/tapioca/server_addon.rb --enable-experimental-requires-ancestor --suppress-payload-superclass-redefinition-for=Reline::ANSI diff --git a/sorbet/rbi/gems/ruby-lsp-rails@0.3.14.rbi b/sorbet/rbi/gems/ruby-lsp-rails@0.3.14.rbi new file mode 100644 index 000000000..d22239ff0 --- /dev/null +++ b/sorbet/rbi/gems/ruby-lsp-rails@0.3.14.rbi @@ -0,0 +1,671 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `ruby-lsp-rails` gem. +# Please instead update this file by running `bin/tapioca gem ruby-lsp-rails`. + + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/active_support_test_case_helper.rb#4 +module RubyLsp; end + +# # Supported features +# +# - [Hover](rdoc-ref:RubyLsp::Rails::Hover) +# - [CodeLens](rdoc-ref:RubyLsp::Rails::CodeLens) +# - [DocumentSymbol](rdoc-ref:RubyLsp::Rails::DocumentSymbol) +# - [Definition](rdoc-ref:RubyLsp::Rails::Definition) +# +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/active_support_test_case_helper.rb#5 +module RubyLsp::Rails; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/active_support_test_case_helper.rb#6 +module RubyLsp::Rails::ActiveSupportTestCaseHelper + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/active_support_test_case_helper.rb#10 + sig { params(node: ::Prism::CallNode).returns(T.nilable(::String)) } + def extract_test_case_name(node); end +end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#20 +class RubyLsp::Rails::Addon < ::RubyLsp::Addon + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#24 + sig { void } + def initialize; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#47 + sig { override.params(global_state: ::RubyLsp::GlobalState, message_queue: ::Thread::Queue).void } + def activate(global_state, message_queue); end + + # Creates a new CodeLens listener. This method is invoked on every CodeLens request + # + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#75 + sig do + override + .params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CodeLens], + uri: ::URI::Generic, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_code_lens_listener(response_builder, uri, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#110 + sig do + override + .params( + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[T.any(::LanguageServer::Protocol::Interface::Location, ::LanguageServer::Protocol::Interface::LocationLink)], + uri: ::URI::Generic, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_definition_listener(response_builder, uri, node_context, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#96 + sig do + override + .params( + response_builder: RubyLsp::ResponseBuilders::DocumentSymbol, + dispatcher: ::Prism::Dispatcher + ).returns(::Object) + end + def create_document_symbol_listener(response_builder, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#86 + sig do + override + .params( + response_builder: RubyLsp::ResponseBuilders::Hover, + node_context: ::RubyLsp::NodeContext, + dispatcher: ::Prism::Dispatcher + ).void + end + def create_hover_listener(response_builder, node_context, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#63 + sig { override.void } + def deactivate; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#151 + sig { override.returns(::String) } + def name; end + + # attr_reader :rails_runner_client + # + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#38 + sig { returns(::RubyLsp::Rails::RunnerClient) } + def rails_runner_client; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#125 + sig { params(global_state: ::RubyLsp::GlobalState, message_queue: ::Thread::Queue).void } + def register_additional_file_watchers(global_state:, message_queue:); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/addon.rb#116 + sig { params(changes: T::Array[{uri: ::String, type: ::Integer}]).void } + def workspace_did_change_watched_files(changes); end +end + +# ![CodeLens demo](../../code_lens.gif) +# +# This feature adds Code Lens features for Rails applications. +# +# For Active Support test cases: +# +# - Run tests in the VS Terminal +# - Run tests in the VS Code Test Explorer +# - Debug tests +# - Run migrations in the VS Terminal +# +# For Rails controllers: +# +# - See the path corresponding to an action +# - Click on the action's Code Lens to jump to its declaration in the routes. +# +# Note: This depends on a support for the `rubyLsp.openFile` command. +# For the VS Code extension this is built-in, but for other editors this may require some custom configuration. +# +# The +# [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens) +# request informs the editor of runnable commands such as tests. +# It's available for tests which inherit from `ActiveSupport::TestCase` or one of its descendants, such as +# `ActionDispatch::IntegrationTest`. +# +# # Example: +# +# For the following code, Code Lenses will be added above the class definition above each test method. +# +# ```ruby +# Run +# class HelloTest < ActiveSupport::TestCase # <- Will show code lenses above for running or debugging the whole test +# test "outputs hello" do # <- Will show code lenses above for running or debugging this test +# # ... +# end +# +# test "outputs goodbye" do # <- Will show code lenses above for running or debugging this test +# # ... +# end +# end +# ``` +# +# # Example: +# ```ruby +# Run +# class AddFirstNameToUsers < ActiveRecord::Migration[7.1] +# # ... +# end +# ``` +# +# The code lenses will be displayed above the class and above each test method. +# +# Note: When using the Test Explorer view, if your code contains a statement to pause execution (e.g. `debugger`) it +# will cause the test runner to hang. +# +# For the following code, assuming the routing contains `resources :users`, a Code Lens will be seen above each +# action. +# +# ```ruby +# class UsersController < ApplicationController +# GET /users(.:format) +# def index # <- Will show code lens above for the path +# end +# end +# ``` +# +# Note: Complex routing configurations may not be supported. +# +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#74 +class RubyLsp::Rails::CodeLens + include ::RubyLsp::Requests::Support::Common + include ::RubyLsp::Rails::ActiveSupportTestCaseHelper + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#88 + sig do + params( + client: ::RubyLsp::Rails::RunnerClient, + global_state: ::RubyLsp::GlobalState, + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CodeLens], + uri: ::URI::Generic, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(client, global_state, response_builder, uri, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#109 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#137 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#161 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_leave(node); end + + # Although uncommon, Rails tests can be written with the classic "def test_name" syntax. + # + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#121 + sig { params(node: ::Prism::DefNode).void } + def on_def_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#172 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#177 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_leave(node); end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#192 + sig { params(node: ::Prism::DefNode).void } + def add_jump_to_view(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#248 + sig { params(node: ::Prism::Node, name: ::String, command: ::String).void } + def add_migrate_code_lens(node, name:, command:); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#216 + sig { params(node: ::Prism::DefNode).void } + def add_route_code_lens_to_action(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#261 + sig { params(node: ::Prism::Node, name: ::String, command: ::String, kind: ::Symbol).void } + def add_test_code_lens(node, name:, command:, kind:); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#184 + sig { returns(T.nilable(T::Boolean)) } + def controller?; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#238 + sig { returns(::String) } + def migrate_command; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#243 + sig { returns(T.nilable(::String)) } + def migration_version; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/code_lens.rb#233 + sig { returns(::String) } + def test_command; end +end + +# ![Definition demo](../../definition.gif) +# +# The [definition +# request](https://microsoft.github.io/language-server-protocol/specification#textDocument_definition) jumps to the +# definition of the symbol under the cursor. +# +# Currently supported targets: +# +# - Callbacks +# - Named routes (e.g. `users_path`) +# +# # Example +# +# ```ruby +# before_action :foo # <- Go to definition on this symbol will jump to the method +# ``` +# +# Notes for named routes: +# +# - It is available only in Rails 7.1 or newer. +# - Route may be defined across multiple files, e.g. using `draw`, rather than in `routes.rb`. +# - Routes won't be found if not defined for the Rails development environment. +# - If using `constraints`, the route can only be found if the constraints are met. +# - Changes to routes won't be picked up until the server is restarted. +# +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#30 +class RubyLsp::Rails::Definition + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#45 + sig do + params( + client: ::RubyLsp::Rails::RunnerClient, + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[T.any(::LanguageServer::Protocol::Interface::Location, ::LanguageServer::Protocol::Interface::LocationLink)], + node_context: ::RubyLsp::NodeContext, + index: ::RubyIndexer::Index, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(client, response_builder, node_context, index, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#66 + sig { params(node: T.any(::Prism::StringNode, ::Prism::SymbolNode)).void } + def handle_possible_dsl(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#83 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#61 + sig { params(node: ::Prism::StringNode).void } + def on_string_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#56 + sig { params(node: ::Prism::SymbolNode).void } + def on_symbol_node_enter(node); end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#142 + sig { params(name: ::String).void } + def collect_definitions(name); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#117 + sig { params(node: ::Prism::CallNode).void } + def handle_association(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#98 + sig { params(node: ::Prism::CallNode).void } + def handle_callback(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/definition.rb#134 + sig { params(node: ::Prism::CallNode).void } + def handle_route(node); end +end + +# ![Document Symbol demo](../../document_symbol.gif) +# +# The [document symbol](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol) +# request allows users to navigate between associations, validations, callbacks and ActiveSupport test cases with +# VS Code's "Go to Symbol" feature. +# +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#11 +class RubyLsp::Rails::DocumentSymbol + include ::RubyLsp::Requests::Support::Common + include ::RubyLsp::Rails::ActiveSupportTestCaseHelper + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#22 + sig { params(response_builder: RubyLsp::ResponseBuilders::DocumentSymbol, dispatcher: ::Prism::Dispatcher).void } + def initialize(response_builder, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#37 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#66 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#71 + sig { params(node: ::Prism::ClassNode).void } + def on_class_node_leave(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#76 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#81 + sig { params(node: ::Prism::ModuleNode).void } + def on_module_node_leave(node); end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#88 + sig { params(node: T.any(::Prism::ClassNode, ::Prism::ModuleNode)).void } + def add_to_namespace_stack(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#223 + sig do + params( + name: ::String, + range: ::LanguageServer::Protocol::Interface::Range, + selection_range: ::LanguageServer::Protocol::Interface::Range + ).void + end + def append_document_symbol(name:, range:, selection_range:); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#98 + sig { params(node: ::Prism::CallNode, message: ::String).void } + def handle_all_arg_types(node, message); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#197 + sig { params(node: ::Prism::CallNode, message: ::String).void } + def handle_class_arg_types(node, message); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#168 + sig { params(node: ::Prism::CallNode, message: ::String).void } + def handle_symbol_and_string_arg_types(node, message); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb#93 + sig { params(node: T.any(::Prism::ClassNode, ::Prism::ModuleNode)).void } + def remove_from_namespace_stack(node); end +end + +# ![Hover demo](../../hover.gif) +# +# Augment [hover](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover) with +# information about a model. +# +# # Example +# +# ```ruby +# User.all +# # ^ hovering here will show information about the User model +# ``` +# +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#19 +class RubyLsp::Rails::Hover + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#32 + sig do + params( + client: ::RubyLsp::Rails::RunnerClient, + response_builder: RubyLsp::ResponseBuilders::Hover, + node_context: ::RubyLsp::NodeContext, + global_state: ::RubyLsp::GlobalState, + dispatcher: ::Prism::Dispatcher + ).void + end + def initialize(client, response_builder, node_context, global_state, dispatcher); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#61 + sig { params(node: ::Prism::CallNode).void } + def on_call_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#41 + sig { params(node: ::Prism::ConstantPathNode).void } + def on_constant_path_node_enter(node); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#53 + sig { params(node: ::Prism::ConstantReadNode).void } + def on_constant_read_node_enter(node); end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#73 + sig { params(name: ::String).void } + def generate_column_content(name); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/hover.rb#94 + sig { params(name: ::String, location: ::Prism::Location).void } + def generate_rails_document_link_hover(name, location); end +end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb#6 +class RubyLsp::Rails::IndexingEnhancement + include ::RubyIndexer::Enhancement + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb#18 + sig do + override + .params( + index: ::RubyIndexer::Index, + owner: T.nilable(::RubyIndexer::Entry::Namespace), + node: ::Prism::CallNode, + file_path: ::String + ).void + end + def on_call_node(index, owner, node, file_path); end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb#41 + sig do + params( + index: ::RubyIndexer::Index, + owner: ::RubyIndexer::Entry::Namespace, + node: ::Prism::CallNode, + file_path: ::String + ).void + end + def handle_association(index, owner, node, file_path); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb#88 + sig { params(index: ::RubyIndexer::Index, owner: ::RubyIndexer::Entry::Namespace, node: ::Prism::CallNode).void } + def handle_concern_extend(index, owner, node); end +end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#234 +class RubyLsp::Rails::NullClient < ::RubyLsp::Rails::RunnerClient + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#238 + sig { void } + def initialize; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#252 + sig { override.returns(::String) } + def rails_root; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#242 + sig { override.void } + def shutdown; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#247 + sig { override.returns(T::Boolean) } + def stopped?; end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#264 + sig { override.returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def read_response; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#259 + sig { override.params(request: ::String, params: T.nilable(T::Hash[::Symbol, T.untyped])).void } + def send_message(request, params = T.unsafe(nil)); end +end + +class RubyLsp::Rails::Railtie < ::Rails::Railtie; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#9 +class RubyLsp::Rails::RunnerClient + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#43 + sig { void } + def initialize; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#121 + sig { params(model_name: ::String, association_name: ::String).returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def association_target_location(model_name:, association_name:); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#178 + sig do + params( + request: ::String, + params: T.nilable(T::Hash[::Symbol, T.untyped]) + ).returns(T.nilable(T::Hash[::Symbol, T.untyped])) + end + def make_request(request, params = T.unsafe(nil)); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#108 + sig { params(name: ::String).returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def model(name); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#40 + sig { returns(::String) } + def rails_root; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#100 + sig { params(server_addon_path: ::String).void } + def register_server_addon(server_addon_path); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#140 + sig { params(controller: ::String, action: ::String).returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def route(controller:, action:); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#132 + sig { params(name: ::String).returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def route_location(name); end + + # Notifications are like messages, but one-way, with no response sent back. + # + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#185 + sig { params(request: ::String, params: T.nilable(T::Hash[::Symbol, T.untyped])).void } + def send_notification(request, params = T.unsafe(nil)); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#157 + sig { void } + def shutdown; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#168 + sig { returns(T::Boolean) } + def stopped?; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#148 + sig { void } + def trigger_reload; end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#228 + sig { void } + def force_kill; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#203 + sig { overridable.returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def read_response; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#190 + sig { overridable.params(request: ::String, params: T.nilable(T::Hash[::Symbol, T.untyped])).void } + def send_message(request, params = T.unsafe(nil)); end + + class << self + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#14 + sig { returns(::RubyLsp::Rails::RunnerClient) } + def create_client; end + end +end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#33 +class RubyLsp::Rails::RunnerClient::EmptyMessageError < ::StandardError; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#32 +class RubyLsp::Rails::RunnerClient::IncompleteMessageError < ::StandardError; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#31 +class RubyLsp::Rails::RunnerClient::InitializationError < ::StandardError; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/runner_client.rb#35 +RubyLsp::Rails::RunnerClient::MAX_RETRIES = T.let(T.unsafe(nil), Integer) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/associations.rb#6 +module RubyLsp::Rails::Support; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/associations.rb#7 +module RubyLsp::Rails::Support::Associations; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/associations.rb#8 +RubyLsp::Rails::Support::Associations::ALL = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/callbacks.rb#7 +module RubyLsp::Rails::Support::Callbacks; end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/callbacks.rb#67 +RubyLsp::Rails::Support::Callbacks::ALL = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/callbacks.rb#37 +RubyLsp::Rails::Support::Callbacks::CONTROLLERS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/callbacks.rb#55 +RubyLsp::Rails::Support::Callbacks::JOBS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/callbacks.rb#8 +RubyLsp::Rails::Support::Callbacks::MODELS = T.let(T.unsafe(nil), Array) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb#7 +class RubyLsp::Rails::Support::LocationBuilder + class << self + # @raise [ArgumentError] + # + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb#12 + sig { params(location_string: ::String).returns(::LanguageServer::Protocol::Interface::Location) } + def line_location_from_s(location_string); end + end +end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#9 +class RubyLsp::Rails::Support::RailsDocumentClient + class << self + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#37 + sig { params(name: ::String).returns(T::Array[::String]) } + def generate_rails_document_urls(name); end + + private + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#66 + sig { returns(T.nilable(T::Hash[::String, T::Array[T::Hash[::Symbol, ::String]]])) } + def build_search_index; end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#99 + sig { params(js: ::String).returns(T::Hash[::String, T::Array[T::Hash[::Symbol, ::String]]]) } + def process_search_index(js); end + + # source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#58 + sig { returns(T.nilable(T::Hash[::String, T::Array[T::Hash[::Symbol, ::String]]])) } + def search_index; end + end +end + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#10 +RubyLsp::Rails::Support::RailsDocumentClient::RAILS_DOC_HOST = T.let(T.unsafe(nil), String) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#26 +RubyLsp::Rails::Support::RailsDocumentClient::RAILTIES_VERSION = T.let(T.unsafe(nil), String) + +# source://ruby-lsp-rails/lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb#12 +RubyLsp::Rails::Support::RailsDocumentClient::SUPPORTED_RAILS_DOC_NAMESPACES = T.let(T.unsafe(nil), Regexp) + +# source://ruby-lsp-rails/lib/ruby_lsp_rails/version.rb#6 +RubyLsp::Rails::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/ruby-lsp@0.17.4.rbi b/sorbet/rbi/gems/ruby-lsp@0.17.18.rbi similarity index 76% rename from sorbet/rbi/gems/ruby-lsp@0.17.4.rbi rename to sorbet/rbi/gems/ruby-lsp@0.17.18.rbi index af6e754d6..cb997ab04 100644 --- a/sorbet/rbi/gems/ruby-lsp@0.17.4.rbi +++ b/sorbet/rbi/gems/ruby-lsp@0.17.18.rbi @@ -6,41 +6,39 @@ # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#4 -module RubyIndexer - class << self - # source://ruby-lsp/lib/ruby_indexer/ruby_indexer.rb#23 - sig { returns(::RubyIndexer::Configuration) } - def configuration; end - end -end +module RubyIndexer; end # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#5 class RubyIndexer::Configuration - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#20 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#23 sig { void } def initialize; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#149 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#168 sig { params(config: T::Hash[::String, T.untyped]).void } def apply_config(config); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#47 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#56 sig { returns(T::Array[::RubyIndexer::IndexablePath]) } def indexables; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#144 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#163 sig { returns(::Regexp) } def magic_comment_regex; end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#20 + sig { params(workspace_path: ::String).void } + def workspace_path=(workspace_path); end + private - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#177 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#196 sig { returns(T::Array[::String]) } def initial_excluded_gems; end # @raise [ArgumentError] # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#162 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#181 sig { params(config: T::Hash[::String, T.untyped]).void } def validate_config!(config); end end @@ -50,120 +48,129 @@ RubyIndexer::Configuration::CONFIGURATION_SCHEMA = T.let(T.unsafe(nil), Hash) # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#5 class RubyIndexer::DeclarationListener - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#14 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#23 sig do params( index: ::RubyIndexer::Index, dispatcher: ::Prism::Dispatcher, parse_result: ::Prism::ParseResult, - file_path: ::String + file_path: ::String, + enhancements: T::Array[::RubyIndexer::Enhancement] ).void end - def initialize(index, dispatcher, parse_result, file_path); end + def initialize(index, dispatcher, parse_result, file_path, enhancements: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#361 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#12 + sig { returns(T::Array[::String]) } + def indexing_errors; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#393 sig { params(node: ::Prism::AliasMethodNode).void } def on_alias_method_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#250 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#272 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#276 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#304 sig { params(node: ::Prism::CallNode).void } def on_call_node_leave(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#65 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#76 sig { params(node: ::Prism::ClassNode).void } def on_class_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#106 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#119 sig { params(node: ::Prism::ClassNode).void } def on_class_node_leave(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#238 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#260 sig { params(node: ::Prism::ConstantAndWriteNode).void } def on_constant_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#244 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#266 sig { params(node: ::Prism::ConstantOperatorWriteNode).void } def on_constant_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#232 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#254 sig { params(node: ::Prism::ConstantOrWriteNode).void } def on_constant_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#216 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#238 sig { params(node: ::Prism::ConstantPathAndWriteNode).void } def on_constant_path_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#206 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#228 sig { params(node: ::Prism::ConstantPathOperatorWriteNode).void } def on_constant_path_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#196 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#218 sig { params(node: ::Prism::ConstantPathOrWriteNode).void } def on_constant_path_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#186 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#208 sig { params(node: ::Prism::ConstantPathWriteNode).void } def on_constant_path_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#226 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#248 sig { params(node: ::Prism::ConstantWriteNode).void } def on_constant_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#289 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#317 sig { params(node: ::Prism::DefNode).void } def on_def_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#326 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#358 sig { params(node: ::Prism::DefNode).void } def on_def_node_leave(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#341 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#373 sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } def on_instance_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#346 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#378 sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } def on_instance_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#351 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#383 sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } def on_instance_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#356 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#388 sig { params(node: ::Prism::InstanceVariableTargetNode).void } def on_instance_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#336 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#368 sig { params(node: ::Prism::InstanceVariableWriteNode).void } def on_instance_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#113 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#126 sig { params(node: ::Prism::ModuleNode).void } def on_module_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#128 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#141 sig { params(node: ::Prism::ModuleNode).void } def on_module_node_leave(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#166 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#188 sig { params(node: ::Prism::MultiWriteNode).void } def on_multi_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#135 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#148 sig { params(node: ::Prism::SingletonClassNode).void } def on_singleton_class_node_enter(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#159 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#181 sig { params(node: ::Prism::SingletonClassNode).void } def on_singleton_class_node_leave(node); end private - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#482 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#735 + sig { params(name: ::String).returns(T::Array[::String]) } + def actual_nesting(name); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#519 sig do params( node: T.any(::Prism::ConstantAndWriteNode, ::Prism::ConstantOperatorWriteNode, ::Prism::ConstantOrWriteNode, ::Prism::ConstantPathAndWriteNode, ::Prism::ConstantPathOperatorWriteNode, ::Prism::ConstantPathOrWriteNode, ::Prism::ConstantPathTargetNode, ::Prism::ConstantPathWriteNode, ::Prism::ConstantTargetNode, ::Prism::ConstantWriteNode), @@ -173,27 +180,27 @@ class RubyIndexer::DeclarationListener end def add_constant(node, name, value = T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#507 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#544 sig { params(node: ::Prism::Node).returns(T::Array[::String]) } def collect_comments(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#605 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#643 sig { returns(::RubyIndexer::Entry::Visibility) } def current_visibility; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#533 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#570 sig { params(name: ::String).returns(::String) } def fully_qualify_name(name); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#426 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#463 sig { params(node: ::Prism::CallNode).void } def handle_alias_method(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#542 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#579 sig { params(node: ::Prism::CallNode, reader: T::Boolean, writer: T::Boolean).void } def handle_attribute(node, reader:, writer:); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#390 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#422 sig do params( node: T.any(::Prism::InstanceVariableAndWriteNode, ::Prism::InstanceVariableOperatorWriteNode, ::Prism::InstanceVariableOrWriteNode, ::Prism::InstanceVariableTargetNode, ::Prism::InstanceVariableWriteNode), @@ -202,15 +209,15 @@ class RubyIndexer::DeclarationListener end def handle_instance_variable(node, loc); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#578 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#615 sig { params(node: ::Prism::CallNode, operation: ::Symbol).void } def handle_module_operation(node, operation); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#401 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#438 sig { params(node: ::Prism::CallNode).void } def handle_private_constant(node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#610 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#648 sig do params( parameters_node: T.nilable(::Prism::ParametersNode) @@ -218,13 +225,9 @@ class RubyIndexer::DeclarationListener end def list_params(parameters_node); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#669 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#710 sig { params(node: T.nilable(::Prism::Node)).returns(T.nilable(::Symbol)) } def parameter_name(node); end - - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#694 - sig { returns(T.nilable(::RubyIndexer::Entry::Class)) } - def singleton_klass; end end # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#9 @@ -233,9 +236,36 @@ RubyIndexer::DeclarationListener::BASIC_OBJECT_NESTING = T.let(T.unsafe(nil), Ar # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb#8 RubyIndexer::DeclarationListener::OBJECT_NESTING = T.let(T.unsafe(nil), Array) +# @abstract Subclasses must implement the `abstract` methods below. +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb#5 +module RubyIndexer::Enhancement + requires_ancestor { Object } + + interface! + + # The `on_extend` indexing enhancement is invoked whenever an extend is encountered in the code. It can be used to + # register for an included callback, similar to what `ActiveSupport::Concern` does in order to auto-extend the + # `ClassMethods` modules + # + # @abstract + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb#24 + sig do + abstract + .params( + index: ::RubyIndexer::Index, + owner: T.nilable(::RubyIndexer::Entry::Namespace), + node: ::Prism::CallNode, + file_path: ::String + ).void + end + def on_call_node(index, owner, node, file_path); end +end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#5 class RubyIndexer::Entry - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#39 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#41 sig do params( name: ::String, @@ -246,11 +276,11 @@ class RubyIndexer::Entry end def initialize(name, file_path, location, comments); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#26 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#28 sig { returns(T::Array[::String]) } def comments; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#66 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#78 sig { returns(::String) } def file_name; end @@ -266,92 +296,118 @@ class RubyIndexer::Entry sig { returns(::String) } def name; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#61 + # @return [RubyIndexer::Location] + # + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 + def name_location(*args, **_arg1, &blk); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#73 sig { returns(T::Boolean) } def private?; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#29 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#68 + sig { returns(T::Boolean) } + def protected?; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#63 + sig { returns(T::Boolean) } + def public?; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#31 sig { returns(::RubyIndexer::Entry::Visibility) } def visibility; end # @return [Visibility] # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#29 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#31 def visibility=(_arg0); end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#295 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#366 class RubyIndexer::Entry::Accessor < ::RubyIndexer::Entry::Member - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#299 - sig { override.returns(T::Array[::RubyIndexer::Entry::Parameter]) } - def parameters; end -end - -# Alias represents a resolved alias, which points to an existing constant target -# -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#367 -class RubyIndexer::Entry::Alias < ::RubyIndexer::Entry - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#374 - sig { params(target: ::String, unresolved_alias: ::RubyIndexer::Entry::UnresolvedAlias).void } - def initialize(target, unresolved_alias); end - - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#371 - sig { returns(::String) } - def target; end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#370 + sig { override.returns(T::Array[::RubyIndexer::Entry::Signature]) } + def signatures; end end # A block method parameter, e.g. `def foo(&block)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#251 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#288 class RubyIndexer::Entry::BlockParameter < ::RubyIndexer::Entry::Parameter - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#255 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#300 sig { override.returns(::Symbol) } def decorated_name; end + + class << self + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#294 + sig { returns(::RubyIndexer::Entry::BlockParameter) } + def anonymous; end + end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#252 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#289 RubyIndexer::Entry::BlockParameter::DEFAULT_NAME = T.let(T.unsafe(nil), Symbol) -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#136 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#166 class RubyIndexer::Entry::Class < ::RubyIndexer::Entry::Namespace - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#153 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#184 sig do params( nesting: T::Array[::String], file_path: ::String, location: T.any(::Prism::Location, ::RubyIndexer::Location), + name_location: T.any(::Prism::Location, ::RubyIndexer::Location), comments: T::Array[::String], parent_class: T.nilable(::String) ).void end - def initialize(nesting, file_path, location, comments, parent_class); end + def initialize(nesting, file_path, location, name_location, comments, parent_class); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#159 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#190 sig { override.returns(::Integer) } def ancestor_hash; end # The unresolved name of the parent class. This may return `nil`, which indicates the lack of an explicit parent # and therefore ::Object is the correct parent class # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#142 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#172 sig { returns(T.nilable(::String)) } def parent_class; end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#180 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#217 class RubyIndexer::Entry::Constant < ::RubyIndexer::Entry; end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#87 -class RubyIndexer::Entry::Extend < ::RubyIndexer::Entry::ModuleOperation; end +# Alias represents a resolved alias, which points to an existing constant target +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#461 +class RubyIndexer::Entry::ConstantAlias < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#468 + sig { params(target: ::String, unresolved_alias: ::RubyIndexer::Entry::UnresolvedConstantAlias).void } + def initialize(target, unresolved_alias); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#465 + sig { returns(::String) } + def target; end +end + +# A forwarding method parameter, e.g. `def foo(...)` +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#306 +class RubyIndexer::Entry::ForwardingParameter < ::RubyIndexer::Entry::Parameter + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#310 + sig { void } + def initialize; end +end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#85 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#97 class RubyIndexer::Entry::Include < ::RubyIndexer::Entry::ModuleOperation; end # Represents an instance variable e.g.: @a = 1 # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#383 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#477 class RubyIndexer::Entry::InstanceVariable < ::RubyIndexer::Entry - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#396 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#490 sig do params( name: ::String, @@ -363,39 +419,39 @@ class RubyIndexer::Entry::InstanceVariable < ::RubyIndexer::Entry end def initialize(name, file_path, location, comments, owner); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#385 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#479 sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } def owner; end end # An required keyword method parameter, e.g. `def foo(a:)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#215 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#252 class RubyIndexer::Entry::KeywordParameter < ::RubyIndexer::Entry::Parameter - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#217 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#254 sig { override.returns(::Symbol) } def decorated_name; end end # A keyword rest method parameter, e.g. `def foo(**a)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#241 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#278 class RubyIndexer::Entry::KeywordRestParameter < ::RubyIndexer::Entry::Parameter - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#245 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#282 sig { override.returns(::Symbol) } def decorated_name; end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#242 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#279 RubyIndexer::Entry::KeywordRestParameter::DEFAULT_NAME = T.let(T.unsafe(nil), Symbol) # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#260 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#316 class RubyIndexer::Entry::Member < ::RubyIndexer::Entry abstract! - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#279 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#335 sig do params( name: ::String, @@ -408,49 +464,58 @@ class RubyIndexer::Entry::Member < ::RubyIndexer::Entry end def initialize(name, file_path, location, comments, visibility, owner); end - # Returns a string with the decorated names of the parameters of this member. E.g.: `(a, b = 1, c: 2)` - # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#290 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#345 sig { returns(::String) } def decorated_parameters; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#267 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#353 + sig { returns(::String) } + def formatted_signatures; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#323 sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } def owner; end # @abstract # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#286 - sig { abstract.returns(T::Array[::RubyIndexer::Entry::Parameter]) } - def parameters; end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#342 + sig { abstract.returns(T::Array[::RubyIndexer::Entry::Signature]) } + def signatures; end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#306 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#382 class RubyIndexer::Entry::Method < ::RubyIndexer::Entry::Member - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#323 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#404 sig do params( name: ::String, file_path: ::String, location: T.any(::Prism::Location, ::RubyIndexer::Location), + name_location: T.any(::Prism::Location, ::RubyIndexer::Location), comments: T::Array[::String], - parameters: T::Array[::RubyIndexer::Entry::Parameter], + signatures: T::Array[::RubyIndexer::Entry::Signature], visibility: ::RubyIndexer::Entry::Visibility, owner: T.nilable(::RubyIndexer::Entry::Namespace) ).void end - def initialize(name, file_path, location, comments, parameters, visibility, owner); end + def initialize(name, file_path, location, name_location, comments, signatures, visibility, owner); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#310 - sig { override.returns(T::Array[::RubyIndexer::Entry::Parameter]) } - def parameters; end + # Returns the location of the method name, excluding parameters or the body + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#390 + sig { returns(::RubyIndexer::Location) } + def name_location; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#386 + sig { override.returns(T::Array[::RubyIndexer::Entry::Signature]) } + def signatures; end end # A method alias is a resolved alias entry that points to the exact method target it refers to # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#434 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#528 class RubyIndexer::Entry::MethodAlias < ::RubyIndexer::Entry - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#441 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#538 sig do params( target: T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias), @@ -459,63 +524,68 @@ class RubyIndexer::Entry::MethodAlias < ::RubyIndexer::Entry end def initialize(target, unresolved_alias); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#468 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#556 sig { returns(::String) } def decorated_parameters; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#458 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#561 + sig { returns(::String) } + def formatted_signatures; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#535 sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } def owner; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#463 - sig { returns(T::Array[::RubyIndexer::Entry::Parameter]) } - def parameters; end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#566 + sig { returns(T::Array[::RubyIndexer::Entry::Signature]) } + def signatures; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#438 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#532 sig { returns(T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias)) } def target; end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#133 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#163 class RubyIndexer::Entry::Module < ::RubyIndexer::Entry::Namespace; end # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#70 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#82 class RubyIndexer::Entry::ModuleOperation abstract! - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#80 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#92 sig { params(module_name: ::String).void } def initialize(module_name); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#77 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#89 sig { returns(::String) } def module_name; end end # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#89 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#100 class RubyIndexer::Entry::Namespace < ::RubyIndexer::Entry abstract! - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#106 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#122 sig do params( nesting: T::Array[::String], file_path: ::String, location: T.any(::Prism::Location, ::RubyIndexer::Location), + name_location: T.any(::Prism::Location, ::RubyIndexer::Location), comments: T::Array[::String] ).void end - def initialize(nesting, file_path, location, comments); end + def initialize(nesting, file_path, location, name_location, comments); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#128 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#158 sig { returns(::Integer) } def ancestor_hash; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#115 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#145 sig { returns(T::Array[::String]) } def mixin_operation_module_names; end @@ -523,40 +593,46 @@ class RubyIndexer::Entry::Namespace < ::RubyIndexer::Entry # code. Maintaining the order is essential to linearize ancestors the right way when a module is both included # and prepended # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#123 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#153 sig { returns(T::Array[::RubyIndexer::Entry::ModuleOperation]) } def mixin_operations; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#96 + # Returns the location of the constant name, excluding the parent class or the body + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#111 + sig { returns(::RubyIndexer::Location) } + def name_location; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#107 sig { returns(T::Array[::String]) } def nesting; end end # An optional keyword method parameter, e.g. `def foo(a: 123)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#223 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#260 class RubyIndexer::Entry::OptionalKeywordParameter < ::RubyIndexer::Entry::Parameter - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#225 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#262 sig { override.returns(::Symbol) } def decorated_name; end end # An optional method parameter, e.g. `def foo(a = 123)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#207 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#244 class RubyIndexer::Entry::OptionalParameter < ::RubyIndexer::Entry::Parameter - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#209 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#246 sig { override.returns(::Symbol) } def decorated_name; end end # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#183 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#220 class RubyIndexer::Entry::Parameter abstract! - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#197 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#234 sig { params(name: ::Symbol).void } def initialize(name:); end @@ -565,41 +641,98 @@ class RubyIndexer::Entry::Parameter # # @return [Symbol] # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 def decorated_name(*args, **_arg1, &blk); end # Name includes just the name of the parameter, excluding symbols like splats # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#191 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#228 sig { returns(::Symbol) } def name; end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#86 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#98 class RubyIndexer::Entry::Prepend < ::RubyIndexer::Entry::ModuleOperation; end # A required method parameter, e.g. `def foo(a)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#203 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#240 class RubyIndexer::Entry::RequiredParameter < ::RubyIndexer::Entry::Parameter; end # A rest method parameter, e.g. `def foo(*a)` # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#231 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#268 class RubyIndexer::Entry::RestParameter < ::RubyIndexer::Entry::Parameter - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#235 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#272 sig { override.returns(::Symbol) } def decorated_name; end end -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#232 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#269 RubyIndexer::Entry::RestParameter::DEFAULT_NAME = T.let(T.unsafe(nil), Symbol) -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#164 +# Ruby doesn't support method overloading, so a method will have only one signature. +# However RBS can represent the concept of method overloading, with different return types based on the arguments +# passed, so we need to store all the signatures. +# +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#574 +class RubyIndexer::Entry::Signature + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#581 + sig { params(parameters: T::Array[::RubyIndexer::Entry::Parameter]).void } + def initialize(parameters); end + + # Returns a string with the decorated names of the parameters of this member. E.g.: `(a, b = 1, c: 2)` + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#587 + sig { returns(::String) } + def format; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#679 + sig { params(args: T.nilable(T::Array[::Prism::Node]), names: T::Array[::Symbol]).returns(T::Boolean) } + def keyword_arguments_match?(args, names); end + + # Returns `true` if the given call node arguments array matches this method signature. This method will prefer + # returning `true` for situations that cannot be analyzed statically, like the presence of splats, keyword splats + # or forwarding arguments. + # + # Since this method is used to detect which overload should be displayed in signature help, it will also return + # `true` if there are missing arguments since the user may not be done typing yet. For example: + # + # ```ruby + # def foo(a, b); end + # # All of the following are considered matches because the user might be in the middle of typing and we have to + # # show them the signature + # foo + # foo(1) + # foo(1, 2) + # ``` + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#607 + sig { params(arguments: T::Array[::Prism::Node]).returns(T::Boolean) } + def matches?(arguments); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#578 + sig { returns(T::Array[::RubyIndexer::Entry::Parameter]) } + def parameters; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#666 + sig do + params( + positional_args: T::Array[::Prism::Node], + forwarding_arguments: T::Array[::Prism::Node], + keyword_args: T.nilable(T::Array[::Prism::Node]), + min_pos: ::Integer, + max_pos: T.any(::Float, ::Integer) + ).returns(T::Boolean) + end + def positional_arguments_match?(positional_args, forwarding_arguments, keyword_args, min_pos, max_pos); end +end + +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#195 class RubyIndexer::Entry::SingletonClass < ::RubyIndexer::Entry::Class - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#168 - sig { params(location: ::Prism::Location, comments: T::Array[::String]).void } - def update_singleton_information(location, comments); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#199 + sig { params(location: ::Prism::Location, name_location: ::Prism::Location, comments: T::Array[::String]).void } + def update_singleton_information(location, name_location, comments); end end # An UnresolvedAlias points to a constant alias with a right hand side that has not yet been resolved. For @@ -613,9 +746,9 @@ end # target in [rdoc-ref:Index#resolve]. If the right hand side contains a constant that doesn't exist, then it's not # possible to resolve the alias and it will remain an UnresolvedAlias until the right hand side constant exists # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#339 -class RubyIndexer::Entry::UnresolvedAlias < ::RubyIndexer::Entry - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#358 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#433 +class RubyIndexer::Entry::UnresolvedConstantAlias < ::RubyIndexer::Entry + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#452 sig do params( target: ::String, @@ -628,11 +761,11 @@ class RubyIndexer::Entry::UnresolvedAlias < ::RubyIndexer::Entry end def initialize(target, nesting, name, file_path, location, comments); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#346 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#440 sig { returns(T::Array[::String]) } def nesting; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#343 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#437 sig { returns(::String) } def target; end end @@ -641,31 +774,31 @@ end # example, if we have `alias a b`, we create an unresolved alias for `a` because we aren't sure immediate what `b` # is referring to # -# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#405 +# source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#499 class RubyIndexer::Entry::UnresolvedMethodAlias < ::RubyIndexer::Entry - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#424 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#518 sig do params( new_name: ::String, old_name: ::String, owner: T.nilable(::RubyIndexer::Entry::Namespace), file_path: ::String, - location: ::Prism::Location, + location: T.any(::Prism::Location, ::RubyIndexer::Location), comments: T::Array[::String] ).void end def initialize(new_name, old_name, owner, file_path, location, comments); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#409 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#503 sig { returns(::String) } def new_name; end # @return [String] # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#409 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#503 def old_name; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#412 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#506 sig { returns(T.nilable(::RubyIndexer::Entry::Namespace)) } def owner; end end @@ -673,30 +806,63 @@ end # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/entry.rb#6 class RubyIndexer::Entry::Visibility < ::T::Enum enums do - PUBLIC = new - PROTECTED = new PRIVATE = new + PROTECTED = new + PUBLIC = new end end # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#5 class RubyIndexer::Index - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#15 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#18 sig { void } def initialize; end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#78 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#104 sig { params(fully_qualified_name: ::String).returns(T.nilable(T::Array[::RubyIndexer::Entry])) } def [](fully_qualified_name); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#69 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#95 sig { params(entry: ::RubyIndexer::Entry, skip_prefix_tree: T::Boolean).void } def add(entry, skip_prefix_tree: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#41 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#15 + sig { returns(::RubyIndexer::Configuration) } + def configuration; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#67 sig { params(indexable: ::RubyIndexer::IndexablePath).void } def delete(indexable); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#577 + sig { returns(T::Boolean) } + def empty?; end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#625 + sig do + type_parameters(:T) + .params( + path: ::String, + type: T::Class[T.all(::RubyIndexer::Entry, T.type_parameter(:T))] + ).returns(T.nilable(T::Array[T.type_parameter(:T)])) + end + def entries_for(path, type); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#597 + sig { params(name: ::String).returns(::RubyIndexer::Entry::SingletonClass) } + def existing_or_new_singleton_class(name); end + + # Searches for a constant based on an unqualified name and returns the first possible match regardless of whether + # there are more possible matching entries + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#125 + sig do + params( + name: ::String + ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::Constant, ::RubyIndexer::Entry::ConstantAlias, ::RubyIndexer::Entry::Namespace, ::RubyIndexer::Entry::UnresolvedConstantAlias)])) + end + def first_unqualified_const(name); end + # Follows aliases in a namespace. The algorithm keeps checking if the name is an alias and then recursively follows # it. The idea is that we test the name in parts starting from the complete name to the first namespace. For # `Foo::Bar::Baz`, we would test: @@ -708,20 +874,20 @@ class RubyIndexer::Index # `Something::Else`, then we first discover `Something::Else::Baz`. But `Something::Else::Baz` might contain other # aliases, so we have to invoke `follow_aliased_namespace` again to check until we only return a real name # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#268 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#366 sig { params(name: ::String, seen_names: T::Array[::String]).returns(::String) } def follow_aliased_namespace(name, seen_names = T.unsafe(nil)); end # Fuzzy searches index entries based on Jaro-Winkler similarity. If no query is provided, all entries are returned # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#120 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#174 sig { params(query: T.nilable(::String)).returns(T::Array[::RubyIndexer::Entry]) } def fuzzy_search(query); end # Synchronizes a change made to the given indexable path. This method will ensure that new declarations are indexed, # removed declarations removed and that the ancestor linearization cache is cleared if necessary # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#460 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#549 sig { params(indexable: ::RubyIndexer::IndexablePath).void } def handle_change(indexable); end @@ -729,7 +895,7 @@ class RubyIndexer::Index # and control indexing progress. That block is invoked with the current progress percentage and should return `true` # to continue indexing or `false` to stop indexing. # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#221 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#304 sig do params( indexable_paths: T::Array[::RubyIndexer::IndexablePath], @@ -738,17 +904,25 @@ class RubyIndexer::Index end def index_all(indexable_paths: T.unsafe(nil), &block); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#236 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#320 sig { params(indexable_path: ::RubyIndexer::IndexablePath, source: T.nilable(::String)).void } def index_single(indexable_path, source = T.unsafe(nil)); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#587 + sig { params(name: ::String).returns(T::Boolean) } + def indexed?(name); end + # Returns a list of possible candidates for completion of instance variables for a given owner name. The name must # include the `@` prefix # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#448 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#537 sig { params(name: ::String, owner_name: ::String).returns(T::Array[::RubyIndexer::Entry::InstanceVariable]) } def instance_variable_completion_candidates(name, owner_name); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#592 + sig { returns(::Integer) } + def length; end + # Linearizes the ancestors for a given name, returning the order of namespaces in which Ruby will search for method # or constant declarations. # @@ -760,11 +934,11 @@ class RubyIndexer::Index # # @raise [NonExistingNamespaceError] # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#343 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#446 sig { params(fully_qualified_name: ::String).returns(T::Array[::String]) } def linearized_ancestors_of(fully_qualified_name); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#149 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#203 sig do params( name: T.nilable(::String), @@ -773,6 +947,10 @@ class RubyIndexer::Index end def method_completion_candidates(name, receiver_name); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#582 + sig { returns(T::Array[::String]) } + def names; end + # Searches entries in the index based on an exact prefix, intended for providing autocomplete. All possible matches # to the prefix are returned. The return is an array of arrays, where each entry is the array of entries for a given # name match. For example: @@ -787,7 +965,7 @@ class RubyIndexer::Index # ] # ``` # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#101 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#155 sig do params( query: ::String, @@ -796,6 +974,23 @@ class RubyIndexer::Index end def prefix_search(query, nesting = T.unsafe(nil)); end + # Register an enhancement to the index. Enhancements must conform to the `Enhancement` interface + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#56 + sig { params(enhancement: ::RubyIndexer::Enhancement).void } + def register_enhancement(enhancement); end + + # Register an included `hook` that will be executed when `module_name` is included into any namespace + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#62 + sig do + params( + module_name: ::String, + hook: T.proc.params(index: ::RubyIndexer::Index, base: ::RubyIndexer::Entry::Namespace).void + ).void + end + def register_included_hook(module_name, &hook); end + # Resolve a constant to its declaration based on its name and the nesting where the reference was found. Parameter # documentation: # @@ -804,20 +999,20 @@ class RubyIndexer::Index # seen_names: this parameter should not be used by consumers of the api. It is used to avoid infinite recursion when # resolving circular references # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#180 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#263 sig do params( name: ::String, nesting: T::Array[::String], seen_names: T::Array[::String] - ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::ConstantAlias, ::RubyIndexer::Entry::Namespace, ::RubyIndexer::Entry::UnresolvedConstantAlias)])) end def resolve(name, nesting, seen_names = T.unsafe(nil)); end # Resolves an instance variable name for a given owner name. This method will linearize the ancestors of the owner # and find inherited instance variables as well # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#435 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#524 sig do params( variable_name: ::String, @@ -826,19 +1021,22 @@ class RubyIndexer::Index end def resolve_instance_variable(variable_name, owner_name); end - # Attempts to find methods for a resolved fully qualified receiver name. + # Attempts to find methods for a resolved fully qualified receiver name. Do not provide the `seen_names` parameter + # as it is used only internally to prevent infinite loops when resolving circular aliases # Returns `nil` if the method does not exist on that receiver # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#307 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#408 sig do params( method_name: ::String, - receiver_name: ::String + receiver_name: ::String, + seen_names: T::Array[::String], + inherited_only: T::Boolean ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias)])) end - def resolve_method(method_name, receiver_name); end + def resolve_method(method_name, receiver_name, seen_names = T.unsafe(nil), inherited_only: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#83 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#109 sig { params(query: ::String).returns(T::Array[::RubyIndexer::IndexablePath]) } def search_require_paths(query); end @@ -849,66 +1047,98 @@ class RubyIndexer::Index # `A::B::A::B::Foo`. This method will remove any redundant parts from the final name based on the reference and the # nesting # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#575 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#878 sig { params(name: ::String, nesting: T::Array[::String]).returns(::String) } def build_non_redundant_full_name(name, nesting); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#602 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#916 sig do params( full_name: ::String, seen_names: T::Array[::String] - ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::ConstantAlias, ::RubyIndexer::Entry::Namespace, ::RubyIndexer::Entry::UnresolvedConstantAlias)])) end def direct_or_aliased_constant(full_name, seen_names); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#551 + # Linearize mixins for an array of namespace entries. This method will mutate the `ancestors` array with the + # linearized ancestors of the mixins + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#669 + sig do + params( + ancestors: T::Array[::String], + namespace_entries: T::Array[::RubyIndexer::Entry::Namespace], + nesting: T::Array[::String] + ).void + end + def linearize_mixins(ancestors, namespace_entries, nesting); end + + # Linearize the superclass of a given namespace (including modules with the implicit `Module` superclass). This + # method will mutate the `ancestors` array with the linearized ancestors of the superclass + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#719 + sig do + params( + ancestors: T::Array[::String], + attached_class_name: ::String, + fully_qualified_name: ::String, + namespace_entries: T::Array[::RubyIndexer::Entry::Namespace], + nesting: T::Array[::String], + singleton_levels: ::Integer + ).void + end + def linearize_superclass(ancestors, attached_class_name, fully_qualified_name, namespace_entries, nesting, singleton_levels); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#854 sig do params( name: ::String, nesting: T::Array[::String], seen_names: T::Array[::String] - ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::ConstantAlias, ::RubyIndexer::Entry::Namespace, ::RubyIndexer::Entry::UnresolvedConstantAlias)])) end def lookup_ancestor_chain(name, nesting, seen_names); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#526 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#825 sig do params( name: ::String, nesting: T::Array[::String], seen_names: T::Array[::String] - ).returns(T.nilable(T::Array[::RubyIndexer::Entry])) + ).returns(T.nilable(T::Array[T.any(::RubyIndexer::Entry::ConstantAlias, ::RubyIndexer::Entry::Namespace, ::RubyIndexer::Entry::UnresolvedConstantAlias)])) end def lookup_enclosing_scopes(name, nesting, seen_names); end # Attempts to resolve an UnresolvedAlias into a resolved Alias. If the unresolved alias is pointing to a constant # that doesn't exist, then we return the same UnresolvedAlias # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#497 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#792 sig do params( - entry: ::RubyIndexer::Entry::UnresolvedAlias, + entry: ::RubyIndexer::Entry::UnresolvedConstantAlias, seen_names: T::Array[::String] - ).returns(T.any(::RubyIndexer::Entry::Alias, ::RubyIndexer::Entry::UnresolvedAlias)) + ).returns(T.any(::RubyIndexer::Entry::ConstantAlias, ::RubyIndexer::Entry::UnresolvedConstantAlias)) end def resolve_alias(entry, seen_names); end # Attempt to resolve a given unresolved method alias. This method returns the resolved alias if we managed to # identify the target or the same unresolved alias entry if we couldn't # - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#620 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#938 sig do params( entry: ::RubyIndexer::Entry::UnresolvedMethodAlias, - receiver_name: ::String + receiver_name: ::String, + seen_names: T::Array[::String] ).returns(T.any(::RubyIndexer::Entry::MethodAlias, ::RubyIndexer::Entry::UnresolvedMethodAlias)) end - def resolve_method_alias(entry, receiver_name); end + def resolve_method_alias(entry, receiver_name, seen_names); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#608 - sig { params(name: ::String, seen_names: T::Array[::String]).returns(T.nilable(T::Array[::RubyIndexer::Entry])) } - def search_top_level(name, seen_names); end + # Runs the registered included hooks + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#634 + sig { params(fully_qualified_name: ::String, nesting: T::Array[::String]).void } + def run_included_hooks(fully_qualified_name, nesting); end end # The minimum Jaro-Winkler similarity score for an entry to be considered a match for a given fuzzy search query @@ -1089,9 +1319,13 @@ class RubyIndexer::RBSIndexer sig { void } def index_ruby_core; end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#29 + sig { params(pathname: ::Pathname, declarations: T::Array[::RBS::AST::Declarations::Base]).void } + def process_signature(pathname, declarations); end + private - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#93 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#96 sig do params( declaration: T.any(::RBS::AST::Declarations::Class, ::RBS::AST::Declarations::Module), @@ -1100,31 +1334,101 @@ class RubyIndexer::RBSIndexer end def add_declaration_mixins_to_entry(declaration, entry); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#130 - sig { params(owner: ::RubyIndexer::Entry::Namespace).returns(T.nilable(::RubyIndexer::Entry::Class)) } - def existing_or_new_singleton_klass(owner); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#277 + sig do + params( + declaration: T.any(::RBS::AST::Declarations::Class, ::RBS::AST::Declarations::Constant, ::RBS::AST::Declarations::Module, ::RBS::AST::Members::Alias, ::RBS::AST::Members::MethodDefinition) + ).returns(T::Array[::String]) + end + def comments_to_string(declaration); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#45 - sig { params(declaration: ::RBS::AST::Declarations::Class, pathname: ::Pathname).void } - def handle_class_declaration(declaration, pathname); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#53 + sig do + params( + declaration: T.any(::RBS::AST::Declarations::Class, ::RBS::AST::Declarations::Module), + pathname: ::Pathname + ).void + end + def handle_class_or_module_declaration(declaration, pathname); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#110 + # RBS treats constant definitions differently depend on where they are defined. + # When constants' rbs are defined inside a class/module block, they are treated as + # members of the class/module. + # + # module Encoding + # US_ASCII = ... # US_ASCII is a member of Encoding + # end + # + # When constants' rbs are defined outside a class/module block, they are treated as + # top-level constants. + # + # Complex::I = ... # Complex::I is a top-level constant + # + # And we need to handle their nesting differently. + # + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#241 + sig do + params( + declaration: ::RBS::AST::Declarations::Constant, + nesting: T::Array[::String], + file_path: ::String + ).void + end + def handle_constant(declaration, nesting, file_path); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#112 sig { params(member: ::RBS::AST::Members::MethodDefinition, owner: ::RubyIndexer::Entry::Namespace).void } def handle_method(member, owner); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#62 - sig { params(declaration: ::RBS::AST::Declarations::Module, pathname: ::Pathname).void } - def handle_module_declaration(declaration, pathname); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#252 + sig { params(member: ::RBS::AST::Members::Alias, owner_entry: ::RubyIndexer::Entry::Namespace).void } + def handle_signature_alias(member, owner_entry); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#152 + sig { params(function: ::RBS::Types::Function).returns(T::Array[::RubyIndexer::Entry::Parameter]) } + def parse_arguments(function); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#33 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#38 sig { params(declaration: ::RBS::AST::Declarations::Base, pathname: ::Pathname).void } def process_declaration(declaration, pathname); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#26 - sig { params(source: T.untyped, pathname: ::Pathname, declarations: T::Array[::RBS::AST::Declarations::Base]).void } - def process_signature(source, pathname, declarations); end + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#211 + sig { params(function: ::RBS::Types::Function).returns(T::Array[::RubyIndexer::Entry::OptionalKeywordParameter]) } + def process_optional_keywords(function); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#141 + sig do + params( + overload: ::RBS::AST::Members::MethodDefinition::Overload + ).returns(T::Array[::RubyIndexer::Entry::Parameter]) + end + def process_overload(overload); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#164 + sig { params(function: ::RBS::Types::Function).returns(T::Array[::RubyIndexer::Entry::RequiredParameter]) } + def process_required_and_optional_positionals(function); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#204 + sig { params(function: ::RBS::Types::Function).returns(T::Array[::RubyIndexer::Entry::KeywordParameter]) } + def process_required_keywords(function); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#218 + sig { params(function: ::RBS::Types::Function).returns(::RubyIndexer::Entry::KeywordRestParameter) } + def process_rest_keywords(function); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#195 + sig { params(function: ::RBS::Types::Function).returns(::RubyIndexer::Entry::RestParameter) } + def process_rest_positionals(function); end - # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#78 + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#188 + sig { params(function: ::RBS::Types::Function).returns(T::Array[::RubyIndexer::Entry::OptionalParameter]) } + def process_trailing_positionals(function); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#133 + sig { params(member: ::RBS::AST::Members::MethodDefinition).returns(T::Array[::RubyIndexer::Entry::Signature]) } + def signatures(member); end + + # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb#81 sig { params(rbs_location: ::RBS::Location).returns(::RubyIndexer::Location) } def to_ruby_indexer_location(rbs_location); end end @@ -1156,7 +1460,7 @@ module RubyLsp; end class RubyLsp::Addon abstract! - # source://ruby-lsp/lib/ruby_lsp/addon.rb#78 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#93 sig { void } def initialize; end @@ -1165,17 +1469,17 @@ class RubyLsp::Addon # # @abstract # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#109 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#124 sig { abstract.params(global_state: ::RubyLsp::GlobalState, outgoing_queue: ::Thread::Queue).void } def activate(global_state, outgoing_queue); end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#83 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#98 sig { params(error: ::StandardError).returns(T.self_type) } def add_error(error); end # Creates a new CodeLens listener. This method is invoked on every CodeLens request # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#128 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#143 sig do overridable .params( @@ -1188,7 +1492,7 @@ class RubyLsp::Addon # Creates a new Completion listener. This method is invoked on every Completion request # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#177 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#195 sig do overridable .params( @@ -1202,11 +1506,11 @@ class RubyLsp::Addon # Creates a new Definition listener. This method is invoked on every Definition request # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#166 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#184 sig do overridable .params( - response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::Location], + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[T.any(::LanguageServer::Protocol::Interface::Location, ::LanguageServer::Protocol::Interface::LocationLink)], uri: ::URI::Generic, node_context: ::RubyLsp::NodeContext, dispatcher: ::Prism::Dispatcher @@ -1216,7 +1520,7 @@ class RubyLsp::Addon # Creates a new DocumentSymbol listener. This method is invoked on every DocumentSymbol request # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#147 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#162 sig do overridable .params( @@ -1228,7 +1532,7 @@ class RubyLsp::Addon # Creates a new Hover listener. This method is invoked on every Hover request # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#138 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#153 sig do overridable .params( @@ -1239,7 +1543,7 @@ class RubyLsp::Addon end def create_hover_listener(response_builder, node_context, dispatcher); end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#155 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#170 sig do overridable .params( @@ -1254,19 +1558,19 @@ class RubyLsp::Addon # # @abstract # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#114 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#129 sig { abstract.void } def deactivate; end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#89 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#104 sig { returns(T::Boolean) } def error?; end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#102 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#117 sig { returns(::String) } def errors_details; end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#94 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#109 sig { returns(::String) } def formatted_errors; end @@ -1274,52 +1578,61 @@ class RubyLsp::Addon # # @abstract # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#118 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#133 sig { abstract.returns(::String) } def name; end class << self - # source://ruby-lsp/lib/ruby_lsp/addon.rb#43 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#45 sig { returns(T::Array[T.class_of(RubyLsp::Addon)]) } def addon_classes; end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#37 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#39 sig { returns(T::Array[::RubyLsp::Addon]) } def addons; end # @return [Array] # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#37 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#39 def addons=(_arg0); end - # source://ruby-lsp/lib/ruby_lsp/addon.rb#40 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#42 sig { returns(T::Array[::RubyLsp::Addon]) } def file_watcher_addons; end # @return [Array] # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#40 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#42 def file_watcher_addons=(_arg0); end + # @raise [AddonNotFoundError] + # + # source://ruby-lsp/lib/ruby_lsp/addon.rb#84 + sig { params(addon_name: ::String).returns(::RubyLsp::Addon) } + def get(addon_name); end + # Automatically track and instantiate addon classes # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#47 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#49 sig { params(child_class: T.class_of(RubyLsp::Addon)).void } def inherited(child_class); end - # Discovers and loads all addons. Returns the list of activated addons + # Discovers and loads all addons. Returns a list of errors when trying to require addons # - # source://ruby-lsp/lib/ruby_lsp/addon.rb#54 + # source://ruby-lsp/lib/ruby_lsp/addon.rb#58 sig do params( global_state: ::RubyLsp::GlobalState, outgoing_queue: ::Thread::Queue - ).returns(T::Array[::RubyLsp::Addon]) + ).returns(T::Array[::StandardError]) end def load_addons(global_state, outgoing_queue); end end end +# source://ruby-lsp/lib/ruby_lsp/addon.rb#33 +class RubyLsp::Addon::AddonNotFoundError < ::StandardError; end + # Used to indicate that a request shouldn't return a response # # source://ruby-lsp/lib/ruby_lsp/utils.rb#12 @@ -1359,6 +1672,10 @@ class RubyLsp::BaseServer sig { params(id: ::Integer).void } def send_empty_response(id); end + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#150 + sig { params(message: ::String, type: ::Integer).void } + def send_log_message(message, type: T.unsafe(nil)); end + # source://ruby-lsp/lib/ruby_lsp/base_server.rb#134 sig { params(message: T.any(::RubyLsp::Error, ::RubyLsp::Notification, ::RubyLsp::Request, ::RubyLsp::Result)).void } def send_message(message); end @@ -1383,143 +1700,209 @@ RubyLsp::Constant = LanguageServer::Protocol::Constant class RubyLsp::Document abstract! - # source://ruby-lsp/lib/ruby_lsp/document.rb#27 + # source://ruby-lsp/lib/ruby_lsp/document.rb#46 sig { params(source: ::String, version: ::Integer, uri: ::URI::Generic, encoding: ::Encoding).void } def initialize(source:, version:, uri:, encoding: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/document.rb#48 - sig { params(other: ::RubyLsp::Document).returns(T::Boolean) } + # source://ruby-lsp/lib/ruby_lsp/document.rb#58 + sig { params(other: RubyLsp::Document[T.untyped]).returns(T::Boolean) } def ==(other); end # TODO: remove this method once all nonpositional requests have been migrated to the listener pattern # - # source://ruby-lsp/lib/ruby_lsp/document.rb#60 + # source://ruby-lsp/lib/ruby_lsp/document.rb#73 sig do type_parameters(:T) .params( request_name: ::String, - block: T.proc.params(document: ::RubyLsp::Document).returns(T.type_parameter(:T)) + block: T.proc.params(document: RubyLsp::Document[T.untyped]).returns(T.type_parameter(:T)) ).returns(T.type_parameter(:T)) end def cache_fetch(request_name, &block); end - # source://ruby-lsp/lib/ruby_lsp/document.rb#75 + # source://ruby-lsp/lib/ruby_lsp/document.rb#88 sig { params(request_name: ::String).returns(T.untyped) } def cache_get(request_name); end - # source://ruby-lsp/lib/ruby_lsp/document.rb#70 + # source://ruby-lsp/lib/ruby_lsp/document.rb#83 sig { type_parameters(:T).params(request_name: ::String, value: T.type_parameter(:T)).returns(T.type_parameter(:T)) } def cache_set(request_name, value); end - # source://ruby-lsp/lib/ruby_lsp/document.rb#43 - sig { returns(T::Array[::Prism::Comment]) } - def comments; end - - # source://ruby-lsp/lib/ruby_lsp/document.rb#105 + # source://ruby-lsp/lib/ruby_lsp/document.rb#116 sig { returns(::RubyLsp::Document::Scanner) } def create_scanner; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#24 + # source://ruby-lsp/lib/ruby_lsp/document.rb#40 sig { returns(::Encoding) } def encoding; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#126 - sig do - params( - node: ::Prism::Node, - char_position: ::Integer, - node_types: T::Array[T.class_of(Prism::Node)] - ).returns(::RubyLsp::NodeContext) - end - def locate(node, char_position, node_types: T.unsafe(nil)); end - - # source://ruby-lsp/lib/ruby_lsp/document.rb#115 - sig do - params( - position: T::Hash[::Symbol, T.untyped], - node_types: T::Array[T.class_of(Prism::Node)] - ).returns(::RubyLsp::NodeContext) - end - def locate_node(position, node_types: T.unsafe(nil)); end + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#63 + sig { abstract.returns(::RubyLsp::Document::LanguageId) } + def language_id; end # @abstract # - # source://ruby-lsp/lib/ruby_lsp/document.rb#97 - sig { abstract.returns(::Prism::ParseResult) } + # source://ruby-lsp/lib/ruby_lsp/document.rb#110 + sig { abstract.returns(T.untyped) } def parse; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#12 - sig { returns(::Prism::ParseResult) } + # source://ruby-lsp/lib/ruby_lsp/document.rb#28 + sig { returns(T.untyped) } def parse_result; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#80 + # source://ruby-lsp/lib/ruby_lsp/document.rb#121 + sig { returns(T::Boolean) } + def past_expensive_limit?; end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#93 sig { params(edits: T::Array[T::Hash[::Symbol, T.untyped]], version: ::Integer).void } def push_edits(edits, version:); end - # source://ruby-lsp/lib/ruby_lsp/document.rb#229 - sig { returns(T::Boolean) } - def sorbet_sigil_is_true_or_higher; end + # source://ruby-lsp/lib/ruby_lsp/document.rb#43 + sig { returns(T.any(::LanguageServer::Protocol::Interface::SemanticTokens, ::Object)) } + def semantic_tokens; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#15 + # @return [Interface::SemanticTokens, Object] + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#43 + def semantic_tokens=(_arg0); end + + # source://ruby-lsp/lib/ruby_lsp/document.rb#31 sig { returns(::String) } def source; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#100 - sig { returns(T::Boolean) } + # @abstract + # + # source://ruby-lsp/lib/ruby_lsp/document.rb#113 + sig { abstract.returns(T::Boolean) } def syntax_error?; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#38 - sig { returns(::Prism::ProgramNode) } - def tree; end - - # source://ruby-lsp/lib/ruby_lsp/document.rb#21 + # source://ruby-lsp/lib/ruby_lsp/document.rb#37 sig { returns(::URI::Generic) } def uri; end - # source://ruby-lsp/lib/ruby_lsp/document.rb#18 + # source://ruby-lsp/lib/ruby_lsp/document.rb#34 sig { returns(::Integer) } def version; end end -# source://ruby-lsp/lib/ruby_lsp/document.rb#235 +# source://ruby-lsp/lib/ruby_lsp/document.rb#23 +RubyLsp::Document::EMPTY_CACHE = T.let(T.unsafe(nil), Object) + +# source://ruby-lsp/lib/ruby_lsp/document.rb#6 +class RubyLsp::Document::LanguageId < ::T::Enum + enums do + ERB = new + RBS = new + Ruby = new + end +end + +# This maximum number of characters for providing expensive features, like semantic highlighting and diagnostics. +# This is the same number used by the TypeScript extension in VS Code +# +# source://ruby-lsp/lib/ruby_lsp/document.rb#22 +RubyLsp::Document::MAXIMUM_CHARACTERS_FOR_EXPENSIVE_FEATURES = T.let(T.unsafe(nil), Integer) + +# source://ruby-lsp/lib/ruby_lsp/document.rb#125 class RubyLsp::Document::Scanner - # source://ruby-lsp/lib/ruby_lsp/document.rb#243 + # source://ruby-lsp/lib/ruby_lsp/document.rb#133 sig { params(source: ::String, encoding: ::Encoding).void } def initialize(source, encoding); end # Finds the character index inside the source string for a given line and column # - # source://ruby-lsp/lib/ruby_lsp/document.rb#252 + # source://ruby-lsp/lib/ruby_lsp/document.rb#142 sig { params(position: T::Hash[::Symbol, T.untyped]).returns(::Integer) } def find_char_position(position); end # Subtract 1 for each character after 0xFFFF in the current line from the column position, so that we hit the # right character in the UTF-8 representation # - # source://ruby-lsp/lib/ruby_lsp/document.rb#274 + # source://ruby-lsp/lib/ruby_lsp/document.rb#164 sig { params(current_position: ::Integer, requested_position: ::Integer).returns(::Integer) } def utf_16_character_position_correction(current_position, requested_position); end end -# source://ruby-lsp/lib/ruby_lsp/document.rb#238 +# source://ruby-lsp/lib/ruby_lsp/document.rb#128 RubyLsp::Document::Scanner::LINE_BREAK = T.let(T.unsafe(nil), Integer) # After character 0xFFFF, UTF-16 considers characters to have length 2 and we have to account for that # -# source://ruby-lsp/lib/ruby_lsp/document.rb#240 +# source://ruby-lsp/lib/ruby_lsp/document.rb#130 RubyLsp::Document::Scanner::SURROGATE_PAIR_START = T.let(T.unsafe(nil), Integer) -# source://ruby-lsp/lib/ruby_lsp/utils.rb#90 +# source://ruby-lsp/lib/ruby_lsp/erb_document.rb#5 +class RubyLsp::ERBDocument < ::RubyLsp::Document + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#28 + sig { override.returns(::RubyLsp::Document::LanguageId) } + def language_id; end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#38 + sig do + params( + position: T::Hash[::Symbol, T.untyped], + node_types: T::Array[T.class_of(Prism::Node)] + ).returns(::RubyLsp::NodeContext) + end + def locate_node(position, node_types: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#12 + sig { override.returns(T.untyped) } + def parse; end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#23 + sig { override.returns(T::Boolean) } + def syntax_error?; end +end + +# source://ruby-lsp/lib/ruby_lsp/erb_document.rb#42 +class RubyLsp::ERBDocument::ERBScanner + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#49 + sig { params(source: ::String).void } + def initialize(source); end + + # @return [String] + # + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#46 + def html; end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#46 + sig { returns(::String) } + def ruby; end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#58 + sig { void } + def scan; end + + private + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#134 + sig { returns(::String) } + def next_char; end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#123 + sig { params(char: ::String).void } + def push_char(char); end + + # source://ruby-lsp/lib/ruby_lsp/erb_document.rb#68 + sig { void } + def scan_char; end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#100 class RubyLsp::Error - # source://ruby-lsp/lib/ruby_lsp/utils.rb#97 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#107 sig { params(id: ::Integer, code: ::Integer, message: ::String, data: T.nilable(T::Hash[::Symbol, T.untyped])).void } def initialize(id:, code:, message:, data: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#94 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#104 sig { returns(::String) } def message; end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#105 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#115 sig { returns(T::Hash[::Symbol, T.untyped]) } def to_hash; end end @@ -1527,32 +1910,42 @@ end # source://ruby-lsp/lib/ruby_lsp/utils.rb#20 RubyLsp::GEMFILE_NAME = T.let(T.unsafe(nil), String) +# source://ruby-lsp/lib/ruby_lsp/utils.rb#28 +RubyLsp::GUESSED_TYPES_URL = T.let(T.unsafe(nil), String) + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#5 class RubyLsp::GlobalState # source://ruby-lsp/lib/ruby_lsp/global_state.rb#30 sig { void } def initialize; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#50 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#57 sig { returns(T.nilable(::RubyLsp::Requests::Support::Formatter)) } def active_formatter; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#55 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#62 sig { returns(T::Array[::RubyLsp::Requests::Support::Formatter]) } def active_linters; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#60 - sig { params(options: T::Hash[::Symbol, T.untyped]).void } + # Applies the options provided by the editor and returns an array of notifications to send back to the client + # + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#68 + sig { params(options: T::Hash[::Symbol, T.untyped]).returns(T::Array[::RubyLsp::Notification]) } def apply_options(options); end # source://ruby-lsp/lib/ruby_lsp/global_state.rb#21 sig { returns(::Encoding) } def encoding; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#98 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#143 sig { returns(::String) } def encoding_name; end + # @return [Boolean] + # + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#24 + def experimental_features; end + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#12 sig { returns(::String) } def formatter; end @@ -1570,10 +1963,14 @@ class RubyLsp::GlobalState sig { returns(::RubyIndexer::Index) } def index; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#45 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#52 sig { params(identifier: ::String, instance: ::RubyLsp::Requests::Support::Formatter).void } def register_formatter(identifier, instance); end + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#47 + sig { params(addon_name: ::String).returns(T.nilable(T::Hash[::Symbol, T.untyped])) } + def settings_for_addon(addon_name); end + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#24 sig { returns(T::Boolean) } def supports_watching_files; end @@ -1586,48 +1983,48 @@ class RubyLsp::GlobalState sig { returns(::RubyLsp::TypeInferrer) } def type_inferrer; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#93 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#138 sig { returns(::String) } def workspace_path; end private - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#173 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#213 sig { returns(T::Boolean) } def bin_rails_present; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#112 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#157 sig { params(direct_dependencies: T::Array[::String], all_dependencies: T::Array[::String]).returns(::String) } def detect_formatter(direct_dependencies, all_dependencies); end # Try to detect if there are linters in the project's dependencies. For auto-detection, we always only consider a # single linter. To have multiple linters running, the user must configure them manually # - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#128 - sig { params(dependencies: T::Array[::String]).returns(T::Array[::String]) } - def detect_linters(dependencies); end + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#173 + sig { params(dependencies: T::Array[::String], all_dependencies: T::Array[::String]).returns(T::Array[::String]) } + def detect_linters(dependencies, all_dependencies); end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#135 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#184 sig { params(dependencies: T::Array[::String]).returns(::String) } def detect_test_library(dependencies); end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#155 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#204 sig { params(dependencies: T::Array[::String]).returns(T::Boolean) } def detect_typechecker(dependencies); end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#178 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#218 sig { returns(T::Boolean) } def dot_rubocop_yml_present; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#198 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#238 sig { returns(T::Array[::String]) } def gather_direct_and_indirect_dependencies; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#183 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#223 sig { returns(T::Array[::String]) } def gather_direct_dependencies; end - # source://ruby-lsp/lib/ruby_lsp/global_state.rb#191 + # source://ruby-lsp/lib/ruby_lsp/global_state.rb#231 sig { returns(T::Array[::String]) } def gemspec_dependencies; end end @@ -1653,49 +2050,53 @@ class RubyLsp::Listeners::CodeLens end def initialize(response_builder, global_state, uri, dispatcher); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#134 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#137 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#164 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#167 sig { params(node: ::Prism::CallNode).void } def on_call_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#62 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#63 sig { params(node: ::Prism::ClassNode).void } def on_class_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#81 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#83 sig { params(node: ::Prism::ClassNode).void } def on_class_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#93 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#95 sig { params(node: ::Prism::DefNode).void } def on_def_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#115 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#118 sig { params(node: ::Prism::DefNode).void } def on_def_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#120 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#123 sig { params(node: ::Prism::ModuleNode).void } def on_module_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#129 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#132 sig { params(node: ::Prism::ModuleNode).void } def on_module_node_leave(node); end private - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#269 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#274 sig { params(node: ::Prism::CallNode, kind: ::Symbol).void } def add_spec_code_lens(node, kind:); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#175 - sig { params(node: ::Prism::Node, name: ::String, command: ::String, kind: ::Symbol).void } - def add_test_code_lens(node, name:, command:, kind:); end + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#179 + sig { params(node: ::Prism::Node, name: ::String, command: ::String, kind: ::Symbol, id: ::String).void } + def add_test_code_lens(node, name:, command:, kind:, id: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#312 + sig { params(group_stack: T::Array[::String], method_name: T.nilable(::String)).returns(::String) } + def generate_fully_qualified_id(group_stack:, method_name: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#226 + # source://ruby-lsp/lib/ruby_lsp/listeners/code_lens.rb#231 sig do params( group_stack: T::Array[::String], @@ -1728,63 +2129,71 @@ RubyLsp::Listeners::CodeLens::SUPPORTED_TEST_LIBRARIES = T.let(T.unsafe(nil), Ar class RubyLsp::Listeners::Completion include ::RubyLsp::Requests::Support::Common - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#21 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#65 sig do params( response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::CompletionItem], global_state: ::RubyLsp::GlobalState, node_context: ::RubyLsp::NodeContext, - typechecker_enabled: T::Boolean, + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel, dispatcher: ::Prism::Dispatcher, uri: ::URI::Generic, trigger_character: T.nilable(::String) ).void end - def initialize(response_builder, global_state, node_context, typechecker_enabled, dispatcher, uri, trigger_character); end + def initialize(response_builder, global_state, node_context, sorbet_level, dispatcher, uri, trigger_character); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#86 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#134 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end # Handle completion on namespaced constant references (e.g. `Foo::Bar`) # - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#76 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#122 sig { params(node: ::Prism::ConstantPathNode).void } def on_constant_path_node_enter(node); end # Handle completion on regular constant references (e.g. `Bar`) # - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#55 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#99 sig { params(node: ::Prism::ConstantReadNode).void } def on_constant_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#136 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#188 sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } def on_instance_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#141 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#193 sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } def on_instance_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#146 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#198 sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } def on_instance_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#126 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#178 sig { params(node: ::Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#151 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#203 sig { params(node: ::Prism::InstanceVariableTargetNode).void } def on_instance_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#131 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#183 sig { params(node: ::Prism::InstanceVariableWriteNode).void } def on_instance_variable_write_node_enter(node); end private - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#336 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#416 + sig { params(node: ::Prism::CallNode, name: ::String).void } + def add_keyword_completions(node, name); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#396 + sig { params(node: ::Prism::CallNode, name: ::String).void } + def add_local_completions(node, name); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#434 sig do params( label: ::String, @@ -1793,7 +2202,7 @@ class RubyLsp::Listeners::Completion end def build_completion(label, node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#359 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#457 sig do params( real_name: ::String, @@ -1805,32 +2214,23 @@ class RubyLsp::Listeners::Completion end def build_entry_completion(real_name, incomplete_name, range, entries, top_level); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#316 - sig do - params( - entry: T.any(::RubyIndexer::Entry::Member, ::RubyIndexer::Entry::MethodAlias), - node: ::Prism::CallNode - ).returns(::LanguageServer::Protocol::Interface::CompletionItem) - end - def build_method_completion(entry, node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#274 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#335 sig { params(node: ::Prism::CallNode, name: ::String).void } def complete_methods(node, name); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#229 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#290 sig { params(node: ::Prism::CallNode).void } def complete_require(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#245 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#306 sig { params(node: ::Prism::CallNode).void } def complete_require_relative(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#158 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#210 sig { params(name: ::String, range: ::LanguageServer::Protocol::Interface::Range).void } def constant_path_completion(name, range); end - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#205 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#257 sig { params(name: ::String, location: ::Prism::Location).void } def handle_instance_variable_completion(name, location); end @@ -1849,89 +2249,119 @@ class RubyLsp::Listeners::Completion # end # ``` # - # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#442 + # source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#546 sig { params(entry_name: ::String).returns(T::Boolean) } def top_level?(entry_name); end end +# source://ruby-lsp/lib/ruby_lsp/listeners/completion.rb#10 +RubyLsp::Listeners::Completion::KEYWORDS = T.let(T.unsafe(nil), Array) + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#6 class RubyLsp::Listeners::Definition include ::RubyLsp::Requests::Support::Common - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#22 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#26 sig do params( - response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[::LanguageServer::Protocol::Interface::Location], + response_builder: RubyLsp::ResponseBuilders::CollectionResponseBuilder[T.any(::LanguageServer::Protocol::Interface::Location, ::LanguageServer::Protocol::Interface::LocationLink)], global_state: ::RubyLsp::GlobalState, + language_id: ::RubyLsp::Document::LanguageId, uri: ::URI::Generic, node_context: ::RubyLsp::NodeContext, dispatcher: ::Prism::Dispatcher, - typechecker_enabled: T::Boolean + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel ).void end - def initialize(response_builder, global_state, uri, node_context, dispatcher, typechecker_enabled); end + def initialize(response_builder, global_state, language_id, uri, node_context, dispatcher, sorbet_level); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#67 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#97 sig { params(node: ::Prism::BlockArgumentNode).void } def on_block_argument_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#48 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#56 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#78 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#108 sig { params(node: ::Prism::ConstantPathNode).void } def on_constant_path_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#86 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#116 sig { params(node: ::Prism::ConstantReadNode).void } def on_constant_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#104 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#159 + sig { params(node: ::Prism::ForwardingSuperNode).void } + def on_forwarding_super_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#134 sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } def on_instance_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#109 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#139 sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } def on_instance_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#114 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#144 sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } def on_instance_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#94 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#124 sig { params(node: ::Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#119 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#149 sig { params(node: ::Prism::InstanceVariableTargetNode).void } def on_instance_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#99 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#129 sig { params(node: ::Prism::InstanceVariableWriteNode).void } def on_instance_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#56 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#75 sig { params(node: ::Prism::StringNode).void } def on_string_node_enter(node); end + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#154 + sig { params(node: ::Prism::SuperNode).void } + def on_super_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#86 + sig { params(node: ::Prism::SymbolNode).void } + def on_symbol_node_enter(node); end + private - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#211 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#281 sig { params(value: ::String).void } def find_in_index(value); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#126 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#270 + sig { params(node: ::Prism::CallNode).void } + def handle_autoload_definition(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#181 sig { params(name: ::String).void } def handle_instance_variable_definition(name); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#149 - sig { params(message: ::String, receiver_type: T.nilable(::String)).void } - def handle_method_definition(message, receiver_type); end + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#208 + sig do + params( + message: ::String, + receiver_type: T.nilable(::RubyLsp::TypeInferrer::Type), + inherited_only: T::Boolean + ).void + end + def handle_method_definition(message, receiver_type, inherited_only: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#176 + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#235 sig { params(node: ::Prism::StringNode, message: ::Symbol).void } def handle_require_definition(node, message); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#166 + sig { void } + def handle_super_node_definition; end end # source://ruby-lsp/lib/ruby_lsp/listeners/definition.rb#10 @@ -1952,7 +2382,7 @@ class RubyLsp::Listeners::DocumentHighlight end def initialize(response_builder, target, parent, dispatcher); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#236 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#240 sig { params(node: ::Prism::BlockParameterNode).void } def on_block_parameter_node_enter(node); end @@ -1960,197 +2390,197 @@ class RubyLsp::Listeners::DocumentHighlight sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#250 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#254 sig { params(node: ::Prism::ClassNode).void } def on_class_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#420 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#424 sig { params(node: ::Prism::ClassVariableAndWriteNode).void } def on_class_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#413 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#417 sig { params(node: ::Prism::ClassVariableOperatorWriteNode).void } def on_class_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#406 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#410 sig { params(node: ::Prism::ClassVariableOrWriteNode).void } def on_class_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#292 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#296 sig { params(node: ::Prism::ClassVariableReadNode).void } def on_class_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#222 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#226 sig { params(node: ::Prism::ClassVariableTargetNode).void } def on_class_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#399 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#403 sig { params(node: ::Prism::ClassVariableWriteNode).void } def on_class_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#476 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#480 sig { params(node: ::Prism::ConstantAndWriteNode).void } def on_constant_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#441 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#445 sig { params(node: ::Prism::ConstantOperatorWriteNode).void } def on_constant_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#434 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#438 sig { params(node: ::Prism::ConstantOrWriteNode).void } def on_constant_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#320 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#324 sig { params(node: ::Prism::ConstantPathAndWriteNode).void } def on_constant_path_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#271 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#275 sig { params(node: ::Prism::ConstantPathNode).void } def on_constant_path_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#327 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#331 sig { params(node: ::Prism::ConstantPathOperatorWriteNode).void } def on_constant_path_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#313 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#317 sig { params(node: ::Prism::ConstantPathOrWriteNode).void } def on_constant_path_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#208 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#212 sig { params(node: ::Prism::ConstantPathTargetNode).void } def on_constant_path_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#306 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#310 sig { params(node: ::Prism::ConstantPathWriteNode).void } def on_constant_path_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#278 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#282 sig { params(node: ::Prism::ConstantReadNode).void } def on_constant_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#215 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#219 sig { params(node: ::Prism::ConstantTargetNode).void } def on_constant_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#427 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#431 sig { params(node: ::Prism::ConstantWriteNode).void } def on_constant_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#187 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#191 sig { params(node: ::Prism::DefNode).void } def on_def_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#497 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#501 sig { params(node: ::Prism::GlobalVariableAndWriteNode).void } def on_global_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#504 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#508 sig { params(node: ::Prism::GlobalVariableOperatorWriteNode).void } def on_global_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#490 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#494 sig { params(node: ::Prism::GlobalVariableOrWriteNode).void } def on_global_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#299 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#303 sig { params(node: ::Prism::GlobalVariableReadNode).void } def on_global_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#194 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#198 sig { params(node: ::Prism::GlobalVariableTargetNode).void } def on_global_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#483 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#487 sig { params(node: ::Prism::GlobalVariableWriteNode).void } def on_global_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#462 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#466 sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } def on_instance_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#469 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#473 sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } def on_instance_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#455 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#459 sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } def on_instance_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#285 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#289 sig { params(node: ::Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#201 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#205 sig { params(node: ::Prism::InstanceVariableTargetNode).void } def on_instance_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#448 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#452 sig { params(node: ::Prism::InstanceVariableWriteNode).void } def on_instance_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#370 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#374 sig { params(node: ::Prism::KeywordRestParameterNode).void } def on_keyword_rest_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#378 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#382 sig { params(node: ::Prism::LocalVariableAndWriteNode).void } def on_local_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#385 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#389 sig { params(node: ::Prism::LocalVariableOperatorWriteNode).void } def on_local_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#392 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#396 sig { params(node: ::Prism::LocalVariableOrWriteNode).void } def on_local_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#264 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#268 sig { params(node: ::Prism::LocalVariableReadNode).void } def on_local_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#229 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#233 sig { params(node: ::Prism::LocalVariableTargetNode).void } def on_local_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#334 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#338 sig { params(node: ::Prism::LocalVariableWriteNode).void } def on_local_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#257 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#261 sig { params(node: ::Prism::ModuleNode).void } def on_module_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#348 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#352 sig { params(node: ::Prism::OptionalKeywordParameterNode).void } def on_optional_keyword_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#363 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#367 sig { params(node: ::Prism::OptionalParameterNode).void } def on_optional_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#341 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#345 sig { params(node: ::Prism::RequiredKeywordParameterNode).void } def on_required_keyword_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#243 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#247 sig { params(node: ::Prism::RequiredParameterNode).void } def on_required_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#355 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#359 sig { params(node: ::Prism::RestParameterNode).void } def on_rest_parameter_node_enter(node); end private - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#518 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#522 sig { params(kind: ::Integer, location: ::Prism::Location).void } def add_highlight(kind, location); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#513 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#517 sig { params(node: ::Prism::Node, classes: T::Array[T.class_of(Prism::Node)]).returns(T.nilable(T::Boolean)) } def matches?(node, classes); end - # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#523 + # source://ruby-lsp/lib/ruby_lsp/listeners/document_highlight.rb#527 sig { params(node: T.nilable(::Prism::Node)).returns(T.nilable(::String)) } def node_value(node); end end @@ -2517,7 +2947,7 @@ end class RubyLsp::Listeners::Hover include ::RubyLsp::Requests::Support::Common - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#46 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#48 sig do params( response_builder: RubyLsp::ResponseBuilders::Hover, @@ -2525,67 +2955,83 @@ class RubyLsp::Listeners::Hover uri: ::URI::Generic, node_context: ::RubyLsp::NodeContext, dispatcher: ::Prism::Dispatcher, - typechecker_enabled: T::Boolean + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel ).void end - def initialize(response_builder, global_state, uri, node_context, dispatcher, typechecker_enabled); end + def initialize(response_builder, global_state, uri, node_context, dispatcher, sorbet_level); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#98 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#102 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#88 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#92 sig { params(node: ::Prism::ConstantPathNode).void } def on_constant_path_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#71 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#75 sig { params(node: ::Prism::ConstantReadNode).void } def on_constant_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#81 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#85 sig { params(node: ::Prism::ConstantWriteNode).void } def on_constant_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#133 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#152 + sig { params(node: ::Prism::ForwardingSuperNode).void } + def on_forwarding_super_node_enter(node); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#127 sig { params(node: ::Prism::InstanceVariableAndWriteNode).void } def on_instance_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#138 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#132 sig { params(node: ::Prism::InstanceVariableOperatorWriteNode).void } def on_instance_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#143 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#137 sig { params(node: ::Prism::InstanceVariableOrWriteNode).void } def on_instance_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#123 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#117 sig { params(node: ::Prism::InstanceVariableReadNode).void } def on_instance_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#148 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#142 sig { params(node: ::Prism::InstanceVariableTargetNode).void } def on_instance_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#128 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#122 sig { params(node: ::Prism::InstanceVariableWriteNode).void } def on_instance_variable_write_node_enter(node); end + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#147 + sig { params(node: ::Prism::SuperNode).void } + def on_super_node_enter(node); end + private - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#185 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#227 sig { params(node: ::Prism::CallNode).void } def generate_gem_hover(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#170 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#212 sig { params(name: ::String, location: ::Prism::Location).void } def generate_hover(name, location); end - # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#155 + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#193 sig { params(name: ::String).void } def handle_instance_variable_hover(name); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#170 + sig { params(message: ::String, inherited_only: T::Boolean).void } + def handle_method_hover(message, inherited_only: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#159 + sig { void } + def handle_super_node_hover; end end -# source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#28 +# source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#30 RubyLsp::Listeners::Hover::ALLOWED_REMOTE_PROVIDERS = T.let(T.unsafe(nil), Array) # source://ruby-lsp/lib/ruby_lsp/listeners/hover.rb#10 @@ -2613,6 +3059,12 @@ class RubyLsp::Listeners::InlayHints # source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#29 sig { params(node: ::Prism::RescueNode).void } def on_rescue_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#76 + sig { params(node: T.nilable(::Prism::Node), range: T.nilable(T::Range[::Integer])).returns(T::Boolean) } + def visible?(node, range); end end # source://ruby-lsp/lib/ruby_lsp/listeners/inlay_hints.rb#10 @@ -2622,158 +3074,129 @@ RubyLsp::Listeners::InlayHints::RESCUE_STRING_LENGTH = T.let(T.unsafe(nil), Inte class RubyLsp::Listeners::SemanticHighlighting include ::RubyLsp::Requests::Support::Common - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#28 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#27 sig do params( dispatcher: ::Prism::Dispatcher, - response_builder: RubyLsp::ResponseBuilders::SemanticHighlighting, - range: T.nilable(T::Range[::Integer]) + response_builder: RubyLsp::ResponseBuilders::SemanticHighlighting ).void end - def initialize(dispatcher, response_builder, range: T.unsafe(nil)); end + def initialize(dispatcher, response_builder); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#174 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#124 sig { params(node: ::Prism::BlockLocalVariableNode).void } def on_block_local_variable_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#164 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#114 sig { params(node: ::Prism::BlockNode).void } def on_block_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#169 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#119 sig { params(node: ::Prism::BlockNode).void } def on_block_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#179 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#129 sig { params(node: ::Prism::BlockParameterNode).void } def on_block_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#75 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#66 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#303 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#220 sig { params(node: ::Prism::ClassNode).void } def on_class_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#123 - sig { params(node: ::Prism::ConstantAndWriteNode).void } - def on_constant_and_write_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#130 - sig { params(node: ::Prism::ConstantOperatorWriteNode).void } - def on_constant_operator_write_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#137 - sig { params(node: ::Prism::ConstantOrWriteNode).void } - def on_constant_or_write_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#379 - sig { params(node: ::Prism::ConstantPathNode).void } - def on_constant_path_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#108 - sig { params(node: ::Prism::ConstantReadNode).void } - def on_constant_read_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#144 - sig { params(node: ::Prism::ConstantTargetNode).void } - def on_constant_target_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#116 - sig { params(node: ::Prism::ConstantWriteNode).void } - def on_constant_write_node_enter(node); end - - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#151 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#104 sig { params(node: ::Prism::DefNode).void } def on_def_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#159 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#109 sig { params(node: ::Prism::DefNode).void } def on_def_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#367 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#280 sig { params(node: ::Prism::ImplicitNode).void } def on_implicit_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#374 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#285 sig { params(node: ::Prism::ImplicitNode).void } def on_implicit_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#203 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#145 sig { params(node: ::Prism::KeywordRestParameterNode).void } def on_keyword_rest_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#269 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#191 sig { params(node: ::Prism::LocalVariableAndWriteNode).void } def on_local_variable_and_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#276 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#197 sig { params(node: ::Prism::LocalVariableOperatorWriteNode).void } def on_local_variable_operator_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#283 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#203 sig { params(node: ::Prism::LocalVariableOrWriteNode).void } def on_local_variable_or_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#255 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#178 sig { params(node: ::Prism::LocalVariableReadNode).void } def on_local_variable_read_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#290 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#209 sig { params(node: ::Prism::LocalVariableTargetNode).void } def on_local_variable_target_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#248 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#172 sig { params(node: ::Prism::LocalVariableWriteNode).void } def on_local_variable_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#93 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#89 sig { params(node: ::Prism::MatchWriteNode).void } def on_match_write_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#103 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#99 sig { params(node: ::Prism::MatchWriteNode).void } def on_match_write_node_leave(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#344 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#259 sig { params(node: ::Prism::ModuleNode).void } def on_module_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#194 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#140 sig { params(node: ::Prism::OptionalKeywordParameterNode).void } def on_optional_keyword_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#214 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#151 sig { params(node: ::Prism::OptionalParameterNode).void } def on_optional_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#185 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#135 sig { params(node: ::Prism::RequiredKeywordParameterNode).void } def on_required_keyword_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#222 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#156 sig { params(node: ::Prism::RequiredParameterNode).void } def on_required_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#230 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#161 sig { params(node: ::Prism::RestParameterNode).void } def on_rest_parameter_node_enter(node); end - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#241 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#167 sig { params(node: ::Prism::SelfNode).void } def on_self_node_enter(node); end private - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#396 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#299 sig { params(node: ::Prism::CallNode).void } def process_regexp_locals(node); end # Textmate provides highlighting for a subset of these special Ruby-specific methods. We want to utilize that # highlighting, so we avoid making a semantic token for it. # - # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#391 + # source://ruby-lsp/lib/ruby_lsp/listeners/semantic_highlighting.rb#294 sig { params(method_name: ::String).returns(T::Boolean) } def special_method?(method_name); end end @@ -2792,39 +3215,62 @@ class RubyLsp::Listeners::SignatureHelp global_state: ::RubyLsp::GlobalState, node_context: ::RubyLsp::NodeContext, dispatcher: ::Prism::Dispatcher, - typechecker_enabled: T::Boolean + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel ).void end - def initialize(response_builder, global_state, node_context, dispatcher, typechecker_enabled); end + def initialize(response_builder, global_state, node_context, dispatcher, sorbet_level); end # source://ruby-lsp/lib/ruby_lsp/listeners/signature_help.rb#30 sig { params(node: ::Prism::CallNode).void } def on_call_node_enter(node); end + + private + + # source://ruby-lsp/lib/ruby_lsp/listeners/signature_help.rb#73 + sig do + params( + node: ::Prism::CallNode, + signatures: T::Array[::RubyIndexer::Entry::Signature] + ).returns([::Integer, ::Integer]) + end + def determine_active_signature_and_parameter(node, signatures); end + + # source://ruby-lsp/lib/ruby_lsp/listeners/signature_help.rb#105 + sig do + params( + signatures: T::Array[::RubyIndexer::Entry::Signature], + method_name: ::String, + methods: T::Array[::RubyIndexer::Entry], + title: ::String, + extra_links: T.nilable(::String) + ).returns(T::Array[::LanguageServer::Protocol::Interface::SignatureInformation]) + end + def generate_signatures(signatures, method_name, methods, title, extra_links); end end # A notification to be sent to the client # # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below. # -# source://ruby-lsp/lib/ruby_lsp/utils.rb#30 +# source://ruby-lsp/lib/ruby_lsp/utils.rb#31 class RubyLsp::Message abstract! - # source://ruby-lsp/lib/ruby_lsp/utils.rb#43 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#44 sig { params(method: ::String, params: ::Object).void } def initialize(method:, params:); end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#35 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#36 sig { returns(::String) } def method; end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#38 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#39 sig { returns(::Object) } def params; end # @abstract # - # source://ruby-lsp/lib/ruby_lsp/utils.rb#49 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#50 sig { abstract.returns(T::Hash[::Symbol, T.untyped]) } def to_hash; end end @@ -2834,26 +3280,29 @@ end # # source://ruby-lsp/lib/ruby_lsp/node_context.rb#7 class RubyLsp::NodeContext - # source://ruby-lsp/lib/ruby_lsp/node_context.rb#31 + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#38 sig do params( node: T.nilable(::Prism::Node), parent: T.nilable(::Prism::Node), - nesting: T::Array[::String], - call_node: T.nilable(::Prism::CallNode), - surrounding_method: T.nilable(::String) + nesting_nodes: T::Array[T.any(::Prism::BlockNode, ::Prism::ClassNode, ::Prism::DefNode, ::Prism::LambdaNode, ::Prism::ModuleNode, ::Prism::ProgramNode, ::Prism::SingletonClassNode)], + call_node: T.nilable(::Prism::CallNode) ).void end - def initialize(node, parent, nesting, call_node, surrounding_method); end + def initialize(node, parent, nesting_nodes, call_node); end # source://ruby-lsp/lib/ruby_lsp/node_context.rb#17 sig { returns(T.nilable(::Prism::CallNode)) } def call_node; end - # source://ruby-lsp/lib/ruby_lsp/node_context.rb#40 + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#50 sig { returns(::String) } def fully_qualified_name; end + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#55 + sig { returns(T::Array[::Symbol]) } + def locals_for_scope; end + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#14 sig { returns(T::Array[::String]) } def nesting; end @@ -2870,16 +3319,30 @@ class RubyLsp::NodeContext # source://ruby-lsp/lib/ruby_lsp/node_context.rb#20 sig { returns(T.nilable(::String)) } def surrounding_method; end + + private + + # source://ruby-lsp/lib/ruby_lsp/node_context.rb#83 + sig do + params( + nodes: T::Array[T.any(::Prism::BlockNode, ::Prism::ClassNode, ::Prism::DefNode, ::Prism::LambdaNode, ::Prism::ModuleNode, ::Prism::ProgramNode, ::Prism::SingletonClassNode)] + ).returns([T::Array[::String], T.nilable(::String)]) + end + def handle_nesting_nodes(nodes); end end -# source://ruby-lsp/lib/ruby_lsp/utils.rb#52 +# source://ruby-lsp/lib/ruby_lsp/utils.rb#53 class RubyLsp::Notification < ::RubyLsp::Message - # source://ruby-lsp/lib/ruby_lsp/utils.rb#70 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#80 sig { override.returns(T::Hash[::Symbol, T.untyped]) } def to_hash; end class << self - # source://ruby-lsp/lib/ruby_lsp/utils.rb#56 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#69 + sig { params(message: ::String, type: ::Integer).returns(::RubyLsp::Notification) } + def window_log_message(message, type: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#58 sig { params(message: ::String).returns(::RubyLsp::Notification) } def window_show_error(message); end end @@ -2908,35 +3371,54 @@ class RubyLsp::ParameterScope def type_for(name); end end -# source://ruby-lsp/lib/ruby_lsp/utils.rb#75 +# source://ruby-lsp/lib/ruby_lsp/rbs_document.rb#5 +class RubyLsp::RBSDocument < ::RubyLsp::Document + # source://ruby-lsp/lib/ruby_lsp/rbs_document.rb#12 + sig { params(source: ::String, version: ::Integer, uri: ::URI::Generic, encoding: ::Encoding).void } + def initialize(source:, version:, uri:, encoding: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/rbs_document.rb#37 + sig { override.returns(::RubyLsp::Document::LanguageId) } + def language_id; end + + # source://ruby-lsp/lib/ruby_lsp/rbs_document.rb#18 + sig { override.returns(T.untyped) } + def parse; end + + # source://ruby-lsp/lib/ruby_lsp/rbs_document.rb#32 + sig { override.returns(T::Boolean) } + def syntax_error?; end +end + +# source://ruby-lsp/lib/ruby_lsp/utils.rb#85 class RubyLsp::Request < ::RubyLsp::Message - # source://ruby-lsp/lib/ruby_lsp/utils.rb#79 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#89 sig { params(id: T.any(::Integer, ::String), method: ::String, params: ::Object).void } def initialize(id:, method:, params:); end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#85 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#95 sig { override.returns(T::Hash[::Symbol, T.untyped]) } def to_hash; end end # A request configuration, to turn on/off features # -# source://ruby-lsp/lib/ruby_lsp/utils.rb#137 +# source://ruby-lsp/lib/ruby_lsp/utils.rb#150 class RubyLsp::RequestConfig - # source://ruby-lsp/lib/ruby_lsp/utils.rb#144 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#157 sig { params(configuration: T::Hash[::Symbol, T::Boolean]).void } def initialize(configuration); end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#141 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#154 sig { returns(T::Hash[::Symbol, T::Boolean]) } def configuration; end # @return [Hash{Symbol => Boolean}] # - # source://ruby-lsp/lib/ruby_lsp/utils.rb#141 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#154 def configuration=(_arg0); end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#149 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#162 sig { params(feature: ::Symbol).returns(T.nilable(T::Boolean)) } def enabled?(feature); end end @@ -2987,45 +3469,61 @@ module RubyLsp::Requests; end # # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#24 class RubyLsp::Requests::CodeActionResolve < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#40 - sig { params(document: ::RubyLsp::Document, code_action: T::Hash[::Symbol, T.untyped]).void } + include ::RubyLsp::Requests::Support::Common + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#42 + sig { params(document: RubyLsp::RubyDocument, code_action: T::Hash[::Symbol, T.untyped]).void } def initialize(document, code_action); end - # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#47 + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#49 sig do override .returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) end def perform; end - # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#155 + private + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#268 + sig do + params( + range: T::Hash[::Symbol, T.untyped], + new_text: ::String + ).returns(::LanguageServer::Protocol::Interface::TextEdit) + end + def create_text_edit(range, new_text); end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#279 + sig { params(node: ::Prism::BlockNode, indentation: T.nilable(::String)).returns(::String) } + def recursively_switch_nested_block_styles(node, indentation); end + + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#199 sig do returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) end def refactor_method; end - # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#59 + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#105 sig do returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) end def refactor_variable; end - private + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#308 + sig { params(body: ::Prism::Node, indentation: T.nilable(::String)).returns(::String) } + def switch_block_body(body, indentation); end - # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#212 + # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#67 sig do - params( - range: T::Hash[::Symbol, T.untyped], - new_text: ::String - ).returns(::LanguageServer::Protocol::Interface::TextEdit) + returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error)) end - def create_text_edit(range, new_text); end + def switch_block_style; end end -# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#29 +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#31 class RubyLsp::Requests::CodeActionResolve::CodeActionError < ::StandardError; end -# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#31 +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#33 class RubyLsp::Requests::CodeActionResolve::Error < ::T::Enum enums do EmptySelection = new @@ -3034,10 +3532,10 @@ class RubyLsp::Requests::CodeActionResolve::Error < ::T::Enum end end -# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#27 +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#29 RubyLsp::Requests::CodeActionResolve::NEW_METHOD_NAME = T.let(T.unsafe(nil), String) -# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#26 +# source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#28 RubyLsp::Requests::CodeActionResolve::NEW_VARIABLE_NAME = T.let(T.unsafe(nil), String) # ![Code actions demo](../../code_actions.gif) @@ -3056,23 +3554,23 @@ RubyLsp::Requests::CodeActionResolve::NEW_VARIABLE_NAME = T.let(T.unsafe(nil), S # # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#19 class RubyLsp::Requests::CodeActions < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#41 + # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#45 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), range: T::Hash[::Symbol, T.untyped], context: T::Hash[::Symbol, T.untyped] ).void end def initialize(document, range, context); end - # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#50 + # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#54 sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::CodeAction]))) } def perform; end class << self - # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#29 - sig { returns(::LanguageServer::Protocol::Interface::CodeActionOptions) } + # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#30 + sig { returns(::LanguageServer::Protocol::Interface::CodeActionRegistrationOptions) } def provider; end end end @@ -3083,6 +3581,9 @@ RubyLsp::Requests::CodeActions::EXTRACT_TO_METHOD_TITLE = T.let(T.unsafe(nil), S # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#22 RubyLsp::Requests::CodeActions::EXTRACT_TO_VARIABLE_TITLE = T.let(T.unsafe(nil), String) +# source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#24 +RubyLsp::Requests::CodeActions::TOGGLE_BLOCK_STYLE_TITLE = T.let(T.unsafe(nil), String) + # ![Code lens demo](../../code_lens.gif) # # The @@ -3141,14 +3642,14 @@ class RubyLsp::Requests::Completion < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#56 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), global_state: ::RubyLsp::GlobalState, params: T::Hash[::Symbol, T.untyped], - typechecker_enabled: T::Boolean, + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel, dispatcher: ::Prism::Dispatcher ).void end - def initialize(document, global_state, params, typechecker_enabled, dispatcher); end + def initialize(document, global_state, params, sorbet_level, dispatcher); end # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#109 sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::CompletionItem]) } @@ -3223,23 +3724,29 @@ RubyLsp::Requests::CompletionResolve::MAX_DOCUMENTATION_ENTRIES = T.let(T.unsafe # # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#29 class RubyLsp::Requests::Definition < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#42 + # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#48 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), global_state: ::RubyLsp::GlobalState, position: T::Hash[::Symbol, T.untyped], dispatcher: ::Prism::Dispatcher, - typechecker_enabled: T::Boolean + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel ).void end - def initialize(document, global_state, position, dispatcher, typechecker_enabled); end + def initialize(document, global_state, position, dispatcher, sorbet_level); end - # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#108 - sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::Location]) } + # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#118 + sig do + override + .returns(T::Array[T.any(::LanguageServer::Protocol::Interface::Location, ::LanguageServer::Protocol::Interface::LocationLink)]) + end def perform; end end +# source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#33 +RubyLsp::Requests::Definition::SPECIAL_METHOD_CALLS = T.let(T.unsafe(nil), Array) + # ![Diagnostics demo](../../diagnostics.gif) # # The @@ -3256,27 +3763,27 @@ end # # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#19 class RubyLsp::Requests::Diagnostics < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#35 - sig { params(global_state: ::RubyLsp::GlobalState, document: ::RubyLsp::Document).void } + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#36 + sig { params(global_state: ::RubyLsp::GlobalState, document: RubyLsp::RubyDocument).void } def initialize(global_state, document); end - # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#43 + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#44 sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::Diagnostic]))) } def perform; end private - # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#84 + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#87 sig { returns(T::Array[::LanguageServer::Protocol::Interface::Diagnostic]) } def syntax_error_diagnostics; end - # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#61 + # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#64 sig { returns(T::Array[::LanguageServer::Protocol::Interface::Diagnostic]) } def syntax_warning_diagnostics; end class << self # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#26 - sig { returns(T::Hash[::Symbol, T::Boolean]) } + sig { returns(::LanguageServer::Protocol::Interface::DiagnosticRegistrationOptions) } def provider; end end end @@ -3306,7 +3813,7 @@ class RubyLsp::Requests::DocumentHighlight < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#37 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), position: T::Hash[::Symbol, T.untyped], dispatcher: ::Prism::Dispatcher ).void @@ -3375,17 +3882,17 @@ end # # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#31 class RubyLsp::Requests::DocumentSymbol < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#49 + # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#44 sig { params(uri: ::URI::Generic, dispatcher: ::Prism::Dispatcher).void } def initialize(uri, dispatcher); end - # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#60 + # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#55 sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]) } def perform; end class << self # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#38 - sig { returns(::LanguageServer::Protocol::Interface::DocumentSymbolClientCapabilities) } + sig { returns(::LanguageServer::Protocol::Interface::DocumentSymbolOptions) } def provider; end end end @@ -3405,17 +3912,17 @@ end # # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#20 class RubyLsp::Requests::FoldingRanges < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#33 + # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#37 sig { params(comments: T::Array[::Prism::Comment], dispatcher: ::Prism::Dispatcher).void } def initialize(comments, dispatcher); end - # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#46 + # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#50 sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::FoldingRange]) } def perform; end class << self # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#27 - sig { returns(::LanguageServer::Protocol::Interface::FoldingRangeClientCapabilities) } + sig { returns(::LanguageServer::Protocol::Interface::FoldingRangeRegistrationOptions) } def provider; end end end @@ -3442,13 +3949,19 @@ end # # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#25 class RubyLsp::Requests::Formatting < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#31 - sig { params(global_state: ::RubyLsp::GlobalState, document: ::RubyLsp::Document).void } + # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#44 + sig { params(global_state: ::RubyLsp::GlobalState, document: RubyLsp::RubyDocument).void } def initialize(global_state, document); end - # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#39 + # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#52 sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::TextEdit]))) } def perform; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#34 + sig { returns(::LanguageServer::Protocol::Interface::DocumentFormattingRegistrationOptions) } + def provider; end + end end # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#28 @@ -3474,14 +3987,14 @@ class RubyLsp::Requests::Hover < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#42 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), global_state: ::RubyLsp::GlobalState, position: T::Hash[::Symbol, T.untyped], dispatcher: ::Prism::Dispatcher, - typechecker_enabled: T::Boolean + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel ).void end - def initialize(document, global_state, position, dispatcher, typechecker_enabled); end + def initialize(document, global_state, position, dispatcher, sorbet_level); end # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#77 sig { override.returns(ResponseType) } @@ -3489,7 +4002,7 @@ class RubyLsp::Requests::Hover < ::RubyLsp::Requests::Request class << self # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#26 - sig { returns(::LanguageServer::Protocol::Interface::HoverClientCapabilities) } + sig { returns(::LanguageServer::Protocol::Interface::HoverOptions) } def provider; end end end @@ -3533,7 +4046,7 @@ class RubyLsp::Requests::InlayHints < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#61 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), range: T::Hash[::Symbol, T.untyped], hints_configuration: ::RubyLsp::RequestConfig, dispatcher: ::Prism::Dispatcher @@ -3567,10 +4080,10 @@ end # # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#18 class RubyLsp::Requests::OnTypeFormatting < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#49 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#51 sig do params( - document: ::RubyLsp::Document, + document: RubyLsp::RubyDocument, position: T::Hash[::Symbol, T.untyped], trigger_character: ::String, client_name: ::String @@ -3578,56 +4091,56 @@ class RubyLsp::Requests::OnTypeFormatting < ::RubyLsp::Requests::Request end def initialize(document, position, trigger_character, client_name); end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#64 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#66 sig { override.returns(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::TextEdit])) } def perform; end private - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#167 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#169 sig { params(text: ::String, position: T::Hash[::Symbol, T.untyped]).void } def add_edit_with_text(text, position = T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#214 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#216 sig { void } def auto_indent_after_end_keyword; end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#201 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#203 sig { params(line: ::String).returns(::Integer) } def find_indentation(line); end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#162 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#164 sig { params(spaces: ::String).void } def handle_comment_line(spaces); end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#124 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#126 sig { void } def handle_curly_brace; end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#154 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#156 sig { params(delimiter: ::String).void } def handle_heredoc_end(delimiter); end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#93 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#95 sig { void } def handle_pipe; end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#132 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#134 sig { void } def handle_statement_end; end - # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#180 + # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#182 sig { params(line: ::Integer, character: ::Integer).void } def move_cursor_to(line, character); end class << self # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#25 - sig { returns(::LanguageServer::Protocol::Interface::DocumentOnTypeFormattingOptions) } + sig { returns(::LanguageServer::Protocol::Interface::DocumentOnTypeFormattingRegistrationOptions) } def provider; end end end -# source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#33 +# source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#34 RubyLsp::Requests::OnTypeFormatting::END_REGEXES = T.let(T.unsafe(nil), Array) # ![Prepare type hierarchy demo](../../prepare_type_hierarchy.gif) @@ -3654,7 +4167,7 @@ class RubyLsp::Requests::PrepareTypeHierarchy < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/prepare_type_hierarchy.rb#43 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), index: ::RubyIndexer::Index, position: T::Hash[::Symbol, T.untyped] ).void @@ -3745,11 +4258,11 @@ class RubyLsp::Requests::Request::InvalidFormatter < ::StandardError; end class RubyLsp::Requests::SelectionRanges < ::RubyLsp::Requests::Request include ::RubyLsp::Requests::Support::Common - # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#27 - sig { params(document: ::RubyLsp::Document).void } + # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#28 + sig { params(document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument)).void } def initialize(document); end - # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#35 + # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#36 sig { override.returns(T.all(::Object, T::Array[::RubyLsp::Requests::Support::SelectionRange])) } def perform; end end @@ -3768,26 +4281,58 @@ end # some_invocation # --> semantic highlighting: method invocation # var # --> semantic highlighting: local variable # end +# +# # Strategy +# +# To maximize editor performance, the Ruby LSP will return the minimum number of semantic tokens, since applying +# them is an expensive operation for the client. This means that the server only returns tokens for ambiguous pieces +# of syntax, such as method invocations with no receivers or parenthesis (which can be confused with local +# variables). +# +# Offloading as much handling as possible to Text Mate grammars or equivalent will guarantee responsiveness in the +# editor and allow for a much smoother experience. # ``` # -# source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#23 +# source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#33 class RubyLsp::Requests::SemanticHighlighting < ::RubyLsp::Requests::Request - # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#44 + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#118 sig do params( global_state: ::RubyLsp::GlobalState, dispatcher: ::Prism::Dispatcher, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), + previous_result_id: T.nilable(::String), range: T.nilable(T::Range[::Integer]) ).void end - def initialize(global_state, dispatcher, range: T.unsafe(nil)); end + def initialize(global_state, dispatcher, document, previous_result_id, range: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#58 - sig { override.returns(::LanguageServer::Protocol::Interface::SemanticTokens) } + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#137 + sig do + override + .returns(T.any(::LanguageServer::Protocol::Interface::SemanticTokens, ::LanguageServer::Protocol::Interface::SemanticTokensDelta)) + end def perform; end class << self - # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#30 + # The compute_delta method receives the current semantic tokens and the previous semantic tokens and then tries + # to compute the smallest possible semantic token edit that will turn previous into current + # + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#61 + sig do + params( + current_tokens: T::Array[::Integer], + previous_tokens: T::Array[::Integer], + result_id: ::String + ).returns(::LanguageServer::Protocol::Interface::SemanticTokensDelta) + end + def compute_delta(current_tokens, previous_tokens, result_id); end + + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#99 + sig { returns(::Integer) } + def next_result_id; end + + # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#40 sig { returns(::LanguageServer::Protocol::Interface::SemanticTokensRegistrationOptions) } def provider; end end @@ -3810,16 +4355,16 @@ end # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#20 class RubyLsp::Requests::ShowSyntaxTree < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#24 - sig { params(document: ::RubyLsp::Document, range: T.nilable(T::Hash[::Symbol, T.untyped])).void } + sig { params(document: RubyLsp::RubyDocument, range: T.nilable(T::Hash[::Symbol, T.untyped])).void } def initialize(document, range); end - # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#31 + # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#32 sig { override.returns(::String) } def perform; end private - # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#42 + # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#43 sig { returns(::String) } def ast_for_range; end end @@ -3849,15 +4394,15 @@ class RubyLsp::Requests::SignatureHelp < ::RubyLsp::Requests::Request # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#52 sig do params( - document: ::RubyLsp::Document, + document: T.any(RubyLsp::ERBDocument, RubyLsp::RubyDocument), global_state: ::RubyLsp::GlobalState, position: T::Hash[::Symbol, T.untyped], context: T.nilable(T::Hash[::Symbol, T.untyped]), dispatcher: ::Prism::Dispatcher, - typechecker_enabled: T::Boolean + sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel ).void end - def initialize(document, global_state, position, context, dispatcher, typechecker_enabled); end + def initialize(document, global_state, position, context, dispatcher, sorbet_level); end # source://ruby-lsp/lib/ruby_lsp/requests/signature_help.rb#68 sig { override.returns(T.nilable(::LanguageServer::Protocol::Interface::SignatureHelp)) } @@ -3921,7 +4466,7 @@ end module RubyLsp::Requests::Support::Common requires_ancestor { Kernel } - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#92 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#83 sig do params( title: ::String, @@ -3931,7 +4476,7 @@ module RubyLsp::Requests::Support::Common end def categorized_markdown_from_index_entries(title, entries, max_entries = T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#156 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#151 sig do params( node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantPathTargetNode, ::Prism::ConstantReadNode) @@ -3939,7 +4484,7 @@ module RubyLsp::Requests::Support::Common end def constant_name(node); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#58 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#49 sig do params( node: ::Prism::Node, @@ -3955,29 +4500,30 @@ module RubyLsp::Requests::Support::Common # name. For example, for `Foo::Bar::Baz`, this method will invoke the block with `Foo`, then `Bar` and finally # `Baz`. # - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#181 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#176 sig { params(node: ::Prism::Node, block: T.proc.params(part: ::Prism::Node).void).void } def each_constant_path_part(node, &block); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#191 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#186 sig { params(entry: ::RubyIndexer::Entry).returns(T.nilable(::Integer)) } def kind_for_entry(entry); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#135 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#127 sig do params( title: ::String, entries: T.any(::RubyIndexer::Entry, T::Array[::RubyIndexer::Entry]), - max_entries: T.nilable(::Integer) + max_entries: T.nilable(::Integer), + extra_links: T.nilable(::String) ).returns(::String) end - def markdown_from_index_entries(title, entries, max_entries = T.unsafe(nil)); end + def markdown_from_index_entries(title, entries, max_entries = T.unsafe(nil), extra_links: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#164 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#159 sig { params(node: T.any(::Prism::ClassNode, ::Prism::ModuleNode)).returns(T.nilable(::String)) } def namespace_constant_name(node); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#73 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#64 sig { params(file_path: ::String).returns(T.nilable(T::Boolean)) } def not_in_dependencies?(file_path); end @@ -3993,13 +4539,13 @@ module RubyLsp::Requests::Support::Common sig { params(node: ::Prism::Node).returns(::LanguageServer::Protocol::Interface::Range) } def range_from_node(node); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#80 + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#71 sig { params(node: ::Prism::CallNode).returns(T::Boolean) } def self_receiver?(node); end - # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#41 - sig { params(node: T.nilable(::Prism::Node), range: T.nilable(T::Range[::Integer])).returns(T::Boolean) } - def visible?(node, range); end + # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#204 + sig { params(sorbet_level: ::RubyLsp::RubyDocument::SorbetLevel).returns(T::Boolean) } + def sorbet_level_true_or_higher?(sorbet_level); end end # @abstract Subclasses must implement the `abstract` methods below. @@ -4015,7 +4561,7 @@ module RubyLsp::Requests::Support::Formatter abstract .params( uri: ::URI::Generic, - document: ::RubyLsp::Document + document: RubyLsp::RubyDocument ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::Diagnostic])) end def run_diagnostic(uri, document); end @@ -4023,7 +4569,7 @@ module RubyLsp::Requests::Support::Formatter # @abstract # # source://ruby-lsp/lib/ruby_lsp/requests/support/formatter.rb#14 - sig { abstract.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(T.nilable(::String)) } + sig { abstract.params(uri: ::URI::Generic, document: RubyLsp::RubyDocument).returns(T.nilable(::String)) } def run_formatting(uri, document); end end @@ -4043,7 +4589,7 @@ class RubyLsp::Requests::Support::RuboCopDiagnostic # encoding and file source # # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#35 - sig { params(document: ::RubyLsp::Document, offense: ::RuboCop::Cop::Offense, uri: ::URI::Generic).void } + sig { params(document: RubyLsp::RubyDocument, offense: ::RuboCop::Cop::Offense, uri: ::URI::Generic).void } def initialize(document, offense, uri); end # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#42 @@ -4116,13 +4662,13 @@ class RubyLsp::Requests::Support::RuboCopFormatter override .params( uri: ::URI::Generic, - document: ::RubyLsp::Document + document: RubyLsp::RubyDocument ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::Diagnostic])) end def run_diagnostic(uri, document); end # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatter.rb#21 - sig { override.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(T.nilable(::String)) } + sig { override.params(uri: ::URI::Generic, document: RubyLsp::RubyDocument).returns(T.nilable(::String)) } def run_formatting(uri, document); end end @@ -4136,7 +4682,7 @@ class RubyLsp::Requests::Support::RuboCopRunner < ::RuboCop::Runner sig { returns(::RuboCop::Config) } def config_for_working_directory; end - # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#112 + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#114 sig { returns(::String) } def formatted_source; end @@ -4144,24 +4690,24 @@ class RubyLsp::Requests::Support::RuboCopRunner < ::RuboCop::Runner sig { returns(T::Array[::RuboCop::Cop::Offense]) } def offenses; end - # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#90 + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#92 sig { params(path: ::String, contents: ::String).void } def run(path, contents); end private - # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#138 + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#140 sig { params(_file: ::String, offenses: T::Array[::RuboCop::Cop::Offense]).void } def file_finished(_file, offenses); end class << self - # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#120 + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#122 sig { params(cop_name: ::String).returns(T.nilable(T.class_of(RuboCop::Cop::Base))) } def find_cop_by_name(cop_name); end private - # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#127 + # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#129 sig { returns(T::Hash[::String, [T.class_of(RuboCop::Cop::Base)]]) } def cop_registry; end end @@ -4218,7 +4764,7 @@ class RubyLsp::Requests::TypeHierarchySupertypes < ::RubyLsp::Requests::Request private - # source://ruby-lsp/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb#77 + # source://ruby-lsp/lib/ruby_lsp/requests/type_hierarchy_supertypes.rb#75 sig { params(entry: ::RubyIndexer::Entry).returns(::LanguageServer::Protocol::Interface::TypeHierarchyItem) } def hierarchy_item(entry); end end @@ -4286,7 +4832,7 @@ class RubyLsp::ResponseBuilders::DocumentSymbol < ::RubyLsp::ResponseBuilders::R # @param symbol [Interface::DocumentSymbol] # @return [void] # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 def <<(*args, **_arg1, &blk); end # source://ruby-lsp/lib/ruby_lsp/response_builders/document_symbol.rb#47 @@ -4378,7 +4924,7 @@ class RubyLsp::ResponseBuilders::SemanticHighlighting < ::RubyLsp::ResponseBuild def last_token_matches?(location); end # source://ruby-lsp/lib/ruby_lsp/response_builders/semantic_highlighting.rb#95 - sig { override.returns(::LanguageServer::Protocol::Interface::SemanticTokens) } + sig { override.returns(T::Array[::RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken]) } def response; end end @@ -4444,7 +4990,7 @@ class RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticTokenEncoder sig do params( tokens: T::Array[::RubyLsp::ResponseBuilders::SemanticHighlighting::SemanticToken] - ).returns(::LanguageServer::Protocol::Interface::SemanticTokens) + ).returns(T::Array[::Integer]) end def encode(tokens); end @@ -4488,26 +5034,83 @@ end # The final result of running a request before its IO is finalized # -# source://ruby-lsp/lib/ruby_lsp/utils.rb#118 +# source://ruby-lsp/lib/ruby_lsp/utils.rb#128 class RubyLsp::Result - # source://ruby-lsp/lib/ruby_lsp/utils.rb#125 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#138 sig { params(id: ::Integer, response: T.untyped).void } def initialize(id:, response:); end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#122 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#135 + sig { returns(::Integer) } + def id; end + + # source://ruby-lsp/lib/ruby_lsp/utils.rb#132 sig { returns(T.untyped) } def response; end - # source://ruby-lsp/lib/ruby_lsp/utils.rb#131 + # source://ruby-lsp/lib/ruby_lsp/utils.rb#144 sig { returns(T::Hash[::Symbol, T.untyped]) } def to_hash; end end # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#5 class RubyLsp::RubyDocument < ::RubyLsp::Document - # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#7 - sig { override.returns(::Prism::ParseResult) } + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#138 + sig { override.returns(::RubyLsp::Document::LanguageId) } + def language_id; end + + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#168 + sig do + params( + range: T::Hash[::Symbol, T.untyped], + node_types: T::Array[T.class_of(Prism::Node)] + ).returns(T.nilable(::Prism::Node)) + end + def locate_first_within_range(range, node_types: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#202 + sig do + params( + position: T::Hash[::Symbol, T.untyped], + node_types: T::Array[T.class_of(Prism::Node)] + ).returns(::RubyLsp::NodeContext) + end + def locate_node(position, node_types: T.unsafe(nil)); end + + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#125 + sig { override.returns(T.untyped) } def parse; end + + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#143 + sig { returns(::RubyLsp::RubyDocument::SorbetLevel) } + def sorbet_level; end + + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#133 + sig { override.returns(T::Boolean) } + def syntax_error?; end + + class << self + # source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#31 + sig do + params( + node: ::Prism::Node, + char_position: ::Integer, + node_types: T::Array[T.class_of(Prism::Node)] + ).returns(::RubyLsp::NodeContext) + end + def locate(node, char_position, node_types: T.unsafe(nil)); end + end +end + +# source://ruby-lsp/lib/ruby_lsp/ruby_document.rb#11 +class RubyLsp::RubyDocument::SorbetLevel < ::T::Enum + enums do + False = new + Ignore = new + None = new + Strict = new + True = new + end end # source://ruby-lsp/lib/ruby_lsp/server.rb#5 @@ -4522,7 +5125,7 @@ class RubyLsp::Server < ::RubyLsp::BaseServer sig { returns(::RubyLsp::GlobalState) } def global_state; end - # source://ruby-lsp/lib/ruby_lsp/server.rb#108 + # source://ruby-lsp/lib/ruby_lsp/server.rb#131 sig { void } def load_addons; end @@ -4532,251 +5135,259 @@ class RubyLsp::Server < ::RubyLsp::BaseServer private - # source://ruby-lsp/lib/ruby_lsp/server.rb#769 + # source://ruby-lsp/lib/ruby_lsp/server.rb#961 sig { params(id: ::String, title: ::String, percentage: ::Integer).void } def begin_progress(id, title, percentage: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#830 + # source://ruby-lsp/lib/ruby_lsp/server.rb#1022 sig { void } def check_formatter_is_available; end - # source://ruby-lsp/lib/ruby_lsp/server.rb#505 + # source://ruby-lsp/lib/ruby_lsp/server.rb#655 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def code_action_resolve(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#812 + # source://ruby-lsp/lib/ruby_lsp/server.rb#1004 sig { params(id: ::String).void } def end_progress(id); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#740 - sig { params(config_hash: T::Hash[::String, T.untyped]).void } - def perform_initial_indexing(config_hash); end + # source://ruby-lsp/lib/ruby_lsp/server.rb#931 + sig { void } + def perform_initial_indexing; end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#1039 + sig { params(indexing_options: T.nilable(T::Hash[::Symbol, T.untyped])).void } + def process_indexing_configuration(indexing_options); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#793 + # source://ruby-lsp/lib/ruby_lsp/server.rb#985 sig { params(id: ::String, percentage: ::Integer).void } def progress(id, percentage); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#340 + # source://ruby-lsp/lib/ruby_lsp/server.rb#394 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def run_combined_requests(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#130 + # source://ruby-lsp/lib/ruby_lsp/server.rb#166 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def run_initialize(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#242 + # source://ruby-lsp/lib/ruby_lsp/server.rb#282 sig { void } def run_initialized; end - # source://ruby-lsp/lib/ruby_lsp/server.rb#735 + # source://ruby-lsp/lib/ruby_lsp/server.rb#926 sig { override.void } def shutdown; end - # source://ruby-lsp/lib/ruby_lsp/server.rb#488 + # source://ruby-lsp/lib/ruby_lsp/server.rb#608 + sig { params(document: RubyLsp::Document[T.untyped]).returns(::RubyLsp::RubyDocument::SorbetLevel) } + def sorbet_level(document); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#633 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_code_action(message); end # @param message [Hash{Symbol => T.untyped}] # @return [void] # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 def text_document_code_lens(*args, **_arg1, &blk); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#564 + # source://ruby-lsp/lib/ruby_lsp/server.rb#725 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_completion(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#584 + # source://ruby-lsp/lib/ruby_lsp/server.rb#750 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_completion_item_resolve(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#613 + # source://ruby-lsp/lib/ruby_lsp/server.rb#784 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_definition(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#535 + # source://ruby-lsp/lib/ruby_lsp/server.rb#691 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_diagnostic(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#309 + # source://ruby-lsp/lib/ruby_lsp/server.rb#358 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_did_change(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#293 + # source://ruby-lsp/lib/ruby_lsp/server.rb#342 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_did_close(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#280 + # source://ruby-lsp/lib/ruby_lsp/server.rb#306 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_did_open(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#425 + # source://ruby-lsp/lib/ruby_lsp/server.rb#544 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_document_highlight(message); end # @param message [Hash{Symbol => T.untyped}] # @return [void] # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 def text_document_document_link(*args, **_arg1, &blk); end # @param message [Hash{Symbol => T.untyped}] # @return [void] # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 def text_document_document_symbol(*args, **_arg1, &blk); end # @param message [Hash{Symbol => T.untyped}] # @return [void] # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 + # source://sorbet-runtime/0.5.11553lib/types/private/methods/_methods.rb#257 def text_document_folding_range(*args, **_arg1, &blk); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#398 + # source://ruby-lsp/lib/ruby_lsp/server.rb#511 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_formatting(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#452 + # source://ruby-lsp/lib/ruby_lsp/server.rb#583 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_hover(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#477 + # source://ruby-lsp/lib/ruby_lsp/server.rb#616 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_inlay_hint(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#435 + # source://ruby-lsp/lib/ruby_lsp/server.rb#560 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_on_type_formatting(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#685 + # source://ruby-lsp/lib/ruby_lsp/server.rb#868 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_prepare_type_hierarchy(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#319 + # source://ruby-lsp/lib/ruby_lsp/server.rb#368 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_selection_range(message); end - # @param message [Hash{Symbol => T.untyped}] - # @return [void] - # - # source://sorbet-runtime/0.5.11435lib/types/private/methods/_methods.rb#257 - def text_document_semantic_tokens_full(*args, **_arg1, &blk); end + # source://ruby-lsp/lib/ruby_lsp/server.rb#457 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_semantic_tokens_delta(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#381 + # source://ruby-lsp/lib/ruby_lsp/server.rb#436 + sig { params(message: T::Hash[::Symbol, T.untyped]).void } + def text_document_semantic_tokens_full(message); end + + # source://ruby-lsp/lib/ruby_lsp/server.rb#482 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_semantic_tokens_range(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#673 + # source://ruby-lsp/lib/ruby_lsp/server.rb#849 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_show_syntax_tree(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#592 + # source://ruby-lsp/lib/ruby_lsp/server.rb#758 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def text_document_signature_help(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#705 + # source://ruby-lsp/lib/ruby_lsp/server.rb#896 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def type_hierarchy_subtypes(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#696 + # source://ruby-lsp/lib/ruby_lsp/server.rb#887 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def type_hierarchy_supertypes(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#472 - sig { params(document: ::RubyLsp::Document).returns(T::Boolean) } - def typechecker_enabled?(document); end - - # source://ruby-lsp/lib/ruby_lsp/server.rb#712 + # source://ruby-lsp/lib/ruby_lsp/server.rb#903 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def workspace_dependencies(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#633 + # source://ruby-lsp/lib/ruby_lsp/server.rb#809 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def workspace_did_change_watched_files(message); end - # source://ruby-lsp/lib/ruby_lsp/server.rb#660 + # source://ruby-lsp/lib/ruby_lsp/server.rb#836 sig { params(message: T::Hash[::Symbol, T.untyped]).void } def workspace_symbol(message); end end # source://ruby-lsp/lib/ruby_lsp/store.rb#5 class RubyLsp::Store - # source://ruby-lsp/lib/ruby_lsp/store.rb#21 + # source://ruby-lsp/lib/ruby_lsp/store.rb#20 sig { void } def initialize; end - # source://ruby-lsp/lib/ruby_lsp/store.rb#82 + # source://ruby-lsp/lib/ruby_lsp/store.rb#110 sig do type_parameters(:T) .params( uri: ::URI::Generic, request_name: ::String, - block: T.proc.params(document: ::RubyLsp::Document).returns(T.type_parameter(:T)) + block: T.proc.params(document: RubyLsp::Document[T.untyped]).returns(T.type_parameter(:T)) ).returns(T.type_parameter(:T)) end def cache_fetch(uri, request_name, &block); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#60 + # source://ruby-lsp/lib/ruby_lsp/store.rb#88 sig { void } def clear; end - # source://ruby-lsp/lib/ruby_lsp/store.rb#18 + # source://ruby-lsp/lib/ruby_lsp/store.rb#17 sig { returns(::String) } def client_name; end # @return [String] # - # source://ruby-lsp/lib/ruby_lsp/store.rb#18 + # source://ruby-lsp/lib/ruby_lsp/store.rb#17 def client_name=(_arg0); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#70 + # source://ruby-lsp/lib/ruby_lsp/store.rb#98 sig { params(uri: ::URI::Generic).void } def delete(uri); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#65 + # source://ruby-lsp/lib/ruby_lsp/store.rb#93 sig { returns(T::Boolean) } def empty?; end - # source://ruby-lsp/lib/ruby_lsp/store.rb#12 - sig { returns(T::Boolean) } - def experimental_features; end - - # @return [Boolean] - # - # source://ruby-lsp/lib/ruby_lsp/store.rb#12 - def experimental_features=(_arg0); end - - # source://ruby-lsp/lib/ruby_lsp/store.rb#15 + # source://ruby-lsp/lib/ruby_lsp/store.rb#14 sig { returns(T::Hash[::Symbol, ::RubyLsp::RequestConfig]) } def features_configuration; end # @return [Hash{Symbol => RequestConfig}] # - # source://ruby-lsp/lib/ruby_lsp/store.rb#15 + # source://ruby-lsp/lib/ruby_lsp/store.rb#14 def features_configuration=(_arg0); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#39 - sig { params(uri: ::URI::Generic).returns(::RubyLsp::Document) } + # source://ruby-lsp/lib/ruby_lsp/store.rb#37 + sig { params(uri: ::URI::Generic).returns(RubyLsp::Document[T.untyped]) } def get(uri); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#55 + # source://ruby-lsp/lib/ruby_lsp/store.rb#83 sig { params(uri: ::URI::Generic, edits: T::Array[T::Hash[::Symbol, T.untyped]], version: ::Integer).void } def push_edits(uri:, edits:, version:); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#49 - sig { params(uri: ::URI::Generic, source: ::String, version: ::Integer, encoding: ::Encoding).void } - def set(uri:, source:, version:, encoding: T.unsafe(nil)); end + # source://ruby-lsp/lib/ruby_lsp/store.rb#71 + sig do + params( + uri: ::URI::Generic, + source: ::String, + version: ::Integer, + language_id: ::RubyLsp::Document::LanguageId, + encoding: ::Encoding + ).returns(RubyLsp::Document[T.untyped]) + end + def set(uri:, source:, version:, language_id:, encoding: T.unsafe(nil)); end - # source://ruby-lsp/lib/ruby_lsp/store.rb#9 + # source://ruby-lsp/lib/ruby_lsp/store.rb#11 sig { returns(T::Boolean) } def supports_progress; end # @return [Boolean] # - # source://ruby-lsp/lib/ruby_lsp/store.rb#9 + # source://ruby-lsp/lib/ruby_lsp/store.rb#11 def supports_progress=(_arg0); end end +# source://ruby-lsp/lib/ruby_lsp/store.rb#8 +class RubyLsp::Store::NonExistingDocumentError < ::StandardError; end + # source://ruby-lsp/lib/ruby_lsp/utils.rb#8 RubyLsp::Transport = LanguageServer::Protocol::Transport @@ -4785,37 +5396,62 @@ RubyLsp::Transport = LanguageServer::Protocol::Transport # # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#7 class RubyLsp::TypeInferrer + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#14 + sig { params(index: ::RubyIndexer::Index, experimental_features: T::Boolean).void } + def initialize(index, experimental_features = T.unsafe(nil)); end + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#11 - sig { params(index: ::RubyIndexer::Index).void } - def initialize(index); end + sig { params(experimental_features: T::Boolean).returns(T::Boolean) } + def experimental_features=(experimental_features); end - # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#16 - sig { params(node_context: ::RubyLsp::NodeContext).returns(T.nilable(::String)) } + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#20 + sig { params(node_context: ::RubyLsp::NodeContext).returns(T.nilable(::RubyLsp::TypeInferrer::Type)) } def infer_receiver_type(node_context); end private - # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#79 + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#136 sig { params(node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantReadNode)).returns(T.nilable(::String)) } def constant_name(node); end - # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#39 - sig { params(node: ::Prism::CallNode, node_context: ::RubyLsp::NodeContext).returns(T.nilable(::String)) } + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#36 + sig do + params( + node: ::Prism::CallNode, + node_context: ::RubyLsp::NodeContext + ).returns(T.nilable(::RubyLsp::TypeInferrer::Type)) + end def infer_receiver_for_call_node(node, node_context); end + + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#116 + sig { params(node_context: ::RubyLsp::NodeContext).returns(::RubyLsp::TypeInferrer::Type) } + def self_receiver_handling(node_context); end end -# source://ruby-lsp/lib/ruby-lsp.rb#5 -RubyLsp::VERSION = T.let(T.unsafe(nil), String) +# A type that was guessed based on the receiver raw name +# +# source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#157 +class RubyLsp::TypeInferrer::GuessedType < ::RubyLsp::TypeInferrer::Type; end -# source://ruby-lsp/lib/core_ext/uri.rb#4 -module URI - include ::URI::RFC2396_REGEXP +# A known type +# +# source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#144 +class RubyLsp::TypeInferrer::Type + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#151 + sig { params(name: ::String).void } + def initialize(name); end + + # source://ruby-lsp/lib/ruby_lsp/type_inferrer.rb#148 + sig { returns(::String) } + def name; end end +# source://ruby-lsp/lib/ruby-lsp.rb#5 +RubyLsp::VERSION = T.let(T.unsafe(nil), String) + # source://ruby-lsp/lib/core_ext/uri.rb#5 class URI::Generic include ::URI::RFC2396_REGEXP - include ::URI end # Must be kept in sync with the one in Tapioca @@ -4826,14 +5462,14 @@ class URI::Source < ::URI::File sig { params(v: T.nilable(::String)).returns(T::Boolean) } def check_host(v); end - # source://uri/0.13.0lib/uri/generic.rb#243 + # source://uri/0.13.0uri/generic.rb#243 def gem_name; end # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#26 sig { returns(T.nilable(::String)) } def gem_version; end - # source://uri/0.13.0lib/uri/generic.rb#283 + # source://uri/0.13.0uri/generic.rb#283 def line_number; end # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#52 @@ -4860,5 +5496,3 @@ end # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#11 URI::Source::COMPONENT = T.let(T.unsafe(nil), Array) - -class URI::WSS < ::URI::WS; end diff --git a/sorbet/tapioca/require.rb b/sorbet/tapioca/require.rb index 63543b536..e8c64c4f2 100644 --- a/sorbet/tapioca/require.rb +++ b/sorbet/tapioca/require.rb @@ -10,3 +10,4 @@ require "rake/testtask" require "rubocop/rake_task" require "zeitwerk" +require "ruby_lsp/ruby_lsp_rails/addon" From 921454cf31f74116e1156c7b32561c1c1fefed8e Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:40:31 -0400 Subject: [PATCH 25/30] wip --- lib/ruby_lsp/tapioca/addon.rb | 20 ++++++++++++-------- lib/ruby_lsp/tapioca/server_addon.rb | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 14f84ab0b..6ba69e77d 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -10,8 +10,6 @@ require "tapioca/internal" -# bug? saving file before rails boots causes crash - # require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon # TODO: Use async pattern in Rails addo @@ -24,16 +22,22 @@ class Addon < ::RubyLsp::Addon def initialize super @index = T.let(nil, T.nilable(RubyIndexer::Index)) - @rails_addon = T.let(nil, T.nilable(::RubyLsp::Rails::Addon)) end def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") @index = global_state.index @global_state = global_state - addon = T.cast(::RubyLsp::Addon.get("Ruby LSP Rails"), T.nilable(::RubyLsp::Rails::Addon)) - @rails_addon = addon - T.must(@rails_addon).rails_runner_client.register_server_addon(File.expand_path("server_addon.rb", __dir__)) + addon = T.cast(::RubyLsp::Addon.get("Ruby LSP Rails"), ::RubyLsp::Rails::Addon) + + Thread.new do + @rails_runner_client = T.let( + addon.rails_runner_client, + T.nilable(RubyLsp::Rails::RunnerClient), + ) + $stderr.puts("nil client? #{@rails_runner_client.nil?}") + T.must(@rails_runner_client).register_server_addon(File.expand_path("server_addon.rb", __dir__)) + end rescue AddonNotFoundError $stderr.puts("Tapioca LSP: The LSP will not be available as the Ruby LSP Rails addon was not found") end @@ -62,9 +66,9 @@ def workspace_did_change_watched_files(changes) $stderr.puts "Tapioca LSP: Making DSL request with constants #{constants}" # @rails_addon.rails_runner_client.make_request("tapioca.dsl", constants: constants) if constants.any? # execute("tapioca.dsl", constants: constants) if constants.any? - client = T.must(@rails_addon).rails_runner_client - client.send_notification( + @rails_runner_client&.send_notification( "server_addon/delegate", + request_name: "tapioca.dsl", # change? server_addon_name: "Tapioca", constants: constants, ) if constants.any? diff --git a/lib/ruby_lsp/tapioca/server_addon.rb b/lib/ruby_lsp/tapioca/server_addon.rb index 1bf53eb70..423225f59 100644 --- a/lib/ruby_lsp/tapioca/server_addon.rb +++ b/lib/ruby_lsp/tapioca/server_addon.rb @@ -11,17 +11,17 @@ def name end def execute(request, params) - $stderr.puts("Tapioca DSL execute") case request when "tapioca.dsl" # TODO: remove tapioca. prefix dsl(params) end + rescue => e + File.write("tapioca.txt", "rescue\n#{e.full_message}", mode: "a") end private def dsl(params) - $stderr.puts("dsl...") command = ::Tapioca::Commands::DslGenerate.new( requested_constants: params[:constants], tapioca_path: ::Tapioca::TAPIOCA_DIR, From 263a01fa665ce189edc548dba5f15ef1fbc02a40 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:52:23 -0400 Subject: [PATCH 26/30] wip --- lib/ruby_lsp/tapioca/addon.rb | 17 +++++++---------- lib/ruby_lsp/tapioca/server_addon.rb | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 6ba69e77d..671176242 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -31,11 +31,7 @@ def activate(global_state, outgoing_queue) addon = T.cast(::RubyLsp::Addon.get("Ruby LSP Rails"), ::RubyLsp::Rails::Addon) Thread.new do - @rails_runner_client = T.let( - addon.rails_runner_client, - T.nilable(RubyLsp::Rails::RunnerClient), - ) - $stderr.puts("nil client? #{@rails_runner_client.nil?}") + @rails_runner_client = T.let(addon.rails_runner_client, T.nilable(RubyLsp::Rails::RunnerClient)) T.must(@rails_runner_client).register_server_addon(File.expand_path("server_addon.rb", __dir__)) end rescue AddonNotFoundError @@ -62,16 +58,17 @@ def workspace_did_change_watched_files(changes) entries.grep_v(RubyIndexer::Entry::SingletonClass).map(&:name) end.flatten - # TODO: `tapioca/dsl` instead? + return if constants.empty? + $stderr.puts "Tapioca LSP: Making DSL request with constants #{constants}" - # @rails_addon.rails_runner_client.make_request("tapioca.dsl", constants: constants) if constants.any? - # execute("tapioca.dsl", constants: constants) if constants.any? + + # @rails_runner_client may be nil while booting @rails_runner_client&.send_notification( "server_addon/delegate", - request_name: "tapioca.dsl", # change? + request_name: "dsl", server_addon_name: "Tapioca", constants: constants, - ) if constants.any? + ) end end end diff --git a/lib/ruby_lsp/tapioca/server_addon.rb b/lib/ruby_lsp/tapioca/server_addon.rb index 423225f59..d8bd6ae74 100644 --- a/lib/ruby_lsp/tapioca/server_addon.rb +++ b/lib/ruby_lsp/tapioca/server_addon.rb @@ -12,7 +12,7 @@ def name def execute(request, params) case request - when "tapioca.dsl" # TODO: remove tapioca. prefix + when "dsl" dsl(params) end rescue => e From 5969eae3d36faa63ec83956fd137fc21822718d0 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:50:46 -0400 Subject: [PATCH 27/30] Output warning if runner client not available yet --- lib/ruby_lsp/tapioca/addon.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index 671176242..e43a51d4e 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -49,6 +49,11 @@ def name sig { params(changes: T::Array[{ uri: String, type: Integer }]).void } def workspace_did_change_watched_files(changes) + unless @rails_runner_client + $stderr.puts "Tapioca LSP: Rails runner client not available yet, skipping request" + return + end + constants = changes.filter_map do |change| path = change[:uri].gsub("file://", "") @@ -62,8 +67,7 @@ def workspace_did_change_watched_files(changes) $stderr.puts "Tapioca LSP: Making DSL request with constants #{constants}" - # @rails_runner_client may be nil while booting - @rails_runner_client&.send_notification( + @rails_runner_client.send_notification( "server_addon/delegate", request_name: "dsl", server_addon_name: "Tapioca", From bfdcc93c650f2ef808d5bcb3de1feea2a92b119c Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:38:33 -0400 Subject: [PATCH 28/30] Cleanup --- lib/ruby_lsp/tapioca/addon.rb | 6 +----- lib/ruby_lsp/tapioca/server_addon.rb | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/ruby_lsp/tapioca/addon.rb b/lib/ruby_lsp/tapioca/addon.rb index e43a51d4e..a4da531eb 100644 --- a/lib/ruby_lsp/tapioca/addon.rb +++ b/lib/ruby_lsp/tapioca/addon.rb @@ -10,10 +10,6 @@ require "tapioca/internal" -# require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon - -# TODO: Use async pattern in Rails addo - module RubyLsp module Tapioca class Addon < ::RubyLsp::Addon @@ -26,8 +22,8 @@ def initialize def activate(global_state, outgoing_queue) $stderr.puts("Activating Tapioca LSP addon v#{VERSION}") - @index = global_state.index @global_state = global_state + @index = global_state.index addon = T.cast(::RubyLsp::Addon.get("Ruby LSP Rails"), ::RubyLsp::Rails::Addon) Thread.new do diff --git a/lib/ruby_lsp/tapioca/server_addon.rb b/lib/ruby_lsp/tapioca/server_addon.rb index d8bd6ae74..5e7146da1 100644 --- a/lib/ruby_lsp/tapioca/server_addon.rb +++ b/lib/ruby_lsp/tapioca/server_addon.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "tapioca/internal" -# require "ruby_lsp/ruby_lsp_rails/server" # for ServerAddon module RubyLsp module Tapioca From cf6399182a2f91b17e39fbae90b28eb8f3413006 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:38:41 -0400 Subject: [PATCH 29/30] Rename log file --- lib/ruby_lsp/tapioca/server_addon.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ruby_lsp/tapioca/server_addon.rb b/lib/ruby_lsp/tapioca/server_addon.rb index 5e7146da1..f62aeb3f8 100644 --- a/lib/ruby_lsp/tapioca/server_addon.rb +++ b/lib/ruby_lsp/tapioca/server_addon.rb @@ -15,7 +15,7 @@ def execute(request, params) dsl(params) end rescue => e - File.write("tapioca.txt", "rescue\n#{e.full_message}", mode: "a") + File.write("tapioca_lsp.log", "#{Time.now} #{e.full_message}", mode: "a") end private From 34f8c486f8302ab18d215e1a31fb1d0f3b851c81 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 2 Oct 2024 09:59:47 -0400 Subject: [PATCH 30/30] Use latest ruby-lsp-rails --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index f31d7c4f5..9f400368d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,13 +8,13 @@ GIT PATH remote: ../ruby-lsp-rails specs: - ruby-lsp-rails (0.3.14) - ruby-lsp (>= 0.17.12, < 0.18.0) + ruby-lsp-rails (0.3.16) + ruby-lsp (>= 0.18.0, < 0.19.0) PATH remote: ../ruby-lsp specs: - ruby-lsp (0.17.18) + ruby-lsp (0.18.4) language_server-protocol (~> 3.17.0) prism (~> 1.0) rbs (>= 3, < 4)