Sha256: 71aac219c3deafb82fe71704dd3e3b9231dbb6fa90c671e9b30f3d71403f8277

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class WorkspaceEdit
        def initialize(changes: nil, document_changes: nil)
          @attributes = {}

          @attributes[:changes] = changes if changes
          @attributes[:documentChanges] = document_changes if document_changes

          @attributes.freeze
        end

        #
        # Holds changes to existing resources.
        #
        # @return [{ [uri: string]: TextEdit[]; }]
        def changes
          attributes.fetch(:changes)
        end

        #
        # An array of `TextDocumentEdit`s to express changes to specific a specific
        # version of a text document. Whether a client supports versioned document
        # edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`.
        #
        # @return [TextDocumentEdit[]]
        def document_changes
          attributes.fetch(:documentChanges)
        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

1 entries across 1 versions & 1 rubygems

Version Path
language_server-protocol-0.5.0 lib/language_server/protocol/interface/workspace_edit.rb