language_server-protocol 3.15.0.2 → 3.16.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/language_server/protocol/constant.rb +10 -0
  4. data/lib/language_server/protocol/constant/code_action_kind.rb +6 -4
  5. data/lib/language_server/protocol/constant/completion_item_tag.rb +2 -2
  6. data/lib/language_server/protocol/constant/completion_trigger_kind.rb +2 -1
  7. data/lib/language_server/protocol/constant/diagnostic_tag.rb +2 -2
  8. data/lib/language_server/protocol/constant/error_codes.rb +26 -3
  9. data/lib/language_server/protocol/constant/failure_handling_kind.rb +6 -5
  10. data/lib/language_server/protocol/constant/file_operation_pattern_kind.rb +20 -0
  11. data/lib/language_server/protocol/constant/initialize_error.rb +2 -1
  12. data/lib/language_server/protocol/constant/insert_text_mode.rb +30 -0
  13. data/lib/language_server/protocol/constant/prepare_support_default_behavior.rb +13 -0
  14. data/lib/language_server/protocol/constant/signature_help_trigger_kind.rb +2 -1
  15. data/lib/language_server/protocol/constant/symbol_tag.rb +15 -0
  16. data/lib/language_server/protocol/constant/text_document_save_reason.rb +2 -2
  17. data/lib/language_server/protocol/constant/text_document_sync_kind.rb +2 -2
  18. data/lib/language_server/protocol/constant/token_format.rb +9 -0
  19. data/lib/language_server/protocol/interface.rb +112 -0
  20. data/lib/language_server/protocol/interface/annotated_text_edit.rb +38 -0
  21. data/lib/language_server/protocol/interface/apply_workspace_edit_response.rb +15 -4
  22. data/lib/language_server/protocol/interface/call_hierarchy_client_capabilities.rb +36 -0
  23. data/lib/language_server/protocol/interface/call_hierarchy_incoming_call.rb +43 -0
  24. data/lib/language_server/protocol/interface/call_hierarchy_incoming_calls_params.rb +31 -0
  25. data/lib/language_server/protocol/interface/call_hierarchy_item.rb +100 -0
  26. data/lib/language_server/protocol/interface/call_hierarchy_options.rb +25 -0
  27. data/lib/language_server/protocol/interface/call_hierarchy_outgoing_call.rb +43 -0
  28. data/lib/language_server/protocol/interface/call_hierarchy_outgoing_calls_params.rb +31 -0
  29. data/lib/language_server/protocol/interface/call_hierarchy_prepare_params.rb +25 -0
  30. data/lib/language_server/protocol/interface/call_hierarchy_registration_options.rb +25 -0
  31. data/lib/language_server/protocol/interface/change_annotation.rb +57 -0
  32. data/lib/language_server/protocol/interface/client_capabilities.rb +12 -3
  33. data/lib/language_server/protocol/interface/code_action.rb +43 -8
  34. data/lib/language_server/protocol/interface/code_action_client_capabilities.rb +44 -1
  35. data/lib/language_server/protocol/interface/code_action_context.rb +7 -6
  36. data/lib/language_server/protocol/interface/code_action_options.rb +13 -3
  37. data/lib/language_server/protocol/interface/code_action_registration_options.rb +2 -1
  38. data/lib/language_server/protocol/interface/code_description.rb +36 -0
  39. data/lib/language_server/protocol/interface/code_lens.rb +5 -3
  40. data/lib/language_server/protocol/interface/code_lens_workspace_client_capabilities.rb +39 -0
  41. data/lib/language_server/protocol/interface/color_presentation.rb +7 -6
  42. data/lib/language_server/protocol/interface/completion_client_capabilities.rb +1 -1
  43. data/lib/language_server/protocol/interface/completion_context.rb +5 -3
  44. data/lib/language_server/protocol/interface/completion_item.rb +60 -29
  45. data/lib/language_server/protocol/interface/completion_list.rb +2 -2
  46. data/lib/language_server/protocol/interface/completion_options.rb +15 -12
  47. data/lib/language_server/protocol/interface/completion_params.rb +2 -1
  48. data/lib/language_server/protocol/interface/create_file.rb +10 -1
  49. data/lib/language_server/protocol/interface/create_files_params.rb +37 -0
  50. data/lib/language_server/protocol/interface/declaration_client_capabilities.rb +3 -3
  51. data/lib/language_server/protocol/interface/delete_file.rb +10 -1
  52. data/lib/language_server/protocol/interface/delete_files_params.rb +37 -0
  53. data/lib/language_server/protocol/interface/diagnostic.rb +21 -1
  54. data/lib/language_server/protocol/interface/diagnostic_related_information.rb +3 -3
  55. data/lib/language_server/protocol/interface/did_change_text_document_params.rb +11 -9
  56. data/lib/language_server/protocol/interface/did_change_watched_files_client_capabilities.rb +3 -3
  57. data/lib/language_server/protocol/interface/document_filter.rb +7 -3
  58. data/lib/language_server/protocol/interface/document_highlight.rb +1 -1
  59. data/lib/language_server/protocol/interface/document_link.rb +6 -5
  60. data/lib/language_server/protocol/interface/document_symbol.rb +23 -11
  61. data/lib/language_server/protocol/interface/document_symbol_client_capabilities.rb +24 -2
  62. data/lib/language_server/protocol/interface/document_symbol_options.rb +11 -1
  63. data/lib/language_server/protocol/interface/document_symbol_registration_options.rb +2 -1
  64. data/lib/language_server/protocol/interface/file_create.rb +36 -0
  65. data/lib/language_server/protocol/interface/file_delete.rb +36 -0
  66. data/lib/language_server/protocol/interface/file_operation_filter.rb +46 -0
  67. data/lib/language_server/protocol/interface/file_operation_pattern.rb +67 -0
  68. data/lib/language_server/protocol/interface/file_operation_pattern_options.rb +36 -0
  69. data/lib/language_server/protocol/interface/file_operation_registration_options.rb +36 -0
  70. data/lib/language_server/protocol/interface/file_rename.rb +45 -0
  71. data/lib/language_server/protocol/interface/file_system_watcher.rb +7 -3
  72. data/lib/language_server/protocol/interface/folding_range.rb +17 -8
  73. data/lib/language_server/protocol/interface/folding_range_client_capabilities.rb +10 -7
  74. data/lib/language_server/protocol/interface/hover.rb +1 -1
  75. data/lib/language_server/protocol/interface/hover_client_capabilities.rb +3 -2
  76. data/lib/language_server/protocol/interface/implementation_client_capabilities.rb +3 -3
  77. data/lib/language_server/protocol/interface/initialize_params.rb +20 -5
  78. data/lib/language_server/protocol/interface/insert_replace_edit.rb +54 -0
  79. data/lib/language_server/protocol/interface/linked_editing_range_client_capabilities.rb +36 -0
  80. data/lib/language_server/protocol/interface/linked_editing_range_options.rb +25 -0
  81. data/lib/language_server/protocol/interface/linked_editing_range_params.rb +25 -0
  82. data/lib/language_server/protocol/interface/linked_editing_range_registration_options.rb +25 -0
  83. data/lib/language_server/protocol/interface/linked_editing_ranges.rb +45 -0
  84. data/lib/language_server/protocol/interface/location_link.rb +9 -7
  85. data/lib/language_server/protocol/interface/log_message_params.rb +1 -1
  86. data/lib/language_server/protocol/interface/log_trace_params.rb +43 -0
  87. data/lib/language_server/protocol/interface/markdown_client_capabilities.rb +45 -0
  88. data/lib/language_server/protocol/interface/markup_content.rb +9 -7
  89. data/lib/language_server/protocol/interface/moniker.rb +64 -0
  90. data/lib/language_server/protocol/interface/moniker_client_capabilities.rb +36 -0
  91. data/lib/language_server/protocol/interface/moniker_options.rb +25 -0
  92. data/lib/language_server/protocol/interface/moniker_params.rb +25 -0
  93. data/lib/language_server/protocol/interface/moniker_registration_options.rb +25 -0
  94. data/lib/language_server/protocol/interface/optional_versioned_text_document_identifier.rb +42 -0
  95. data/lib/language_server/protocol/interface/parameter_information.rb +7 -5
  96. data/lib/language_server/protocol/interface/partial_result_params.rb +3 -3
  97. data/lib/language_server/protocol/interface/position.rb +5 -5
  98. data/lib/language_server/protocol/interface/progress_params.rb +1 -1
  99. data/lib/language_server/protocol/interface/publish_diagnostics_client_capabilities.rb +21 -1
  100. data/lib/language_server/protocol/interface/publish_diagnostics_params.rb +2 -1
  101. data/lib/language_server/protocol/interface/regular_expressions_client_capabilities.rb +45 -0
  102. data/lib/language_server/protocol/interface/rename_client_capabilities.rb +27 -1
  103. data/lib/language_server/protocol/interface/rename_file.rb +10 -1
  104. data/lib/language_server/protocol/interface/rename_files_params.rb +38 -0
  105. data/lib/language_server/protocol/interface/selection_range.rb +2 -1
  106. data/lib/language_server/protocol/interface/selection_range_client_capabilities.rb +4 -3
  107. data/lib/language_server/protocol/interface/semantic_tokens.rb +45 -0
  108. data/lib/language_server/protocol/interface/semantic_tokens_client_capabilities.rb +97 -0
  109. data/lib/language_server/protocol/interface/semantic_tokens_delta.rb +40 -0
  110. data/lib/language_server/protocol/interface/semantic_tokens_delta_params.rb +44 -0
  111. data/lib/language_server/protocol/interface/semantic_tokens_delta_partial_result.rb +30 -0
  112. data/lib/language_server/protocol/interface/semantic_tokens_edit.rb +51 -0
  113. data/lib/language_server/protocol/interface/semantic_tokens_legend.rb +42 -0
  114. data/lib/language_server/protocol/interface/semantic_tokens_options.rb +53 -0
  115. data/lib/language_server/protocol/interface/semantic_tokens_params.rb +34 -0
  116. data/lib/language_server/protocol/interface/semantic_tokens_partial_result.rb +30 -0
  117. data/lib/language_server/protocol/interface/semantic_tokens_range_params.rb +43 -0
  118. data/lib/language_server/protocol/interface/semantic_tokens_registration_options.rb +25 -0
  119. data/lib/language_server/protocol/interface/semantic_tokens_workspace_client_capabilities.rb +39 -0
  120. data/lib/language_server/protocol/interface/server_capabilities.rb +47 -9
  121. data/lib/language_server/protocol/interface/set_trace_params.rb +33 -0
  122. data/lib/language_server/protocol/interface/show_document_client_capabilities.rb +37 -0
  123. data/lib/language_server/protocol/interface/show_document_params.rb +71 -0
  124. data/lib/language_server/protocol/interface/show_document_result.rb +36 -0
  125. data/lib/language_server/protocol/interface/show_message_params.rb +1 -1
  126. data/lib/language_server/protocol/interface/show_message_request_client_capabilities.rb +36 -0
  127. data/lib/language_server/protocol/interface/show_message_request_params.rb +1 -1
  128. data/lib/language_server/protocol/interface/signature_help.rb +3 -3
  129. data/lib/language_server/protocol/interface/signature_help_client_capabilities.rb +1 -1
  130. data/lib/language_server/protocol/interface/signature_help_context.rb +10 -7
  131. data/lib/language_server/protocol/interface/signature_help_options.rb +3 -2
  132. data/lib/language_server/protocol/interface/signature_help_params.rb +3 -2
  133. data/lib/language_server/protocol/interface/signature_information.rb +12 -1
  134. data/lib/language_server/protocol/interface/symbol_information.rb +10 -1
  135. data/lib/language_server/protocol/interface/text_document_change_registration_options.rb +1 -1
  136. data/lib/language_server/protocol/interface/text_document_client_capabilities.rb +39 -2
  137. data/lib/language_server/protocol/interface/text_document_content_change_event.rb +2 -2
  138. data/lib/language_server/protocol/interface/text_document_edit.rb +2 -2
  139. data/lib/language_server/protocol/interface/text_document_registration_options.rb +3 -3
  140. data/lib/language_server/protocol/interface/text_document_sync_options.rb +13 -15
  141. data/lib/language_server/protocol/interface/type_definition_client_capabilities.rb +3 -3
  142. data/lib/language_server/protocol/interface/versioned_text_document_identifier.rb +3 -7
  143. data/lib/language_server/protocol/interface/will_save_text_document_params.rb +1 -1
  144. data/lib/language_server/protocol/interface/work_done_progress_begin.rb +3 -3
  145. data/lib/language_server/protocol/interface/work_done_progress_cancel_params.rb +1 -1
  146. data/lib/language_server/protocol/interface/work_done_progress_create_params.rb +1 -1
  147. data/lib/language_server/protocol/interface/work_done_progress_params.rb +1 -1
  148. data/lib/language_server/protocol/interface/work_done_progress_report.rb +5 -5
  149. data/lib/language_server/protocol/interface/workspace_edit.rb +24 -7
  150. data/lib/language_server/protocol/interface/workspace_edit_client_capabilities.rb +23 -1
  151. data/lib/language_server/protocol/interface/workspace_symbol_client_capabilities.rb +13 -2
  152. data/lib/language_server/protocol/version.rb +1 -1
  153. metadata +67 -6
