Sha256: 5e50f04293538297a0485f2bb0ba4067ee25be7c8f1d14bd5e328558e84bf329

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      class LinkedEditingRanges
        def initialize(ranges:, word_pattern: nil)
          @attributes = {}

          @attributes[:ranges] = ranges
          @attributes[:wordPattern] = word_pattern if word_pattern

          @attributes.freeze
        end

        #
        # A list of ranges that can be renamed together. The ranges must have
        # identical length and contain identical text content. The ranges cannot overlap.
        #
        # @return [Range[]]
        def ranges
          attributes.fetch(:ranges)
        end

        #
        # An optional word pattern (regular expression) that describes valid contents for
        # the given ranges. If no pattern is provided, the client configuration's word
        # pattern will be used.
        #
        # @return [string]
        def word_pattern
          attributes.fetch(:wordPattern)
        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

4 entries across 4 versions & 1 rubygems

Version Path
language_server-protocol-3.16.0.3 lib/language_server/protocol/interface/linked_editing_ranges.rb
language_server-protocol-3.16.0.2 lib/language_server/protocol/interface/linked_editing_ranges.rb
language_server-protocol-3.16.0.1 lib/language_server/protocol/interface/linked_editing_ranges.rb
language_server-protocol-3.16.0.0 lib/language_server/protocol/interface/linked_editing_ranges.rb