Sha256: 7d46a07c5c0e2cdd757cee42ff2a059d78d3b2364b34161e0396f61162135e6f

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class ApplyWorkspaceEditResponse
        def initialize(applied:, failure_reason: nil, failed_change: nil)
          @attributes = {}

          @attributes[:applied] = applied
          @attributes[:failureReason] = failure_reason if failure_reason
          @attributes[:failedChange] = failed_change if failed_change

          @attributes.freeze
        end

        #
        # Indicates whether the edit was applied or not.
        #
        # @return [boolean]
        def applied
          attributes.fetch(:applied)
        end

        #
        # An optional textual description for why the edit was not applied.
        # This may be used by the server for diagnostic logging or to provide
        # a suitable error for a request that triggered the edit.
        #
        # @return [string]
        def failure_reason
          attributes.fetch(:failureReason)
        end

        #
        # Depending on the client's failure handling strategy `failedChange`
        # might contain the index of the change that failed. This property is
        # only available if the client signals a `failureHandlingStrategy`
        # in its client capabilities.
        #
        # @return [number]
        def failed_change
          attributes.fetch(:failedChange)
        end

        attr_reader :attributes

        def to_hash
          attributes
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
language_server-protocol-3.16.0.3 lib/language_server/protocol/interface/apply_workspace_edit_response.rb
language_server-protocol-3.16.0.2 lib/language_server/protocol/interface/apply_workspace_edit_response.rb
language_server-protocol-3.16.0.1 lib/language_server/protocol/interface/apply_workspace_edit_response.rb
language_server-protocol-3.16.0.0 lib/language_server/protocol/interface/apply_workspace_edit_response.rb