Class: LanguageServer::Protocol::Interface::GeneralClientCapabilities

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

Overview

General client capabilities.

Since:

  • 3.16.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stale_request_support: nil, regular_expressions: nil, markdown: nil, position_encodings: nil) ⇒ GeneralClientCapabilities

Returns a new instance of GeneralClientCapabilities.

Since:

  • 3.16.0



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

def initialize(stale_request_support: nil, regular_expressions: nil, markdown: nil, position_encodings: nil)
  @attributes = {}

  @attributes[:staleRequestSupport] = stale_request_support if stale_request_support
  @attributes[:regularExpressions] = regular_expressions if regular_expressions
  @attributes[:markdown] = markdown if markdown
  @attributes[:positionEncodings] = position_encodings if position_encodings

  @attributes.freeze
end

Instance Attribute Details

#attributesObject (readonly)

Since:

  • 3.16.0



79
80
81
# File 'lib/language_server/protocol/interface/general_client_capabilities.rb', line 79

def attributes
  @attributes
end

Instance Method Details

#markdownMarkdownClientCapabilities | nil

Client capabilities specific to the client’s markdown parser.

Returns:

Since:

  • 3.16.0



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

def markdown
  attributes.fetch(:markdown)
end

#position_encodingsPositionEncodingKind[] | nil

The position encodings supported by the client. Client and server have to agree on the same position encoding to ensure that offsets (e.g. character position in a line) are interpreted the same on both sides.

To keep the protocol backwards compatible the following applies: if the value ‘utf-16’ is missing from the array of position encodings servers can assume that the client supports UTF-16. UTF-16 is therefore a mandatory encoding.

If omitted it defaults to [‘utf-16’].

Implementation considerations: since the conversion from one encoding into another requires the content of the file / line the conversion is best done where the file is read which is usually on the server side.

Returns:

  • (PositionEncodingKind[] | nil)

Since:

  • 3.17.0



75
76
77
# File 'lib/language_server/protocol/interface/general_client_capabilities.rb', line 75

def position_encodings
  attributes.fetch(:positionEncodings)
end

#regular_expressionsRegularExpressionsClientCapabilities | nil

Client capabilities specific to regular expressions.

Returns:

Since:

  • 3.16.0



40
41
42
# File 'lib/language_server/protocol/interface/general_client_capabilities.rb', line 40

def regular_expressions
  attributes.fetch(:regularExpressions)
end

#stale_request_support{ cancel:boolean, retryOnContentModified:string[] } | nil

Client capability that signals how the client handles stale requests (e.g. a request for which the client will not process the response anymore since the information is outdated).

Returns:

  • ({ cancel:boolean, retryOnContentModified:string[] } | nil)

Since:

  • 3.17.0



30
31
32
# File 'lib/language_server/protocol/interface/general_client_capabilities.rb', line 30

def stale_request_support
  attributes.fetch(:staleRequestSupport)
end

#to_hashObject

Since:

  • 3.16.0



81
82
83
# File 'lib/language_server/protocol/interface/general_client_capabilities.rb', line 81

def to_hash
  attributes
end

#to_json(*args) ⇒ Object

Since:

  • 3.16.0



85
86
87
# File 'lib/language_server/protocol/interface/general_client_capabilities.rb', line 85

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