Class: LanguageServer::Protocol::Interface::CompletionList
- Inherits:
-
Object
- Object
- LanguageServer::Protocol::Interface::CompletionList
- Defined in:
- lib/language_server/protocol/interface/completion_list.rb,
sig/language_server/protocol/interface/completion_list.rbs
Overview
Represents a collection of CompletionItem completion items to be presented in the editor.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash[Symbol, untyped]
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(is_incomplete:, item_defaults: nil, items:) ⇒ CompletionList
constructor
A new instance of CompletionList.
-
#is_incomplete ⇒ boolean
This list it not complete.
-
#item_defaults ⇒ { commitCharacters?: string[]; editRange?: Range | { insert: Range; replace: Range; }; insertTextFormat?: InsertTextFormat; insertTextMode?: InsertTextMode; data?: LSPAny; }
In many cases the items of an actual completion result share the same value for properties like
commitCharactersor the range of a text edit. -
#items ⇒ CompletionItem[]
The completion items.
- #to_hash ⇒ Hash[Symbol, untyped]
- #to_json(*args) ⇒ String
Constructor Details
#initialize(is_incomplete:, item_defaults: nil, items:) ⇒ CompletionList
Returns a new instance of CompletionList.
9 10 11 12 13 14 15 16 17 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 9 def initialize(is_incomplete:, item_defaults: nil, items:) @attributes = {} @attributes[:isIncomplete] = is_incomplete @attributes[:itemDefaults] = item_defaults if item_defaults @attributes[:items] = items @attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash[Symbol, untyped] (readonly)
Returns the value of attribute attributes.
58 59 60 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 58 def attributes @attributes end |
Instance Method Details
#is_incomplete ⇒ boolean
This list it not complete. Further typing results in recomputing this list.
Recomputed lists have all their items replaced (not appended) in the incomplete completion sessions.
26 27 28 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 26 def is_incomplete attributes.fetch(:isIncomplete) end |
#item_defaults ⇒ { commitCharacters?: string[]; editRange?: Range | { insert: Range; replace: Range; }; insertTextFormat?: InsertTextFormat; insertTextMode?: InsertTextMode; data?: LSPAny; }
In many cases the items of an actual completion result share the same
value for properties like commitCharacters or the range of a text
edit. A completion list can therefore define item defaults which will
be used if a completion item itself doesn't specify the value.
If a completion list specifies a default value and a completion item also specifies a corresponding value the one from the item is used.
Servers are only allowed to return default values if the client
signals support for this via the completionList.itemDefaults
capability.
46 47 48 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 46 def item_defaults attributes.fetch(:itemDefaults) end |
#items ⇒ CompletionItem[]
The completion items.
54 55 56 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 54 def items attributes.fetch(:items) end |
#to_hash ⇒ Hash[Symbol, untyped]
60 61 62 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 60 def to_hash attributes end |
#to_json(*args) ⇒ String
64 65 66 |
# File 'lib/language_server/protocol/interface/completion_list.rb', line 64 def to_json(*args) to_hash.to_json(*args) end |