Sha256: d0b17bf780886166216b4586e9badce968e222949d1a23bedacd39a2c10a1540

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

module LanguageServer
  module Protocol
    module Interface
      #
      # Represents information about programming constructs like variables, classes,
      # interfaces etc.
      #
      class SymbolInformation
        def initialize(name:, kind:, location:, container_name: nil)
          @attributes = {}

          @attributes[:name] = name
          @attributes[:kind] = kind
          @attributes[:location] = location
          @attributes[:containerName] = container_name if container_name

          @attributes.freeze
        end

        #
        # The name of this symbol.
        #
        # @return [string]
        def name
          attributes.fetch(:name)
        end

        #
        # The kind of this symbol.
        #
        # @return [number]
        def kind
          attributes.fetch(:kind)
        end

        #
        # The location of this symbol.
        #
        # @return [Location]
        def location
          attributes.fetch(:location)
        end

        #
        # The name of the symbol containing this symbol.
        #
        # @return [string]
        def container_name
          attributes.fetch(:containerName)
        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/symbol_information.rb