language_server 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,47 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class ClientCapabilities
|
5
|
+
def initialize(workspace: nil, text_document: nil, experimental: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:workspace] = workspace if workspace
|
9
|
+
@attributes[:textDocument] = text_document if text_document
|
10
|
+
@attributes[:experimental] = experimental if experimental
|
11
|
+
|
12
|
+
@attributes.freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# Workspace specific client capabilities.
|
17
|
+
#
|
18
|
+
# @return [WorkspaceClientCapabilites]
|
19
|
+
def workspace
|
20
|
+
attributes.fetch(:workspace)
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# Text document specific client capabilities.
|
25
|
+
#
|
26
|
+
# @return [TextDocumentClientCapabilities]
|
27
|
+
def text_document
|
28
|
+
attributes.fetch(:textDocument)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Experimental client capabilities.
|
33
|
+
#
|
34
|
+
# @return [any]
|
35
|
+
def experimental
|
36
|
+
attributes.fetch(:experimental)
|
37
|
+
end
|
38
|
+
|
39
|
+
attr_reader :attributes
|
40
|
+
|
41
|
+
def to_json(*args)
|
42
|
+
attributes.to_json(*args)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Contains additional diagnostic information about the context in which
|
6
|
+
# a code action is run.
|
7
|
+
#
|
8
|
+
class CodeActionContext
|
9
|
+
def initialize(diagnostics:)
|
10
|
+
@attributes = {}
|
11
|
+
|
12
|
+
@attributes[:diagnostics] = diagnostics
|
13
|
+
|
14
|
+
@attributes.freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# An array of diagnostics.
|
19
|
+
#
|
20
|
+
# @return [Diagnostic[]]
|
21
|
+
def diagnostics
|
22
|
+
attributes.fetch(:diagnostics)
|
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,50 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Params for the CodeActionRequest
|
6
|
+
#
|
7
|
+
class CodeActionParams
|
8
|
+
def initialize(text_document:, range:, context:)
|
9
|
+
@attributes = {}
|
10
|
+
|
11
|
+
@attributes[:textDocument] = text_document
|
12
|
+
@attributes[:range] = range
|
13
|
+
@attributes[:context] = context
|
14
|
+
|
15
|
+
@attributes.freeze
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# The document in which the command was invoked.
|
20
|
+
#
|
21
|
+
# @return [TextDocumentIdentifier]
|
22
|
+
def text_document
|
23
|
+
attributes.fetch(:textDocument)
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# The range for which the command was invoked.
|
28
|
+
#
|
29
|
+
# @return [Range]
|
30
|
+
def range
|
31
|
+
attributes.fetch(:range)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Context carrying additional information.
|
36
|
+
#
|
37
|
+
# @return [CodeActionContext]
|
38
|
+
def context
|
39
|
+
attributes.fetch(:context)
|
40
|
+
end
|
41
|
+
|
42
|
+
attr_reader :attributes
|
43
|
+
|
44
|
+
def to_json(*args)
|
45
|
+
attributes.to_json(*args)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# A code lens represents a command that should be shown along with
|
6
|
+
# source text, like the number of references, a way to run tests, etc.
|
7
|
+
#
|
8
|
+
# A code lens is _unresolved_ when no command is associated to it. For performance
|
9
|
+
# reasons the creation of a code lens and resolving should be done in two stages.
|
10
|
+
#
|
11
|
+
class CodeLens
|
12
|
+
def initialize(range:, command: nil, data: nil)
|
13
|
+
@attributes = {}
|
14
|
+
|
15
|
+
@attributes[:range] = range
|
16
|
+
@attributes[:command] = command if command
|
17
|
+
@attributes[:data] = data if data
|
18
|
+
|
19
|
+
@attributes.freeze
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# The range in which this code lens is valid. Should only span a single line.
|
24
|
+
#
|
25
|
+
# @return [Range]
|
26
|
+
def range
|
27
|
+
attributes.fetch(:range)
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# The command this code lens represents.
|
32
|
+
#
|
33
|
+
# @return [Command]
|
34
|
+
def command
|
35
|
+
attributes.fetch(:command)
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# A data entry field that is preserved on a code lens item between
|
40
|
+
# a code lens and a code lens resolve request.
|
41
|
+
#
|
42
|
+
# @return [any]
|
43
|
+
def data
|
44
|
+
attributes.fetch(:data)
|
45
|
+
end
|
46
|
+
|
47
|
+
attr_reader :attributes
|
48
|
+
|
49
|
+
def to_json(*args)
|
50
|
+
attributes.to_json(*args)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Code Lens options.
|
6
|
+
#
|
7
|
+
class CodeLensOptions
|
8
|
+
def initialize(resolve_provider: nil)
|
9
|
+
@attributes = {}
|
10
|
+
|
11
|
+
@attributes[:resolveProvider] = resolve_provider if resolve_provider
|
12
|
+
|
13
|
+
@attributes.freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# Code lens has a resolve provider as well.
|
18
|
+
#
|
19
|
+
# @return [boolean]
|
20
|
+
def resolve_provider
|
21
|
+
attributes.fetch(:resolveProvider)
|
22
|
+
end
|
23
|
+
|
24
|
+
attr_reader :attributes
|
25
|
+
|
26
|
+
def to_json(*args)
|
27
|
+
attributes.to_json(*args)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class CodeLensParams
|
5
|
+
def initialize(text_document:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The document to request code lens for.
|
15
|
+
#
|
16
|
+
# @return [TextDocumentIdentifier]
|
17
|
+
def text_document
|
18
|
+
attributes.fetch(:textDocument)
|
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,29 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class CodeLensRegistrationOptions
|
5
|
+
def initialize(resolve_provider: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:resolveProvider] = resolve_provider if resolve_provider
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Code lens has a resolve provider as well.
|
15
|
+
#
|
16
|
+
# @return [boolean]
|
17
|
+
def resolve_provider
|
18
|
+
attributes.fetch(:resolveProvider)
|
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,48 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class Command
|
5
|
+
def initialize(title:, command:, arguments: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:title] = title
|
9
|
+
@attributes[:command] = command
|
10
|
+
@attributes[:arguments] = arguments if arguments
|
11
|
+
|
12
|
+
@attributes.freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# Title of the command, like `save`.
|
17
|
+
#
|
18
|
+
# @return [string]
|
19
|
+
def title
|
20
|
+
attributes.fetch(:title)
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# The identifier of the actual command handler.
|
25
|
+
#
|
26
|
+
# @return [string]
|
27
|
+
def command
|
28
|
+
attributes.fetch(:command)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Arguments that the command handler should be
|
33
|
+
# invoked with.
|
34
|
+
#
|
35
|
+
# @return [any[]]
|
36
|
+
def arguments
|
37
|
+
attributes.fetch(:arguments)
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_reader :attributes
|
41
|
+
|
42
|
+
def to_json(*args)
|
43
|
+
attributes.to_json(*args)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
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)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:label] = label
|
9
|
+
@attributes[:kind] = kind if kind
|
10
|
+
@attributes[:detail] = detail if detail
|
11
|
+
@attributes[:documentation] = documentation if documentation
|
12
|
+
@attributes[:sortText] = sort_text if sort_text
|
13
|
+
@attributes[:filterText] = filter_text if filter_text
|
14
|
+
@attributes[:insertText] = insert_text if insert_text
|
15
|
+
@attributes[:insertTextFormat] = insert_text_format if insert_text_format
|
16
|
+
@attributes[:textEdit] = text_edit if text_edit
|
17
|
+
@attributes[:additionalTextEdits] = additional_text_edits if additional_text_edits
|
18
|
+
@attributes[:command] = command if command
|
19
|
+
@attributes[:data] = data if data
|
20
|
+
|
21
|
+
@attributes.freeze
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# The label of this completion item. By default
|
26
|
+
# also the text that is inserted when selecting
|
27
|
+
# this completion.
|
28
|
+
#
|
29
|
+
# @return [string]
|
30
|
+
def label
|
31
|
+
attributes.fetch(:label)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# The kind of this completion item. Based of the kind
|
36
|
+
# an icon is chosen by the editor.
|
37
|
+
#
|
38
|
+
# @return [number]
|
39
|
+
def kind
|
40
|
+
attributes.fetch(:kind)
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# A human-readable string with additional information
|
45
|
+
# about this item, like type or symbol information.
|
46
|
+
#
|
47
|
+
# @return [string]
|
48
|
+
def detail
|
49
|
+
attributes.fetch(:detail)
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# A human-readable string that represents a doc-comment.
|
54
|
+
#
|
55
|
+
# @return [string]
|
56
|
+
def documentation
|
57
|
+
attributes.fetch(:documentation)
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# A string that shoud be used when comparing this item
|
62
|
+
# with other items. When `falsy` the label is used.
|
63
|
+
#
|
64
|
+
# @return [string]
|
65
|
+
def sort_text
|
66
|
+
attributes.fetch(:sortText)
|
67
|
+
end
|
68
|
+
|
69
|
+
#
|
70
|
+
# A string that should be used when filtering a set of
|
71
|
+
# completion items. When `falsy` the label is used.
|
72
|
+
#
|
73
|
+
# @return [string]
|
74
|
+
def filter_text
|
75
|
+
attributes.fetch(:filterText)
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# A string that should be inserted a document when selecting
|
80
|
+
# this completion. When `falsy` the label is used.
|
81
|
+
#
|
82
|
+
# @return [string]
|
83
|
+
def insert_text
|
84
|
+
attributes.fetch(:insertText)
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# The format of the insert text. The format applies to both the `insertText` property
|
89
|
+
# and the `newText` property of a provided `textEdit`.
|
90
|
+
#
|
91
|
+
# @return [InsertTextFormat]
|
92
|
+
def insert_text_format
|
93
|
+
attributes.fetch(:insertTextFormat)
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# An edit which is applied to a document when selecting this completion. When an edit is provided the value of
|
98
|
+
# `insertText` is ignored.
|
99
|
+
#
|
100
|
+
# *Note:* The range of the edit must be a single line range and it must contain the position at which completion
|
101
|
+
# has been requested.
|
102
|
+
#
|
103
|
+
# @return [TextEdit]
|
104
|
+
def text_edit
|
105
|
+
attributes.fetch(:textEdit)
|
106
|
+
end
|
107
|
+
|
108
|
+
#
|
109
|
+
# 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.
|
112
|
+
#
|
113
|
+
# @return [TextEdit[]]
|
114
|
+
def additional_text_edits
|
115
|
+
attributes.fetch(:additionalTextEdits)
|
116
|
+
end
|
117
|
+
|
118
|
+
#
|
119
|
+
# An optional command that is executed *after* inserting this completion. *Note* that
|
120
|
+
# additional modifications to the current document should be described with the
|
121
|
+
# additionalTextEdits-property.
|
122
|
+
#
|
123
|
+
# @return [Command]
|
124
|
+
def command
|
125
|
+
attributes.fetch(:command)
|
126
|
+
end
|
127
|
+
|
128
|
+
#
|
129
|
+
# An data entry field that is preserved on a completion item between
|
130
|
+
# a completion and a completion resolve request.
|
131
|
+
#
|
132
|
+
# @return [any]
|
133
|
+
def data
|
134
|
+
attributes.fetch(:data)
|
135
|
+
end
|
136
|
+
|
137
|
+
attr_reader :attributes
|
138
|
+
|
139
|
+
def to_json(*args)
|
140
|
+
attributes.to_json(*args)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Represents a collection of [completion items](#CompletionItem) to be presented
|
6
|
+
# in the editor.
|
7
|
+
#
|
8
|
+
class CompletionList
|
9
|
+
def initialize(is_incomplete:, items:)
|
10
|
+
@attributes = {}
|
11
|
+
|
12
|
+
@attributes[:isIncomplete] = is_incomplete
|
13
|
+
@attributes[:items] = items
|
14
|
+
|
15
|
+
@attributes.freeze
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# This list it not complete. Further typing should result in recomputing
|
20
|
+
# this list.
|
21
|
+
#
|
22
|
+
# @return [boolean]
|
23
|
+
def is_incomplete
|
24
|
+
attributes.fetch(:isIncomplete)
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# The completion items.
|
29
|
+
#
|
30
|
+
# @return [CompletionItem[]]
|
31
|
+
def items
|
32
|
+
attributes.fetch(:items)
|
33
|
+
end
|
34
|
+
|
35
|
+
attr_reader :attributes
|
36
|
+
|
37
|
+
def to_json(*args)
|
38
|
+
attributes.to_json(*args)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Completion options.
|
6
|
+
#
|
7
|
+
class CompletionOptions
|
8
|
+
def initialize(resolve_provider: nil, trigger_characters: nil)
|
9
|
+
@attributes = {}
|
10
|
+
|
11
|
+
@attributes[:resolveProvider] = resolve_provider if resolve_provider
|
12
|
+
@attributes[:triggerCharacters] = trigger_characters if trigger_characters
|
13
|
+
|
14
|
+
@attributes.freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# The server provides support to resolve additional
|
19
|
+
# information for a completion item.
|
20
|
+
#
|
21
|
+
# @return [boolean]
|
22
|
+
def resolve_provider
|
23
|
+
attributes.fetch(:resolveProvider)
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# The characters that trigger completion automatically.
|
28
|
+
#
|
29
|
+
# @return [string[]]
|
30
|
+
def trigger_characters
|
31
|
+
attributes.fetch(:triggerCharacters)
|
32
|
+
end
|
33
|
+
|
34
|
+
attr_reader :attributes
|
35
|
+
|
36
|
+
def to_json(*args)
|
37
|
+
attributes.to_json(*args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class CompletionRegistrationOptions
|
5
|
+
def initialize(trigger_characters: nil, resolve_provider: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:triggerCharacters] = trigger_characters if trigger_characters
|
9
|
+
@attributes[:resolveProvider] = resolve_provider if resolve_provider
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# The characters that trigger completion automatically.
|
16
|
+
#
|
17
|
+
# @return [string[]]
|
18
|
+
def trigger_characters
|
19
|
+
attributes.fetch(:triggerCharacters)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# The server provides support to resolve additional
|
24
|
+
# information for a completion item.
|
25
|
+
#
|
26
|
+
# @return [boolean]
|
27
|
+
def resolve_provider
|
28
|
+
attributes.fetch(:resolveProvider)
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :attributes
|
32
|
+
|
33
|
+
def to_json(*args)
|
34
|
+
attributes.to_json(*args)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class Diagnostic
|
5
|
+
def initialize(range:, severity: nil, code: nil, source: nil, message:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:range] = range
|
9
|
+
@attributes[:severity] = severity if severity
|
10
|
+
@attributes[:code] = code if code
|
11
|
+
@attributes[:source] = source if source
|
12
|
+
@attributes[:message] = message
|
13
|
+
|
14
|
+
@attributes.freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# The range at which the message applies.
|
19
|
+
#
|
20
|
+
# @return [Range]
|
21
|
+
def range
|
22
|
+
attributes.fetch(:range)
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# The diagnostic's severity. Can be omitted. If omitted it is up to the
|
27
|
+
# client to interpret diagnostics as error, warning, info or hint.
|
28
|
+
#
|
29
|
+
# @return [number]
|
30
|
+
def severity
|
31
|
+
attributes.fetch(:severity)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# The diagnostic's code. Can be omitted.
|
36
|
+
#
|
37
|
+
# @return [string | number]
|
38
|
+
def code
|
39
|
+
attributes.fetch(:code)
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# A human-readable string describing the source of this
|
44
|
+
# diagnostic, e.g. 'typescript' or 'super lint'.
|
45
|
+
#
|
46
|
+
# @return [string]
|
47
|
+
def source
|
48
|
+
attributes.fetch(:source)
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# The diagnostic's message.
|
53
|
+
#
|
54
|
+
# @return [string]
|
55
|
+
def message
|
56
|
+
attributes.fetch(:message)
|
57
|
+
end
|
58
|
+
|
59
|
+
attr_reader :attributes
|
60
|
+
|
61
|
+
def to_json(*args)
|
62
|
+
attributes.to_json(*args)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DidChangeConfigurationParams
|
5
|
+
def initialize(settings:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:settings] = settings
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The actual changed settings
|
15
|
+
#
|
16
|
+
# @return [any]
|
17
|
+
def settings
|
18
|
+
attributes.fetch(:settings)
|
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
|