Sha256: 23fbcf5d19013830d7c29a3d73f49d2bfd756043f2519f739451114a6915ab38
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
# typed: strict # frozen_string_literal: true module RubyLsp # Used to indicate that a request shouldn't return a response VOID = T.let(Object.new.freeze, Object) # This freeze is not redundant since the interpolated string is mutable WORKSPACE_URI = T.let(URI::Generic.from_path(path: Dir.pwd), URI::Generic) BUNDLE_PATH = T.let( begin Bundler.bundle_path.to_s rescue Bundler::GemfileNotFound nil end, T.nilable(String), ) # A notification to be sent to the client class Message extend T::Sig extend T::Helpers abstract! sig { returns(String) } attr_reader :message sig { returns(Object) } attr_reader :params sig { params(message: String, params: Object).void } def initialize(message:, params:) @message = message @params = params end end class Notification < Message; end class Request < Message; end # The final result of running a request before its IO is finalized class Result extend T::Sig sig { returns(T.untyped) } attr_reader :response sig { returns(T.nilable(Exception)) } attr_reader :error sig { params(response: T.untyped, error: T.nilable(Exception)).void } def initialize(response:, error: nil) @response = response @error = error end end # A request that will sit in the queue until it's executed class Job extend T::Sig sig { returns(T::Hash[Symbol, T.untyped]) } attr_reader :request sig { returns(T::Boolean) } attr_reader :cancelled sig { params(request: T::Hash[Symbol, T.untyped], cancelled: T::Boolean).void } def initialize(request:, cancelled:) @request = request @cancelled = cancelled end sig { void } def cancel @cancelled = true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-lsp-0.12.5 | lib/ruby_lsp/utils.rb |
ruby-lsp-0.12.4 | lib/ruby_lsp/utils.rb |