class LanguageServer::Protocol::Interface::CompletionList

Represents a collection of [completion items](CompletionItem) to be presented in the editor.

Attributes

attributes[R]

Public Class Methods

new(is_incomplete:, item_defaults: nil, items:) click to toggle source
# 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

Public Instance Methods

is_incomplete() click to toggle source

This list is not complete. Further typing should result in recomputing this list.

Recomputed lists have all their items replaced (not appended) in the incomplete completion sessions.

@return [boolean]

# File lib/language_server/protocol/interface/completion_list.rb, line 27
def is_incomplete
  attributes.fetch(:isIncomplete)
end
item_defaults() click to toggle source

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.

@return [{ commitCharacters?: string[]; editRange?: Range | { insert: Range; replace: Range; }; insertTextFormat?: InsertTextFormat; insertTextMode?: InsertTextMode; data?: LSPAny; }]

# File lib/language_server/protocol/interface/completion_list.rb, line 45
def item_defaults
  attributes.fetch(:itemDefaults)
end
items() click to toggle source

The completion items.

@return [CompletionItem

# File lib/language_server/protocol/interface/completion_list.rb, line 53
def items
  attributes.fetch(:items)
end
to_hash() click to toggle source
# File lib/language_server/protocol/interface/completion_list.rb, line 59
def to_hash
  attributes
end
to_json(*args) click to toggle source
# File lib/language_server/protocol/interface/completion_list.rb, line 63
def to_json(*args)
  to_hash.to_json(*args)
end