Sha256: 8425cea3bf36baeefec95e663e0c275d598cfd6980273871d6bd288f4a30cbb5

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 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 n different text documents
        # where each text document edit addresses a specific version of a text document.
        # Whether a client supports versioned document edits is expressed via
        # `WorkspaceClientCapabilities.workspaceEdit.documentChanges`.
        #
        # @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

2 entries across 2 versions & 1 rubygems

Version Path
language_server-protocol-3.12.0.0 lib/language_server/protocol/interface/workspace_edit.rb
language_server-protocol-3.7.0.0 lib/language_server/protocol/interface/workspace_edit.rb