Sha256: 05d1aeac922af4b299d62b9a253e4e10073e60388614908ff0505a50c9622288

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

module LanguageServer
  module Protocol
    module Interfaces
      #
      # 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_json(*args)
          attributes.to_json(*args)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
language_server-protocol-0.2.0 lib/language_server/protocol/interfaces/symbol_information.rb
language_server-protocol-0.1.0 lib/language_server/protocol/interfaces/symbol_information.rb
language_server-0.4.0 lib/language_server/protocol/interfaces/symbol_information.rb
language_server-0.3.1 lib/language_server/protocol/interfaces/symbol_information.rb
language_server-0.3.0 lib/language_server/protocol/interfaces/symbol_information.rb
language_server-0.2.0 lib/language_server/protocol/interfaces/symbol_information.rb
language_server-0.1.0 lib/language_server/protocol/interfaces/symbol_information.rb