Sha256: 6d8b7d717a45c290a56c25da1cb2740de085a4d2aa1df39c3bb6744c88839f10

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # Params for the CodeActionRequest
      #
      class CodeActionParams
        def initialize(text_document:, range:, context:)
          @attributes = {}

          @attributes[:textDocument] = text_document
          @attributes[:range] = range
          @attributes[:context] = context

          @attributes.freeze
        end

        #
        # The document in which the command was invoked.
        #
        # @return [TextDocumentIdentifier]
        def text_document
          attributes.fetch(:textDocument)
        end

        #
        # The range for which the command was invoked.
        #
        # @return [Range]
        def range
          attributes.fetch(:range)
        end

        #
        # Context carrying additional information.
        #
        # @return [CodeActionContext]
        def context
          attributes.fetch(:context)
        end

        attr_reader :attributes

        def to_json(*args)
          attributes.to_json(*args)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-0.4.0 lib/language_server/protocol/interface/code_action_params.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/code_action_params.rb