language_server-protocol 0.5.0 → 3.7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +13 -7
  4. data/lib/language_server/protocol/constant.rb +35 -11
  5. data/lib/language_server/protocol/constant/completion_item_kind.rb +7 -0
  6. data/lib/language_server/protocol/constant/completion_trigger_kind.rb +25 -0
  7. data/lib/language_server/protocol/constant/insert_text_format.rb +0 -2
  8. data/lib/language_server/protocol/constant/markup_kind.rb +23 -0
  9. data/lib/language_server/protocol/constant/symbol_kind.rb +8 -0
  10. data/lib/language_server/protocol/constant/watch_kind.rb +20 -0
  11. data/lib/language_server/protocol/interface.rb +217 -87
  12. data/lib/language_server/protocol/interface/apply_workspace_edit_params.rb +12 -1
  13. data/lib/language_server/protocol/interface/client_capabilities.rb +1 -1
  14. data/lib/language_server/protocol/interface/color.rb +63 -0
  15. data/lib/language_server/protocol/interface/color_information.rb +42 -0
  16. data/lib/language_server/protocol/interface/color_presentation.rb +56 -0
  17. data/lib/language_server/protocol/interface/color_presentation_params.rb +51 -0
  18. data/lib/language_server/protocol/interface/color_provider_options.rb +27 -0
  19. data/lib/language_server/protocol/interface/completion_context.rb +46 -0
  20. data/lib/language_server/protocol/interface/completion_item.rb +37 -6
  21. data/lib/language_server/protocol/interface/completion_params.rb +34 -0
  22. data/lib/language_server/protocol/interface/completion_registration_options.rb +8 -1
  23. data/lib/language_server/protocol/interface/configuration_item.rb +42 -0
  24. data/lib/language_server/protocol/interface/configuration_params.rb +30 -0
  25. data/lib/language_server/protocol/interface/diagnostic.rb +12 -2
  26. data/lib/language_server/protocol/interface/diagnostic_related_information.rb +47 -0
  27. data/lib/language_server/protocol/interface/did_change_text_document_params.rb +3 -1
  28. data/lib/language_server/protocol/interface/did_change_watched_files_registration_options.rb +36 -0
  29. data/lib/language_server/protocol/interface/did_change_workspace_folders_params.rb +33 -0
  30. data/lib/language_server/protocol/interface/did_save_text_document_params.rb +1 -1
  31. data/lib/language_server/protocol/interface/document_link.rb +11 -1
  32. data/lib/language_server/protocol/interface/file_system_watcher.rb +44 -0
  33. data/lib/language_server/protocol/interface/hover.rb +1 -1
  34. data/lib/language_server/protocol/interface/initialize_params.rb +15 -1
  35. data/lib/language_server/protocol/interface/initialized_params.rb +24 -0
  36. data/lib/language_server/protocol/interface/markup_content.rb +66 -0
  37. data/lib/language_server/protocol/interface/notification_message.rb +1 -1
  38. data/lib/language_server/protocol/interface/parameter_information.rb +1 -1
  39. data/lib/language_server/protocol/interface/position.rb +6 -1
  40. data/lib/language_server/protocol/interface/registration.rb +1 -1
  41. data/lib/language_server/protocol/interface/rename_params.rb +1 -1
  42. data/lib/language_server/protocol/interface/request_message.rb +1 -1
  43. data/lib/language_server/protocol/interface/server_capabilities.rb +44 -2
  44. data/lib/language_server/protocol/interface/signature_help.rb +2 -2
  45. data/lib/language_server/protocol/interface/signature_information.rb +1 -1
  46. data/lib/language_server/protocol/interface/static_registration_options.rb +37 -0
  47. data/lib/language_server/protocol/interface/symbol_information.rb +23 -3
  48. data/lib/language_server/protocol/interface/text_document_change_registration_options.rb +2 -2
  49. data/lib/language_server/protocol/interface/text_document_client_capabilities.rb +48 -5
  50. data/lib/language_server/protocol/interface/text_document_item.rb +1 -1
  51. data/lib/language_server/protocol/interface/text_document_sync_options.rb +2 -2
  52. data/lib/language_server/protocol/interface/versioned_text_document_identifier.rb +5 -1
  53. data/lib/language_server/protocol/interface/workspace_client_capabilities.rb +104 -0
  54. data/lib/language_server/protocol/interface/workspace_edit.rb +4 -3
  55. data/lib/language_server/protocol/interface/workspace_folder.rb +43 -0
  56. data/lib/language_server/protocol/interface/workspace_folders_change_event.rb +45 -0
  57. data/lib/language_server/protocol/version.rb +1 -1
  58. data/scripts/generateFiles.ts +29 -9
  59. metadata +25 -3
