Class: LanguageServer::Protocol::Interface::Moniker

Inherits:
Object
  • Object
show all
Defined in:
lib/language_server/protocol/interface/moniker.rb

Overview

Moniker definition to match LSIF 0.5 moniker definition.

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme:, identifier:, unique:, kind: nil) ⇒ Moniker

Returns a new instance of Moniker.

Since:

  • 3.16.0



10
11
12
13
14
15
16
17
18
19
# File 'lib/language_server/protocol/interface/moniker.rb', line 10

def initialize(scheme:, identifier:, unique:, kind: nil)
  @attributes = {}

  @attributes[:scheme] = scheme
  @attributes[:identifier] = identifier
  @attributes[:unique] = unique
  @attributes[:kind] = kind if kind

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.16.0



54
55
56
# File 'lib/language_server/protocol/interface/moniker.rb', line 54

def attributes
  @attributes
end

Instance Method Details

#identifierstring

The identifier of the moniker. The value is opaque in LSIF however schema owners are allowed to define the structure if they want.

Returns:

  • (string)

Since:

  • 3.16.0



34
35
36
# File 'lib/language_server/protocol/interface/moniker.rb', line 34

def identifier
  attributes.fetch(:identifier)
end

#kindMonikerKind | nil

The moniker kind if known.

Returns:

  • (MonikerKind | nil)

Since:

  • 3.16.0



50
51
52
# File 'lib/language_server/protocol/interface/moniker.rb', line 50

def kind
  attributes.fetch(:kind)
end

#schemestring

The scheme of the moniker. For example tsc or .Net

Returns:

  • (string)

Since:

  • 3.16.0



25
26
27
# File 'lib/language_server/protocol/interface/moniker.rb', line 25

def scheme
  attributes.fetch(:scheme)
end

#to_hashObject

Since:

  • 3.16.0



56
57
58
# File 'lib/language_server/protocol/interface/moniker.rb', line 56

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0



60
61
62
# File 'lib/language_server/protocol/interface/moniker.rb', line 60

def to_json(*args)
  to_hash.to_json(*args)
end

#uniqueUniquenessLevel

The scope in which the moniker is unique

Returns:

  • (UniquenessLevel)

Since:

  • 3.16.0



42
43
44
# File 'lib/language_server/protocol/interface/moniker.rb', line 42

def unique
  attributes.fetch(:unique)
end