Sha256: 5f6de851dd5c086eeaedc4a8549a8db56deeee40a6c222c11d242a6f409afe44

Contents?: true

Size: 1.46 KB

Versions: 103

Compression:

Stored size: 1.46 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # Rename file operation
      #
      class RenameFile
        def initialize(kind:, old_uri:, new_uri:, options: nil, annotation_id: nil)
          @attributes = {}

          @attributes[:kind] = kind
          @attributes[:oldUri] = old_uri
          @attributes[:newUri] = new_uri
          @attributes[:options] = options if options
          @attributes[:annotationId] = annotation_id if annotation_id

          @attributes.freeze
        end

        #
        # A rename
        #
        # @return ["rename"]
        def kind
          attributes.fetch(:kind)
        end

        #
        # The old (existing) location.
        #
        # @return [string]
        def old_uri
          attributes.fetch(:oldUri)
        end

        #
        # The new location.
        #
        # @return [string]
        def new_uri
          attributes.fetch(:newUri)
        end

        #
        # Rename options.
        #
        # @return [RenameFileOptions]
        def options
          attributes.fetch(:options)
        end

        #
        # An optional annotation identifier describing the operation.
        #
        # @return [string]
        def annotation_id
          attributes.fetch(:annotationId)
        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

103 entries across 103 versions & 13 rubygems

Version Path
language_server-protocol-3.17.0.3 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.17.0.2 lib/language_server/protocol/interface/rename_file.rb
language_server-protocol-3.17.0.1 lib/language_server/protocol/interface/rename_file.rb