Sha256: df557d42a8c92470054d410422fca2357b6c460a3a0000496605dbf0b70197e4

Contents?: true

Size: 1020 Bytes

Versions: 7

Compression:

Stored size: 1020 Bytes

Contents

module LanguageServer
  module Protocol
    module Interfaces
      #
      # Represents a parameter of a callable-signature. A parameter can
      # have a label and a doc-comment.
      #
      class ParameterInformation
        def initialize(label:, documentation: nil)
          @attributes = {}

          @attributes[:label] = label
          @attributes[:documentation] = documentation if documentation

          @attributes.freeze
        end

        #
        # The label of this parameter. Will be shown in
        # the UI.
        #
        # @return [string]
        def label
          attributes.fetch(:label)
        end

        #
        # The human-readable doc-comment of this parameter. Will be shown
        # in the UI but can be omitted.
        #
        # @return [string]
        def documentation
          attributes.fetch(:documentation)
        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/parameter_information.rb
language_server-protocol-0.1.0 lib/language_server/protocol/interfaces/parameter_information.rb
language_server-0.4.0 lib/language_server/protocol/interfaces/parameter_information.rb
language_server-0.3.1 lib/language_server/protocol/interfaces/parameter_information.rb
language_server-0.3.0 lib/language_server/protocol/interfaces/parameter_information.rb
language_server-0.2.0 lib/language_server/protocol/interfaces/parameter_information.rb
language_server-0.1.0 lib/language_server/protocol/interfaces/parameter_information.rb