@@ -2,14 +2,25 @@ module LanguageServer
2
2
  module Protocol
3
3
  module Interface
4
4
  class ApplyWorkspaceEditParams
5
- def initialize(edit:)
5
+ def initialize(label: nil, edit:)
6
6
  @attributes = {}
7
7
 
8
+ @attributes[:label] = label if label
8
9
  @attributes[:edit] = edit
9
10
 
10
11
  @attributes.freeze
11
12
  end
12
13
 
14
+ #
15
+ # An optional label of the workspace edit. This label is
16
+ # presented in the user interface for example on an undo
17
+ # stack to undo the workspace edit.
18
+ #
19
+ # @return [string]
20
+ def label
21
+ attributes.fetch(:label)
22
+ end
23
+
13
24
  #
14
25
  # The edits to apply.
15
26
  #
@@ -15,7 +15,7 @@ module LanguageServer
15
15
  #
16
16
  # Workspace specific client capabilities.
17
17
  #
18
- # @return [WorkspaceClientCapabilites]
18
+ # @return [WorkspaceClientCapabilities]
19
19
  def workspace
20
20
  attributes.fetch(:workspace)
21
21
  end
@@ -0,0 +1,63 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ #
5
+ # Represents a color in RGBA space.
6
+ #
7
+ class Color
8
+ def initialize(red:, green:, blue:, alpha:)
9
+ @attributes = {}
10
+
11
+ @attributes[:red] = red
12
+ @attributes[:green] = green
13
+ @attributes[:blue] = blue
14
+ @attributes[:alpha] = alpha
15
+
16
+ @attributes.freeze
17
+ end
18
+
19
+ #
20
+ # The red component of this color in the range [0-1].
21
+ #
22
+ # @return [number]
23
+ def red
24
+ attributes.fetch(:red)
25
+ end
26
+
27
+ #
28
+ # The green component of this color in the range [0-1].
29
+ #
30
+ # @return [number]
31
+ def green
32
+ attributes.fetch(:green)
33
+ end
34
+
35
+ #
36
+ # The blue component of this color in the range [0-1].
37
+ #
38
+ # @return [number]
39
+ def blue
40
+ attributes.fetch(:blue)
41
+ end
42
+
43
+ #
44
+ # The alpha component of this color in the range [0-1].
45
+ #
46
+ # @return [number]
47
+ def alpha
48
+ attributes.fetch(:alpha)
49
+ end
50
+
51
+ attr_reader :attributes
52
+
53
+ def to_hash
54
+ attributes
55
+ end
56
+
57
+ def to_json(*args)
58
+ to_hash.to_json(*args)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,42 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class ColorInformation
5
+ def initialize(range:, color:)
6
+ @attributes = {}
7
+
8
+ @attributes[:range] = range
9
+ @attributes[:color] = color
10
+
11
+ @attributes.freeze
12
+ end
13
+
14
+ #
15
+ # The range in the document where this color appears.
16
+ #
17
+ # @return [Range]
18
+ def range
19
+ attributes.fetch(:range)
20
+ end
21
+
22
+ #
23
+ # The actual color value for this color range.
24
+ #
25
+ # @return [Color]
26
+ def color
27
+ attributes.fetch(:color)
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
@@ -0,0 +1,56 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class ColorPresentation
5
+ def initialize(label:, text_edit: nil, additional_text_edits: nil)
6
+ @attributes = {}
7
+
8
+ @attributes[:label] = label
9
+ @attributes[:textEdit] = text_edit if text_edit
10
+ @attributes[:additionalTextEdits] = additional_text_edits if additional_text_edits
11
+
12
+ @attributes.freeze
13
+ end
14
+
15
+ #
16
+ # The label of this color presentation. It will be shown on the color
17
+ # picker header. By default this is also the text that is inserted when selecting
18
+ # this color presentation.
19
+ #
20
+ # @return [string]
21
+ def label
22
+ attributes.fetch(:label)
23
+ end
24
+
25
+ #
26
+ # An [edit](#TextEdit) which is applied to a document when selecting
27
+ # this presentation for the color. When `falsy` the [label](#ColorPresentation.label)
28
+ # is used.
29
+ #
30
+ # @return [TextEdit]
31
+ def text_edit
32
+ attributes.fetch(:textEdit)
33
+ end
34
+
35
+ #
36
+ # An optional array of additional [text edits](#TextEdit) that are applied when
37
+ # selecting this color presentation. Edits must not overlap with the main [edit](#ColorPresentation.textEdit) nor with themselves.
38
+ #
39
+ # @return [TextEdit[]]
40
+ def additional_text_edits
41
+ attributes.fetch(:additionalTextEdits)
42
+ end
43
+
44
+ attr_reader :attributes
45
+
46
+ def to_hash
47
+ attributes
48
+ end
49
+
50
+ def to_json(*args)
51
+ to_hash.to_json(*args)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,51 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class ColorPresentationParams
5
+ def initialize(text_document:, color:, range:)
6
+ @attributes = {}
7
+
8
+ @attributes[:textDocument] = text_document
9
+ @attributes[:color] = color
10
+ @attributes[:range] = range
11
+
12
+ @attributes.freeze
13
+ end
14
+
15
+ #
16
+ # The text document.
17
+ #
18
+ # @return [TextDocumentIdentifier]
19
+ def text_document
20
+ attributes.fetch(:textDocument)
21
+ end
22
+
23
+ #
24
+ # The color information to request presentations for.
25
+ #
26
+ # @return [Color]
27
+ def color
28
+ attributes.fetch(:color)
29
+ end
30
+
31
+ #
32
+ # The range where the color would be inserted. Serves as a context.
33
+ #
34
+ # @return [Range]
35
+ def range
36
+ attributes.fetch(:range)
37
+ end
38
+
39
+ attr_reader :attributes
40
+
41
+ def to_hash
42
+ attributes
43
+ end
44
+
45
+ def to_json(*args)
46
+ to_hash.to_json(*args)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ #
5
+ # Color provider Options
6
+ #
7
+ class ColorProviderOptions
8
+ def initialize()
9
+ @attributes = {}
10
+
11
+
12
+ @attributes.freeze
13
+ end
14
+
15
+ attr_reader :attributes
16
+
17
+ def to_hash
18
+ attributes
19
+ end
20
+
21
+ def to_json(*args)
22
+ to_hash.to_json(*args)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,46 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ #
5
+ # Contains additional information about the context in which a completion request is triggered.
6
+ #
7
+ class CompletionContext
8
+ def initialize(trigger_kind:, trigger_character: nil)
9
+ @attributes = {}
10
+
11
+ @attributes[:triggerKind] = trigger_kind
12
+ @attributes[:triggerCharacter] = trigger_character if trigger_character
13
+
14
+ @attributes.freeze
15
+ end
16
+
17
+ #
18
+ # How the completion was triggered.
19
+ #
20
+ # @return [CompletionTriggerKind]
21
+ def trigger_kind
22
+ attributes.fetch(:triggerKind)
23
+ end
24
+
25
+ #
26
+ # The trigger character (a single character) that has trigger code complete.
27
+ # Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
28
+ #
29
+ # @return [string]
30
+ def trigger_character
31
+ attributes.fetch(:triggerCharacter)
32
+ end
33
+
34
+ attr_reader :attributes
35
+
36
+ def to_hash
37
+ attributes
38
+ end
39
+
40
+ def to_json(*args)
41
+ to_hash.to_json(*args)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -2,19 +2,21 @@ module LanguageServer
2
2
  module Protocol
