Sha256: bcf765a28b5088761c77ba705f6bf35ad57a60190715ca749a2c03c72924d4c6

Contents?: true

Size: 1.63 KB

Versions: 13

Compression:

Stored size: 1.63 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)

  # 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

13 entries across 13 versions & 2 rubygems

Version Path
study_line-0.1.6 vendor/bundle/ruby/3.2.0/gems/ruby-lsp-0.12.1/lib/ruby_lsp/utils.rb
study_line-0.1.5 vendor/bundle/ruby/3.2.0/gems/ruby-lsp-0.12.1/lib/ruby_lsp/utils.rb
study_line-0.1.4 vendor/bundle/ruby/3.2.0/gems/ruby-lsp-0.12.1/lib/ruby_lsp/utils.rb
study_line-0.1.3 vendor/bundle/ruby/3.2.0/gems/ruby-lsp-0.12.1/lib/ruby_lsp/utils.rb
study_line-0.1.2 vendor/bundle/ruby/3.2.0/gems/ruby-lsp-0.12.1/lib/ruby_lsp/utils.rb
study_line-0.1.1 vendor/bundle/ruby/3.2.0/gems/ruby-lsp-0.12.1/lib/ruby_lsp/utils.rb
ruby-lsp-0.12.3 lib/ruby_lsp/utils.rb
ruby-lsp-0.12.2 lib/ruby_lsp/utils.rb
ruby-lsp-0.12.1 lib/ruby_lsp/utils.rb
ruby-lsp-0.12.0 lib/ruby_lsp/utils.rb
ruby-lsp-0.11.2 lib/ruby_lsp/utils.rb
ruby-lsp-0.11.1 lib/ruby_lsp/utils.rb
ruby-lsp-0.11.0 lib/ruby_lsp/utils.rb