Sha256: e0e9be4a019bf5c1092d54c95ec46e8a44b50c3b1a6db05f5a399572d59c5fab

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class WorkspaceEditClientCapabilities
        def initialize(document_changes: nil, resource_operations: nil, failure_handling: nil)
          @attributes = {}

          @attributes[:documentChanges] = document_changes if document_changes
          @attributes[:resourceOperations] = resource_operations if resource_operations
          @attributes[:failureHandling] = failure_handling if failure_handling

          @attributes.freeze
        end

        #
        # The client supports versioned document changes in `WorkspaceEdit`s
        #
        # @return [boolean]
        def document_changes
          attributes.fetch(:documentChanges)
        end

        #
        # The resource operations the client supports. Clients should at least
        # support 'create', 'rename' and 'delete' files and folders.
        #
        # @return [ResourceOperationKind[]]
        def resource_operations
          attributes.fetch(:resourceOperations)
        end

        #
        # The failure handling strategy of a client if applying the workspace edit
        # fails.
        #
        # @return [FailureHandlingKind]
        def failure_handling
          attributes.fetch(:failureHandling)
        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

3 entries across 3 versions & 1 rubygems

Version Path
language_server-protocol-3.15.0.2 lib/language_server/protocol/interface/workspace_edit_client_capabilities.rb
language_server-protocol-3.15.0.1 lib/language_server/protocol/interface/workspace_edit_client_capabilities.rb
language_server-protocol-3.15.0.0 lib/language_server/protocol/interface/workspace_edit_client_capabilities.rb