3
3
  module Interface
4
4
  class CompletionItem
5
- def initialize(label:, kind: nil, detail: nil, documentation: nil, sort_text: nil, filter_text: nil, insert_text: nil, insert_text_format: nil, text_edit: nil, additional_text_edits: nil, command: nil, data: nil)
5
+ def initialize(label:, kind: nil, detail: nil, documentation: nil, deprecated: nil, sort_text: nil, filter_text: nil, insert_text: nil, insert_text_format: nil, text_edit: nil, additional_text_edits: nil, commit_characters: nil, command: nil, data: nil)
6
6
  @attributes = {}
7
7
 
8
8
  @attributes[:label] = label
9
9
  @attributes[:kind] = kind if kind
10
10
  @attributes[:detail] = detail if detail
11
11
  @attributes[:documentation] = documentation if documentation
12
+ @attributes[:deprecated] = deprecated if deprecated
12
13
  @attributes[:sortText] = sort_text if sort_text
13
14
  @attributes[:filterText] = filter_text if filter_text
14
15
  @attributes[:insertText] = insert_text if insert_text
15
16
  @attributes[:insertTextFormat] = insert_text_format if insert_text_format
16
17
  @attributes[:textEdit] = text_edit if text_edit
17
18
  @attributes[:additionalTextEdits] = additional_text_edits if additional_text_edits