@@ -0,0 +1,42 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class OptionalVersionedTextDocumentIdentifier < TextDocumentIdentifier
5
+ def initialize(uri:, version:)
6
+ @attributes = {}
7
+
8
+ @attributes[:uri] = uri
9
+ @attributes[:version] = version
10
+
11
+ @attributes.freeze
12
+ end
13
+
14
+ #
15
+ # The version number of this document. If an optional versioned text document
16
+ # identifier is sent from the server to the client and the file is not
17
+ # open in the editor (the server has not received an open notification
18
+ # before) the server can send `null` to indicate that the version is
19
+ # known and the content on disk is the master (as specified with document
20
+ # content ownership).
21
+ #
22
+ # The version number of a document will increase after each change,
23
+ # including undo/redo. The number doesn't need to be consecutive.
24
+ #
25
+ # @return [number]
26
+ def version
27
+ attributes.fetch(:version)
28
+ end
29
+
30
+ attr_reader :attributes
31
+
32
+ def to_hash
33
+ attributes
34
+ end
35
+
36
+ def to_json(*args)
37
+ to_hash.to_json(*args)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -18,12 +18,14 @@ module LanguageServer
18
18
  #
19
19
  # The label of this parameter information.
20
20
  #
21
- # Either a string or an inclusive start and exclusive end offsets within its containing
22
- # signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
23
- # string representation as `Position` and `Range` does.
21
+ # Either a string or an inclusive start and exclusive end offsets within
22
+ # its containing signature label. (see SignatureInformation.label). The
23
+ # offsets are based on a UTF-16 string representation as `Position` and
24
+ # `Range` does.
24
25
  #
