language_server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Dockerfile +13 -0
- data/Dockerfile.production +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +10 -0
- data/bin/console +11 -0
- data/bin/generate_files +3 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +20 -0
- data/exe/language_server +8 -0
- data/language_server.gemspec +28 -0
- data/lib/language_server/protocol/constants/completion_item_kind.rb +29 -0
- data/lib/language_server/protocol/constants/diagnostic_severity.rb +24 -0
- data/lib/language_server/protocol/constants/document_highlight_kind.rb +23 -0
- data/lib/language_server/protocol/constants/error_codes.rb +18 -0
- data/lib/language_server/protocol/constants/file_change_type.rb +23 -0
- data/lib/language_server/protocol/constants/initialize_error.rb +15 -0
- data/lib/language_server/protocol/constants/insert_text_format.rb +27 -0
- data/lib/language_server/protocol/constants/message_type.rb +24 -0
- data/lib/language_server/protocol/constants/symbol_kind.rb +29 -0
- data/lib/language_server/protocol/constants/text_document_save_reason.rb +24 -0
- data/lib/language_server/protocol/constants/text_document_sync_kind.rb +26 -0
- data/lib/language_server/protocol/constants.rb +11 -0
- data/lib/language_server/protocol/interfaces/apply_workspace_edit_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/apply_workspace_edit_response.rb +29 -0
- data/lib/language_server/protocol/interfaces/cancel_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/client_capabilities.rb +47 -0
- data/lib/language_server/protocol/interfaces/code_action_context.rb +33 -0
- data/lib/language_server/protocol/interfaces/code_action_params.rb +50 -0
- data/lib/language_server/protocol/interfaces/code_lens.rb +55 -0
- data/lib/language_server/protocol/interfaces/code_lens_options.rb +32 -0
- data/lib/language_server/protocol/interfaces/code_lens_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/code_lens_registration_options.rb +29 -0
- data/lib/language_server/protocol/interfaces/command.rb +48 -0
- data/lib/language_server/protocol/interfaces/completion_item.rb +145 -0
- data/lib/language_server/protocol/interfaces/completion_list.rb +43 -0
- data/lib/language_server/protocol/interfaces/completion_options.rb +42 -0
- data/lib/language_server/protocol/interfaces/completion_registration_options.rb +39 -0
- data/lib/language_server/protocol/interfaces/diagnostic.rb +67 -0
- data/lib/language_server/protocol/interfaces/did_change_configuration_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/did_change_text_document_params.rb +40 -0
- data/lib/language_server/protocol/interfaces/did_change_watched_files_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/did_close_text_document_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/did_open_text_document_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/did_save_text_document_params.rb +39 -0
- data/lib/language_server/protocol/interfaces/document_filter.rb +47 -0
- data/lib/language_server/protocol/interfaces/document_formatting_params.rb +38 -0
- data/lib/language_server/protocol/interfaces/document_highlight.rb +43 -0
- data/lib/language_server/protocol/interfaces/document_link.rb +42 -0
- data/lib/language_server/protocol/interfaces/document_link_options.rb +32 -0
- data/lib/language_server/protocol/interfaces/document_link_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/document_link_registration_options.rb +29 -0
- data/lib/language_server/protocol/interfaces/document_on_type_formatting_options.rb +41 -0
- data/lib/language_server/protocol/interfaces/document_on_type_formatting_params.rb +56 -0
- data/lib/language_server/protocol/interfaces/document_on_type_formatting_registration_options.rb +38 -0
- data/lib/language_server/protocol/interfaces/document_range_formatting_params.rb +47 -0
- data/lib/language_server/protocol/interfaces/document_symbol_params.rb +29 -0
- data/lib/language_server/protocol/interfaces/execute_command_options.rb +32 -0
- data/lib/language_server/protocol/interfaces/execute_command_params.rb +38 -0
- data/lib/language_server/protocol/interfaces/execute_command_registration_options.rb +32 -0
- data/lib/language_server/protocol/interfaces/file_event.rb +41 -0
- data/lib/language_server/protocol/interfaces/formatting_options.rb +41 -0
- data/lib/language_server/protocol/interfaces/hover.rb +42 -0
- data/lib/language_server/protocol/interfaces/initialize_error.rb +35 -0
- data/lib/language_server/protocol/interfaces/initialize_params.rb +79 -0
- data/lib/language_server/protocol/interfaces/initialize_result.rb +29 -0
- data/lib/language_server/protocol/interfaces/location.rb +32 -0
- data/lib/language_server/protocol/interfaces/log_message_params.rb +38 -0
- data/lib/language_server/protocol/interfaces/message.rb +26 -0
- data/lib/language_server/protocol/interfaces/message_action_item.rb +29 -0
- data/lib/language_server/protocol/interfaces/notification_message.rb +38 -0
- data/lib/language_server/protocol/interfaces/parameter_information.rb +44 -0
- data/lib/language_server/protocol/interfaces/position.rb +38 -0
- data/lib/language_server/protocol/interfaces/publish_diagnostics_params.rb +38 -0
- data/lib/language_server/protocol/interfaces/range.rb +38 -0
- data/lib/language_server/protocol/interfaces/reference_context.rb +29 -0
- data/lib/language_server/protocol/interfaces/reference_params.rb +26 -0
- data/lib/language_server/protocol/interfaces/registration.rb +51 -0
- data/lib/language_server/protocol/interfaces/registration_params.rb +26 -0
- data/lib/language_server/protocol/interfaces/rename_params.rb +49 -0
- data/lib/language_server/protocol/interfaces/request_message.rb +47 -0
- data/lib/language_server/protocol/interfaces/response_error.rb +48 -0
- data/lib/language_server/protocol/interfaces/response_message.rb +48 -0
- data/lib/language_server/protocol/interfaces/save_options.rb +32 -0
- data/lib/language_server/protocol/interfaces/server_capabilities.rb +183 -0
- data/lib/language_server/protocol/interfaces/show_message_params.rb +38 -0
- data/lib/language_server/protocol/interfaces/show_message_request_params.rb +47 -0
- data/lib/language_server/protocol/interfaces/signature_help.rb +64 -0
- data/lib/language_server/protocol/interfaces/signature_help_options.rb +33 -0
- data/lib/language_server/protocol/interfaces/signature_help_registration_options.rb +30 -0
- data/lib/language_server/protocol/interfaces/signature_information.rb +54 -0
- data/lib/language_server/protocol/interfaces/symbol_information.rb +60 -0
- data/lib/language_server/protocol/interfaces/text_document_change_registration_options.rb +33 -0
- data/lib/language_server/protocol/interfaces/text_document_client_capabilities.rb +155 -0
- data/lib/language_server/protocol/interfaces/text_document_content_change_event.rb +51 -0
- data/lib/language_server/protocol/interfaces/text_document_edit.rb +38 -0
- data/lib/language_server/protocol/interfaces/text_document_identifier.rb +29 -0
- data/lib/language_server/protocol/interfaces/text_document_item.rb +57 -0
- data/lib/language_server/protocol/interfaces/text_document_position_params.rb +38 -0
- data/lib/language_server/protocol/interfaces/text_document_registration_options.rb +30 -0
- data/lib/language_server/protocol/interfaces/text_document_save_registration_options.rb +29 -0
- data/lib/language_server/protocol/interfaces/text_document_sync_options.rb +66 -0
- data/lib/language_server/protocol/interfaces/text_edit.rb +40 -0
- data/lib/language_server/protocol/interfaces/unregistration.rb +42 -0
- data/lib/language_server/protocol/interfaces/unregistration_params.rb +26 -0
- data/lib/language_server/protocol/interfaces/versioned_text_document_identifier.rb +29 -0
- data/lib/language_server/protocol/interfaces/will_save_text_document_params.rb +41 -0
- data/lib/language_server/protocol/interfaces/workspace_client_capabilites.rb +78 -0
- data/lib/language_server/protocol/interfaces/workspace_edit.rb +40 -0
- data/lib/language_server/protocol/interfaces/workspace_symbol_params.rb +32 -0
- data/lib/language_server/protocol/interfaces.rb +87 -0
- data/lib/language_server/version.rb +3 -0
- data/lib/language_server.rb +176 -0
- data/package.json +10 -0
- data/scripts/generateFiles.ts +224 -0
- data/yarn.lock +295 -0
- metadata +220 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class SignatureHelpRegistrationOptions
|
|
5
|
+
def initialize(trigger_characters: nil)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:triggerCharacters] = trigger_characters if trigger_characters
|
|
9
|
+
|
|
10
|
+
@attributes.freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# The characters that trigger signature help
|
|
15
|
+
# automatically.
|
|
16
|
+
#
|
|
17
|
+
# @return [string[]]
|
|
18
|
+
def trigger_characters
|
|
19
|
+
attributes.fetch(:triggerCharacters)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attr_reader :attributes
|
|
23
|
+
|
|
24
|
+
def to_json(*args)
|
|
25
|
+
attributes.to_json(*args)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
#
|
|
5
|
+
# Represents the signature of something callable. A signature
|
|
6
|
+
# can have a label, like a function-name, a doc-comment, and
|
|
7
|
+
# a set of parameters.
|
|
8
|
+
#
|
|
9
|
+
class SignatureInformation
|
|
10
|
+
def initialize(label:, documentation: nil, parameters: nil)
|
|
11
|
+
@attributes = {}
|
|
12
|
+
|
|
13
|
+
@attributes[:label] = label
|
|
14
|
+
@attributes[:documentation] = documentation if documentation
|
|
15
|
+
@attributes[:parameters] = parameters if parameters
|
|
16
|
+
|
|
17
|
+
@attributes.freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# The label of this signature. Will be shown in
|
|
22
|
+
# the UI.
|
|
23
|
+
#
|
|
24
|
+
# @return [string]
|
|
25
|
+
def label
|
|
26
|
+
attributes.fetch(:label)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#
|
|
30
|
+
# The human-readable doc-comment of this signature. Will be shown
|
|
31
|
+
# in the UI but can be omitted.
|
|
32
|
+
#
|
|
33
|
+
# @return [string]
|
|
34
|
+
def documentation
|
|
35
|
+
attributes.fetch(:documentation)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# The parameters of this signature.
|
|
40
|
+
#
|
|
41
|
+
# @return [ParameterInformation[]]
|
|
42
|
+
def parameters
|
|
43
|
+
attributes.fetch(:parameters)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
attr_reader :attributes
|
|
47
|
+
|
|
48
|
+
def to_json(*args)
|
|
49
|
+
attributes.to_json(*args)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
#
|
|
5
|
+
# Represents information about programming constructs like variables, classes,
|
|
6
|
+
# interfaces etc.
|
|
7
|
+
#
|
|
8
|
+
class SymbolInformation
|
|
9
|
+
def initialize(name:, kind:, location:, container_name: nil)
|
|
10
|
+
@attributes = {}
|
|
11
|
+
|
|
12
|
+
@attributes[:name] = name
|
|
13
|
+
@attributes[:kind] = kind
|
|
14
|
+
@attributes[:location] = location
|
|
15
|
+
@attributes[:containerName] = container_name if container_name
|
|
16
|
+
|
|
17
|
+
@attributes.freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# The name of this symbol.
|
|
22
|
+
#
|
|
23
|
+
# @return [string]
|
|
24
|
+
def name
|
|
25
|
+
attributes.fetch(:name)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#
|
|
29
|
+
# The kind of this symbol.
|
|
30
|
+
#
|
|
31
|
+
# @return [number]
|
|
32
|
+
def kind
|
|
33
|
+
attributes.fetch(:kind)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#
|
|
37
|
+
# The location of this symbol.
|
|
38
|
+
#
|
|
39
|
+
# @return [Location]
|
|
40
|
+
def location
|
|
41
|
+
attributes.fetch(:location)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
#
|
|
45
|
+
# The name of the symbol containing this symbol.
|
|
46
|
+
#
|
|
47
|
+
# @return [string]
|
|
48
|
+
def container_name
|
|
49
|
+
attributes.fetch(:containerName)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
attr_reader :attributes
|
|
53
|
+
|
|
54
|
+
def to_json(*args)
|
|
55
|
+
attributes.to_json(*args)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
#
|
|
5
|
+
# Descibe options to be used when registered for text document change events.
|
|
6
|
+
#
|
|
7
|
+
class TextDocumentChangeRegistrationOptions
|
|
8
|
+
def initialize(sync_kind:)
|
|
9
|
+
@attributes = {}
|
|
10
|
+
|
|
11
|
+
@attributes[:syncKind] = sync_kind
|
|
12
|
+
|
|
13
|
+
@attributes.freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# How documents are synced to the server. See TextDocumentSyncKind.Full
|
|
18
|
+
# and TextDocumentSyncKindIncremental.
|
|
19
|
+
#
|
|
20
|
+
# @return [number]
|
|
21
|
+
def sync_kind
|
|
22
|
+
attributes.fetch(:syncKind)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
attr_reader :attributes
|
|
26
|
+
|
|
27
|
+
def to_json(*args)
|
|
28
|
+
attributes.to_json(*args)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
#
|
|
5
|
+
# Text document specific client capabilities.
|
|
6
|
+
#
|
|
7
|
+
class TextDocumentClientCapabilities
|
|
8
|
+
def initialize(synchronization: nil, completion: nil, hover: nil, signature_help: nil, references: nil, document_highlight: nil, document_symbol: nil, formatting: nil, range_formatting: nil, on_type_formatting: nil, definition: nil, code_action: nil, code_lens: nil, document_link: nil, rename: nil)
|
|
9
|
+
@attributes = {}
|
|
10
|
+
|
|
11
|
+
@attributes[:synchronization] = synchronization if synchronization
|
|
12
|
+
@attributes[:completion] = completion if completion
|
|
13
|
+
@attributes[:hover] = hover if hover
|
|
14
|
+
@attributes[:signatureHelp] = signature_help if signature_help
|
|
15
|
+
@attributes[:references] = references if references
|
|
16
|
+
@attributes[:documentHighlight] = document_highlight if document_highlight
|
|
17
|
+
@attributes[:documentSymbol] = document_symbol if document_symbol
|
|
18
|
+
@attributes[:formatting] = formatting if formatting
|
|
19
|
+
@attributes[:rangeFormatting] = range_formatting if range_formatting
|
|
20
|
+
@attributes[:onTypeFormatting] = on_type_formatting if on_type_formatting
|
|
21
|
+
@attributes[:definition] = definition if definition
|
|
22
|
+
@attributes[:codeAction] = code_action if code_action
|
|
23
|
+
@attributes[:codeLens] = code_lens if code_lens
|
|
24
|
+
@attributes[:documentLink] = document_link if document_link
|
|
25
|
+
@attributes[:rename] = rename if rename
|
|
26
|
+
|
|
27
|
+
@attributes.freeze
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @return [{ dynamicRegistration?: boolean; willSave?: boolean; willSaveWaitUntil?: boolean; didSave?: boole...]
|
|
31
|
+
def synchronization
|
|
32
|
+
attributes.fetch(:synchronization)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
#
|
|
36
|
+
# Capabilities specific to the `textDocument/completion`
|
|
37
|
+
#
|
|
38
|
+
# @return [{ dynamicRegistration?: boolean; completionItem?: { snippetSupport?: boolean; }; }]
|
|
39
|
+
def completion
|
|
40
|
+
attributes.fetch(:completion)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#
|
|
44
|
+
# Capabilities specific to the `textDocument/hover`
|
|
45
|
+
#
|
|
46
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
47
|
+
def hover
|
|
48
|
+
attributes.fetch(:hover)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
#
|
|
52
|
+
# Capabilities specific to the `textDocument/signatureHelp`
|
|
53
|
+
#
|
|
54
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
55
|
+
def signature_help
|
|
56
|
+
attributes.fetch(:signatureHelp)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
#
|
|
60
|
+
# Capabilities specific to the `textDocument/references`
|
|
61
|
+
#
|
|
62
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
63
|
+
def references
|
|
64
|
+
attributes.fetch(:references)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
#
|
|
68
|
+
# Capabilities specific to the `textDocument/documentHighlight`
|
|
69
|
+
#
|
|
70
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
71
|
+
def document_highlight
|
|
72
|
+
attributes.fetch(:documentHighlight)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#
|
|
76
|
+
# Capabilities specific to the `textDocument/documentSymbol`
|
|
77
|
+
#
|
|
78
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
79
|
+
def document_symbol
|
|
80
|
+
attributes.fetch(:documentSymbol)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
#
|
|
84
|
+
# Capabilities specific to the `textDocument/formatting`
|
|
85
|
+
#
|
|
86
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
87
|
+
def formatting
|
|
88
|
+
attributes.fetch(:formatting)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
# Capabilities specific to the `textDocument/rangeFormatting`
|
|
93
|
+
#
|
|
94
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
95
|
+
def range_formatting
|
|
96
|
+
attributes.fetch(:rangeFormatting)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
#
|
|
100
|
+
# Capabilities specific to the `textDocument/onTypeFormatting`
|
|
101
|
+
#
|
|
102
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
103
|
+
def on_type_formatting
|
|
104
|
+
attributes.fetch(:onTypeFormatting)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
#
|
|
108
|
+
# Capabilities specific to the `textDocument/definition`
|
|
109
|
+
#
|
|
110
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
111
|
+
def definition
|
|
112
|
+
attributes.fetch(:definition)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
#
|
|
116
|
+
# Capabilities specific to the `textDocument/codeAction`
|
|
117
|
+
#
|
|
118
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
119
|
+
def code_action
|
|
120
|
+
attributes.fetch(:codeAction)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
#
|
|
124
|
+
# Capabilities specific to the `textDocument/codeLens`
|
|
125
|
+
#
|
|
126
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
127
|
+
def code_lens
|
|
128
|
+
attributes.fetch(:codeLens)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
#
|
|
132
|
+
# Capabilities specific to the `textDocument/documentLink`
|
|
133
|
+
#
|
|
134
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
135
|
+
def document_link
|
|
136
|
+
attributes.fetch(:documentLink)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
#
|
|
140
|
+
# Capabilities specific to the `textDocument/rename`
|
|
141
|
+
#
|
|
142
|
+
# @return [{ dynamicRegistration?: boolean; }]
|
|
143
|
+
def rename
|
|
144
|
+
attributes.fetch(:rename)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
attr_reader :attributes
|
|
148
|
+
|
|
149
|
+
def to_json(*args)
|
|
150
|
+
attributes.to_json(*args)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
#
|
|
5
|
+
# An event describing a change to a text document. If range and rangeLength are omitted
|
|
6
|
+
# the new text is considered to be the full content of the document.
|
|
7
|
+
#
|
|
8
|
+
class TextDocumentContentChangeEvent
|
|
9
|
+
def initialize(range: nil, range_length: nil, text:)
|
|
10
|
+
@attributes = {}
|
|
11
|
+
|
|
12
|
+
@attributes[:range] = range if range
|
|
13
|
+
@attributes[:rangeLength] = range_length if range_length
|
|
14
|
+
@attributes[:text] = text
|
|
15
|
+
|
|
16
|
+
@attributes.freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#
|
|
20
|
+
# The range of the document that changed.
|
|
21
|
+
#
|
|
22
|
+
# @return [Range]
|
|
23
|
+
def range
|
|
24
|
+
attributes.fetch(:range)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# The length of the range that got replaced.
|
|
29
|
+
#
|
|
30
|
+
# @return [number]
|
|
31
|
+
def range_length
|
|
32
|
+
attributes.fetch(:rangeLength)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
#
|
|
36
|
+
# The new text of the range/document.
|
|
37
|
+
#
|
|
38
|
+
# @return [string]
|
|
39
|
+
def text
|
|
40
|
+
attributes.fetch(:text)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
attr_reader :attributes
|
|
44
|
+
|
|
45
|
+
def to_json(*args)
|
|
46
|
+
attributes.to_json(*args)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentEdit
|
|
5
|
+
def initialize(text_document:, edits:)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:textDocument] = text_document
|
|
9
|
+
@attributes[:edits] = edits
|
|
10
|
+
|
|
11
|
+
@attributes.freeze
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
#
|
|
15
|
+
# The text document to change.
|
|
16
|
+
#
|
|
17
|
+
# @return [VersionedTextDocumentIdentifier]
|
|
18
|
+
def text_document
|
|
19
|
+
attributes.fetch(:textDocument)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
# The edits to be applied.
|
|
24
|
+
#
|
|
25
|
+
# @return [TextEdit[]]
|
|
26
|
+
def edits
|
|
27
|
+
attributes.fetch(:edits)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
attr_reader :attributes
|
|
31
|
+
|
|
32
|
+
def to_json(*args)
|
|
33
|
+
attributes.to_json(*args)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentIdentifier
|
|
5
|
+
def initialize(uri:)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:uri] = uri
|
|
9
|
+
|
|
10
|
+
@attributes.freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# The text document's URI.
|
|
15
|
+
#
|
|
16
|
+
# @return [string]
|
|
17
|
+
def uri
|
|
18
|
+
attributes.fetch(:uri)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
attr_reader :attributes
|
|
22
|
+
|
|
23
|
+
def to_json(*args)
|
|
24
|
+
attributes.to_json(*args)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentItem
|
|
5
|
+
def initialize(uri:, language_id:, version:, text:)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:uri] = uri
|
|
9
|
+
@attributes[:languageId] = language_id
|
|
10
|
+
@attributes[:version] = version
|
|
11
|
+
@attributes[:text] = text
|
|
12
|
+
|
|
13
|
+
@attributes.freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# The text document's URI.
|
|
18
|
+
#
|
|
19
|
+
# @return [string]
|
|
20
|
+
def uri
|
|
21
|
+
attributes.fetch(:uri)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# The text document's language identifier.
|
|
26
|
+
#
|
|
27
|
+
# @return [string]
|
|
28
|
+
def language_id
|
|
29
|
+
attributes.fetch(:languageId)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#
|
|
33
|
+
# The version number of this document (it will strictly increase after each
|
|
34
|
+
# change, including undo/redo).
|
|
35
|
+
#
|
|
36
|
+
# @return [number]
|
|
37
|
+
def version
|
|
38
|
+
attributes.fetch(:version)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
#
|
|
42
|
+
# The content of the opened text document.
|
|
43
|
+
#
|
|
44
|
+
# @return [string]
|
|
45
|
+
def text
|
|
46
|
+
attributes.fetch(:text)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
attr_reader :attributes
|
|
50
|
+
|
|
51
|
+
def to_json(*args)
|
|
52
|
+
attributes.to_json(*args)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentPositionParams
|
|
5
|
+
def initialize(text_document:, position:)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:textDocument] = text_document
|
|
9
|
+
@attributes[:position] = position
|
|
10
|
+
|
|
11
|
+
@attributes.freeze
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
#
|
|
15
|
+
# The text document.
|
|
16
|
+
#
|
|
17
|
+
# @return [TextDocumentIdentifier]
|
|
18
|
+
def text_document
|
|
19
|
+
attributes.fetch(:textDocument)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
# The position inside the text document.
|
|
24
|
+
#
|
|
25
|
+
# @return [Position]
|
|
26
|
+
def position
|
|
27
|
+
attributes.fetch(:position)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
attr_reader :attributes
|
|
31
|
+
|
|
32
|
+
def to_json(*args)
|
|
33
|
+
attributes.to_json(*args)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentRegistrationOptions
|
|
5
|
+
def initialize(document_selector:)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:documentSelector] = document_selector
|
|
9
|
+
|
|
10
|
+
@attributes.freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# A document selector to identify the scope of the registration. If set to null
|
|
15
|
+
# the document selector provided on the client side will be used.
|
|
16
|
+
#
|
|
17
|
+
# @return [DocumentFilter[]]
|
|
18
|
+
def document_selector
|
|
19
|
+
attributes.fetch(:documentSelector)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attr_reader :attributes
|
|
23
|
+
|
|
24
|
+
def to_json(*args)
|
|
25
|
+
attributes.to_json(*args)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentSaveRegistrationOptions
|
|
5
|
+
def initialize(include_text: nil)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:includeText] = include_text if include_text
|
|
9
|
+
|
|
10
|
+
@attributes.freeze
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#
|
|
14
|
+
# The client is supposed to include the content on save.
|
|
15
|
+
#
|
|
16
|
+
# @return [boolean]
|
|
17
|
+
def include_text
|
|
18
|
+
attributes.fetch(:includeText)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
attr_reader :attributes
|
|
22
|
+
|
|
23
|
+
def to_json(*args)
|
|
24
|
+
attributes.to_json(*args)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
module LanguageServer
|
|
2
|
+
module Protocol
|
|
3
|
+
module Interfaces
|
|
4
|
+
class TextDocumentSyncOptions
|
|
5
|
+
def initialize(open_close: nil, change: nil, will_save: nil, will_save_wait_until: nil, save: nil)
|
|
6
|
+
@attributes = {}
|
|
7
|
+
|
|
8
|
+
@attributes[:openClose] = open_close if open_close
|
|
9
|
+
@attributes[:change] = change if change
|
|
10
|
+
@attributes[:willSave] = will_save if will_save
|
|
11
|
+
@attributes[:willSaveWaitUntil] = will_save_wait_until if will_save_wait_until
|
|
12
|
+
@attributes[:save] = save if save
|
|
13
|
+
|
|
14
|
+
@attributes.freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
# Open and close notifications are sent to the server.
|
|
19
|
+
#
|
|
20
|
+
# @return [boolean]
|
|
21
|
+
def open_close
|
|
22
|
+
attributes.fetch(:openClose)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# Change notificatins are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
|
|
27
|
+
# and TextDocumentSyncKindIncremental.
|
|
28
|
+
#
|
|
29
|
+
# @return [number]
|
|
30
|
+
def change
|
|
31
|
+
attributes.fetch(:change)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# Will save notifications are sent to the server.
|
|
36
|
+
#
|
|
37
|
+
# @return [boolean]
|
|
38
|
+
def will_save
|
|
39
|
+
attributes.fetch(:willSave)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Will save wait until requests are sent to the server.
|
|
44
|
+
#
|
|
45
|
+
# @return [boolean]
|
|
46
|
+
def will_save_wait_until
|
|
47
|
+
attributes.fetch(:willSaveWaitUntil)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
#
|
|
51
|
+
# Save notifications are sent to the server.
|
|
52
|
+
#
|
|
53
|
+
# @return [SaveOptions]
|
|
54
|
+
def save
|
|
55
|
+
attributes.fetch(:save)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
attr_reader :attributes
|
|
59
|
+
|
|
60
|
+
def to_json(*args)
|
|
61
|
+
attributes.to_json(*args)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|