19
+ @attributes[:commitCharacters] = commit_characters if commit_characters
18
20
  @attributes[:command] = command if command
19
21
  @attributes[:data] = data if data
20
22
 
@@ -52,13 +54,21 @@ module LanguageServer
52
54
  #
53
55
  # A human-readable string that represents a doc-comment.
54
56
  #
55
- # @return [string]
57
+ # @return [string | MarkupContent]
56
58
  def documentation
57
59
  attributes.fetch(:documentation)
58
60
  end
59
61
 
60
62
  #
61
- # A string that shoud be used when comparing this item
63
+ # Indicates if this item is deprecated.
64
+ #
65
+ # @return [boolean]
66
+ def deprecated
67
+ attributes.fetch(:deprecated)
68
+ end
69
+
70
+ #
71
+ # A string that should be used when comparing this item
62
72
  # with other items. When `falsy` the label is used.
63
73
  #
64
74
  # @return [string]
@@ -76,9 +86,16 @@ module LanguageServer
76
86
  end
77
87
 
78
88
  #
79
- # A string that should be inserted a document when selecting
89
+ # A string that should be inserted into a document when selecting
80
90
  # this completion. When `falsy` the label is used.
81
91
  #
92
+ # The `insertText` is subject to interpretation by the client side.
93
+ # Some tools might not take the string literally. For example
94
+ # VS Code when code complete is requested in this example `con<cursor position>`
95
+ # and a completion item with an `insertText` of `console` is provided it
96
+ # will only insert `sole`. Therefore it is recommended to use `textEdit` instead
97
+ # since it avoids additional client side interpretation.
98
+ #
82
99
  # @return [string]
83
100
  def insert_text
84
101
  attributes.fetch(:insertText)
@@ -107,14 +124,28 @@ module LanguageServer
107
124
 
108
125
  #
109
126
  # An optional array of additional text edits that are applied when
110
- # selecting this completion. Edits must not overlap with the main edit
111
- # nor with themselves.
127
+ # selecting this completion. Edits must not overlap (including the same insert position)
128
+ # with the main edit nor with themselves.
129
+ #
130
+ # Additional text edits should be used to change text unrelated to the current cursor position
131
+ # (for example adding an import statement at the top of the file if the completion item will
132
+ # insert an unqualified type).
112
133
  #
113
134
  # @return [TextEdit[]]
114
135
  def additional_text_edits
115
136
  attributes.fetch(:additionalTextEdits)
116
137
  end
117
138
 
139
+ #
140
+ # An optional set of characters that when pressed while this completion is active will accept it first and
141
+ # then type that character. *Note* that all commit characters should have `length=1` and that superfluous
142
+ # characters will be ignored.
143
+ #
144
+ # @return [string[]]
145
+ def commit_characters
146
+ attributes.fetch(:commitCharacters)
147
+ end
148
+
118
149
  #
119
150
  # An optional command that is executed *after* inserting this completion. *Note* that
120
151
  # additional modifications to the current document should be described with the
@@ -0,0 +1,34 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interface
4
+ class CompletionParams < TextDocumentPositionParams
5
+ def initialize(text_document:, position:, context: nil)
6
+ @attributes = {}
7
+
8
+ @attributes[:context] = context if context
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # The completion context. This is only available it the client specifies
15
+ # to send this using `ClientCapabilities.textDocument.completion.contextSupport === true`
16
+ #
17
+ # @return [CompletionContext]
18
+ def context
19
+ attributes.fetch(:context)
20
+ end
21
+
22
+ attr_reader :attributes
23
+
24
+ def to_hash
25
+ attributes
26
+ end
27
+
28
+ def to_json(*args)
29
+ to_hash.to_json(*args)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end