25
- # *Note*: a label of type string should be a substring of its containing signature label.
26
- # Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
26
+ # *Note*: a label of type string should be a substring of its containing
27
+ # signature label. Its intended use case is to highlight the parameter
28
+ # label part in the `SignatureInformation.label`.
27
29
  #
28
30
  # @return [string | [number, number]]
29
31
  def label
@@ -11,10 +11,10 @@ module LanguageServer
11
11
  end
12
12
 
13
13
  #
14
- # An optional token that a server can use to report partial results (e.g. streaming) to
15
- # the client.
14
+ # An optional token that a server can use to report partial results (e.g.
15
+ # streaming) to the client.
16
16
  #
17
- # @return [string | number]
17
+ # @return [ProgressToken]
18
18
  def partial_result_token
19
19
  attributes.fetch(:partialResultToken)
20
20
  end
@@ -20,12 +20,12 @@ module LanguageServer
20
20
  end
21
21
 
22
22
  #
23
- # Character offset on a line in a document (zero-based). Assuming that the line is
24
- # represented as a string, the `character` value represents the gap between the
25
- # `character` and `character + 1`.
23
+ # Character offset on a line in a document (zero-based). Assuming that
24
+ # the line is represented as a string, the `character` value represents
25
+ # the gap between the `character` and `character + 1`.
26
26
  #
