Sha256: 1973ffeed9ee3451adcc48cf3023ac8b017cad16c47d9d36bc50c4702d19d4e2

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 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_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/workspace_edit.rb
language_server-protocol-0.3.0 lib/language_server/protocol/interface/workspace_edit.rb