27
- # If the character value is greater than the line length it defaults back to the
28
- # line length.
27
+ # If the character value is greater than the line length it defaults back
28
+ # to the line length.
29
29
  #
30
30
  # @return [number]
31
31
  def character
@@ -14,7 +14,7 @@ module LanguageServer
14
14
  #
15
15
  # The progress token provided by the client or server.
16
16
  #
17
- # @return [string | number]
17
+ # @return [ProgressToken]
18
18
  def token
19
19
  attributes.fetch(:token)
20
20
  end
@@ -2,12 +2,14 @@ module LanguageServer
2
2
  module Protocol
3
3
  module Interface
4
4
  class PublishDiagnosticsClientCapabilities
5
- def initialize(related_information: nil, tag_support: nil, version_support: nil)
5
+ def initialize(related_information: nil, tag_support: nil, version_support: nil, code_description_support: nil, data_support: nil)
6
6
  @attributes = {}
7
7
 
8
8
  @attributes[:relatedInformation] = related_information if related_information
9
9
  @attributes[:tagSupport] = tag_support if tag_support
10
10
  @attributes[:versionSupport] = version_support if version_support
11
+ @attributes[:codeDescriptionSupport] = code_description_support if code_description_support
12
+ @attributes[:dataSupport] = data_support if data_support
11
13
 
12
14
  @attributes.freeze
13
15
  end
@@ -38,6 +40,24 @@ module LanguageServer
38
40
  attributes.fetch(:versionSupport)
39
41
  end
40
42
 
43
+ #
44
+ # Client supports a codeDescription property
45
+ #
46
+ # @return [boolean]
47
+ def code_description_support
48
+ attributes.fetch(:codeDescriptionSupport)
49
+ end
50
+
51
+ #
52
+ # Whether code action supports the `data` property which is
53
+ # preserved between a `textDocument/publishDiagnostics` and
54
+ # `textDocument/codeAction` request.
55
+ #
56
+ # @return [boolean]
57
+ def data_support
58
+ attributes.fetch(:dataSupport)
59
+ end
60
+
41
61
  attr_reader :attributes
42
62
 
43
63
  def to_hash
@@ -21,7 +21,8 @@ module LanguageServer
21
21
  end
22
22
 
23
23
  #
24
- # Optional the version number of the document the diagnostics are published for.
24
+ # Optional the version number of the document the diagnostics are published
25
+ # for.
25
26
  #
26
27
  # @return [number]
27
28
  def version
@@ -0,0 +1,45 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ #
5
+ # Client capabilities specific to regular expressions.
6
+ #
7
+ class RegularExpressionsClientCapabilities
8
+ def initialize(engine:, version: nil)
9
+ @attributes = {}
10
+
11
+ @attributes[:engine] = engine
12
+ @attributes[:version] = version if version
13
+
14
+ @attributes.freeze
15
+ end
16
+
17
+ #
18
+ # The engine's name.
19
+ #
20
+ # @return [string]
21
+ def engine
22
+ attributes.fetch(:engine)
23
+ end
24
+
25
+ #
26
+ # The engine's version.
27
+ #
28
+ # @return [string]
29
+ def version
30
+ attributes.fetch(:version)
31
+ end
32
+
33
+ attr_reader :attributes
34
+
35
+ def to_hash
36
+ attributes
37
+ end
38
+
39
+ def to_json(*args)
40
+ to_hash.to_json(*args)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -2,11 +2,13 @@ module LanguageServer
2
2
  module Protocol
3
3
  module Interface
4
4
  class RenameClientCapabilities
5
- def initialize(dynamic_registration: nil, prepare_support: nil)
5
+ def initialize(dynamic_registration: nil, prepare_support: nil, prepare_support_default_behavior: nil, honors_change_annotations: nil)
6
6
  @attributes = {}
7
7
 
8
8
  @attributes[:dynamicRegistration] = dynamic_registration if dynamic_registration
9
9
  @attributes[:prepareSupport] = prepare_support if prepare_support
10
+ @attributes[:prepareSupportDefaultBehavior] = prepare_support_default_behavior if prepare_support_default_behavior
11
+ @attributes[:honorsChangeAnnotations] = honors_change_annotations if honors_change_annotations
10
12
 
11
13
  @attributes.freeze
12
14
  end
@@ -28,6 +30,30 @@ module LanguageServer
28
30
  attributes.fetch(:prepareSupport)
29
31
  end
30
32
 
33
+ #
34
+ # Client supports the default behavior result
35
+ # (`{ defaultBehavior: boolean }`).
36
+ #
37
+ # The value indicates the default behavior used by the
38
+ # client.
39
+ #
40
+ # @return [any]
41
+ def prepare_support_default_behavior
42
+ attributes.fetch(:prepareSupportDefaultBehavior)
43
+ end
44
+
45
+ #
46
+ # Whether th client honors the change annotations in
47
+ # text edits and resource operations returned via the
48
+ # rename request's workspace edit by for example presenting
49
+ # the workspace edit in the user interface and asking
50
+ # for confirmation.
51
+ #
52
+ # @return [boolean]
53
+ def honors_change_annotations
54
+ attributes.fetch(:honorsChangeAnnotations)
55
+ end
56
+
31
57
  attr_reader :attributes
32
58
 
33
59
  def to_hash
@@ -5,13 +5,14 @@ module LanguageServer
5
5
  # Rename file operation
6
6
  #
7
7
  class RenameFile
8
- def initialize(kind:, old_uri:, new_uri:, options: nil)
8
+ def initialize(kind:, old_uri:, new_uri:, options: nil, annotation_id: nil)
9
9
  @attributes = {}
10
10
 
11
11
  @attributes[:kind] = kind
12
12
  @attributes[:oldUri] = old_uri
13
13
  @attributes[:newUri] = new_uri
14
14
  @attributes[:options] = options if options
15
+ @attributes[:annotationId] = annotation_id if annotation_id
15
16
 
16
17
  @attributes.freeze
17
18
  end
@@ -48,6 +49,14 @@ module LanguageServer
48
49
  attributes.fetch(:options)
49
50
  end
50
51
 
52
+ #
53
+ # An optional annotation identifer describing the operation.
54
+ #
55
+ # @return [string]
56
+ def annotation_id
57
+ attributes.fetch(:annotationId)
58
+ end
59
+
51
60
  attr_reader :attributes
52
61
 
53
62
  def to_hash
@@ -0,0 +1,38 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ #
5
+ # The parameters sent in notifications/requests for user-initiated renames
6
+ # of files.
7
+ #
8
+ class RenameFilesParams
9
+ def initialize(files:)
10
+ @attributes = {}
11
+
12
+ @attributes[:files] = files
13
+
14
+ @attributes.freeze
15
+ end
16
+
17
+ #
18
+ # An array of all files/folders renamed in this operation. When a folder
19
+ # is renamed, only the folder will be included, and not its children.
20
+ #
21
+ # @return [FileRename[]]
22
+ def files
23
+ attributes.fetch(:files)
24
+ end
25
+
26
+ attr_reader :attributes
27
+
28
+ def to_hash
29
+ attributes
30
+ end
31
+
32
+ def to_json(*args)
33
+ to_hash.to_json(*args)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -20,7 +20,8 @@ module LanguageServer
20
20
  end
21
21
 
22
22
  #
23
- # The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
23
+ # The parent selection range containing this range. Therefore
24
+ # `parent.range` must contain `this.range`.
24
25
  #
25
26
  # @return [SelectionRange]
26
27
  def parent
@@ -11,9 +11,10 @@ module LanguageServer
11
11
  end
12
12
 
13
13
  #
14
- # Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
15
- # the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
16
- # capability as well.
14
+ # Whether implementation supports dynamic registration for selection range
15
+ # providers. If this is set to `true` the client supports the new
16
+ # `SelectionRangeRegistrationOptions` return value for the corresponding
17
+ # server capability as well.
17
18
  #
18
19
  # @return [boolean]
19
20
  def dynamic_registration
@@ -0,0 +1,45 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class SemanticTokens
5
+ def initialize(result_id: nil, data:)
6
+ @attributes = {}
7
+
8
+ @attributes[:resultId] = result_id if result_id
9
+ @attributes[:data] = data
10
+
11
+ @attributes.freeze
12
+ end
13
+
14
+ #
15
+ # An optional result id. If provided and clients support delta updating
16
+ # the client will include the result id in the next semantic token request.
17
+ # A server can then instead of computing all semantic tokens again simply
18
+ # send a delta.
19
+ #
20
+ # @return [string]
21
+ def result_id
22
+ attributes.fetch(:resultId)
23
+ end
24
+
25
+ #
26
+ # The actual tokens.
27
+ #
28
+ # @return [number[]]
29
+ def data
30
+ attributes.fetch(:data)
31
+ end
32
+
33
+ attr_reader :attributes
34
+
35
+ def to_hash
36
+ attributes
37
+ end
38
+
39
+ def to_json(*args)
40
+ to_hash.to_json(*args)
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,97 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class SemanticTokensClientCapabilities
5
+ def initialize(dynamic_registration: nil, requests:, token_types:, token_modifiers:, formats:, overlapping_token_support: nil, multiline_token_support: nil)
6
+ @attributes = {}
7
+
8
+ @attributes[:dynamicRegistration] = dynamic_registration if dynamic_registration
9
+ @attributes[:requests] = requests
10
+ @attributes[:tokenTypes] = token_types
11
+ @attributes[:tokenModifiers] = token_modifiers
12
+ @attributes[:formats] = formats
13
+ @attributes[:overlappingTokenSupport] = overlapping_token_support if overlapping_token_support
14
+ @attributes[:multilineTokenSupport] = multiline_token_support if multiline_token_support
15
+
16
+ @attributes.freeze
17
+ end
18
+
19
+ #
20
+ # Whether implementation supports dynamic registration. If this is set to
21
+ # `true` the client supports the new `(TextDocumentRegistrationOptions &
22
+ # StaticRegistrationOptions)` return value for the corresponding server
23
+ # capability as well.
24
+ #
25
+ # @return [boolean]
26
+ def dynamic_registration
27
+ attributes.fetch(:dynamicRegistration)
28
+ end
29
+
30
+ #
31
+ # Which requests the client supports and might send to the server
32
+ # depending on the server's capability. Please note that clients might not
33
+ # show semantic tokens or degrade some of the user experience if a range
34
+ # or full request is advertised by the client but not provided by the
35
+ # server. If for example the client capability `requests.full` and
36
+ # `request.range` are both set to true but the server only provides a
37
+ # range provider the client might not render a minimap correctly or might
38
+ # even decide to not show any semantic tokens at all.
39
+ #
40
+ # @return [{ range?: boolean | {}; full?: boolean | { delta?: boolean; }; }]
41
+ def requests
42
+ attributes.fetch(:requests)
43
+ end
44
+
45
+ #
46
+ # The token types that the client supports.
47
+ #
48
+ # @return [string[]]
49
+ def token_types
50
+ attributes.fetch(:tokenTypes)
51
+ end
52
+
53
+ #
54
+ # The token modifiers that the client supports.
55
+ #
56
+ # @return [string[]]
57
+ def token_modifiers
58
+ attributes.fetch(:tokenModifiers)
59
+ end
60
+
61
+ #
62
+ # The formats the clients supports.
63
+ #
64
+ # @return ["relative"[]]
65
+ def formats
66
+ attributes.fetch(:formats)
67
+ end
68
+
69
+ #
70
+ # Whether the client supports tokens that can overlap each other.
71
+ #
72
+ # @return [boolean]
73
+ def overlapping_token_support
74
+ attributes.fetch(:overlappingTokenSupport)
75
+ end
76
+
77
+ #
78
+ # Whether the client supports tokens that can span multiple lines.
79
+ #
80
+ # @return [boolean]
81
+ def multiline_token_support
82
+ attributes.fetch(:multilineTokenSupport)
83
+ end
84
+
85
+ attr_reader :attributes
86
+
87
+ def to_hash
88
+ attributes
89
+ end
90
+
91
+ def to_json(*args)
92
+ to_hash.to_json(*args)
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end