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,40 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DidChangeTextDocumentParams
|
5
|
+
def initialize(text_document:, content_changes:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
@attributes[:contentChanges] = content_changes
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# The document that did change. The version number points
|
16
|
+
# to the version after all provided content changes have
|
17
|
+
# been applied.
|
18
|
+
#
|
19
|
+
# @return [VersionedTextDocumentIdentifier]
|
20
|
+
def text_document
|
21
|
+
attributes.fetch(:textDocument)
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# The actual content changes.
|
26
|
+
#
|
27
|
+
# @return [TextDocumentContentChangeEvent[]]
|
28
|
+
def content_changes
|
29
|
+
attributes.fetch(:contentChanges)
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :attributes
|
33
|
+
|
34
|
+
def to_json(*args)
|
35
|
+
attributes.to_json(*args)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DidChangeWatchedFilesParams
|
5
|
+
def initialize(changes:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:changes] = changes
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The actual file events.
|
15
|
+
#
|
16
|
+
# @return [FileEvent[]]
|
17
|
+
def changes
|
18
|
+
attributes.fetch(:changes)
|
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 DidCloseTextDocumentParams
|
5
|
+
def initialize(text_document:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The document that was closed.
|
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 DidOpenTextDocumentParams
|
5
|
+
def initialize(text_document:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The document that was opened.
|
15
|
+
#
|
16
|
+
# @return [TextDocumentItem]
|
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,39 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DidSaveTextDocumentParams
|
5
|
+
def initialize(text_document:, text: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
@attributes[:text] = text if text
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# The document that was saved.
|
16
|
+
#
|
17
|
+
# @return [TextDocumentIdentifier]
|
18
|
+
def text_document
|
19
|
+
attributes.fetch(:textDocument)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Optional the content when saved. Depends on the includeText value
|
24
|
+
# when the save notifcation was requested.
|
25
|
+
#
|
26
|
+
# @return [string]
|
27
|
+
def text
|
28
|
+
attributes.fetch(:text)
|
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,47 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DocumentFilter
|
5
|
+
def initialize(language: nil, scheme: nil, pattern: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:language] = language if language
|
9
|
+
@attributes[:scheme] = scheme if scheme
|
10
|
+
@attributes[:pattern] = pattern if pattern
|
11
|
+
|
12
|
+
@attributes.freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# A language id, like `typescript`.
|
17
|
+
#
|
18
|
+
# @return [string]
|
19
|
+
def language
|
20
|
+
attributes.fetch(:language)
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
|
25
|
+
#
|
26
|
+
# @return [string]
|
27
|
+
def scheme
|
28
|
+
attributes.fetch(:scheme)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# A glob pattern, like `*.{ts,js}`.
|
33
|
+
#
|
34
|
+
# @return [string]
|
35
|
+
def pattern
|
36
|
+
attributes.fetch(:pattern)
|
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,38 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DocumentFormattingParams
|
5
|
+
def initialize(text_document:, options:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
@attributes[:options] = options
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# The document to format.
|
16
|
+
#
|
17
|
+
# @return [TextDocumentIdentifier]
|
18
|
+
def text_document
|
19
|
+
attributes.fetch(:textDocument)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# The format options.
|
24
|
+
#
|
25
|
+
# @return [FormattingOptions]
|
26
|
+
def options
|
27
|
+
attributes.fetch(:options)
|
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,43 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# A document highlight is a range inside a text document which deserves
|
6
|
+
# special attention. Usually a document highlight is visualized by changing
|
7
|
+
# the background color of its range.
|
8
|
+
#
|
9
|
+
class DocumentHighlight
|
10
|
+
def initialize(range:, kind: nil)
|
11
|
+
@attributes = {}
|
12
|
+
|
13
|
+
@attributes[:range] = range
|
14
|
+
@attributes[:kind] = kind if kind
|
15
|
+
|
16
|
+
@attributes.freeze
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# The range this highlight applies to.
|
21
|
+
#
|
22
|
+
# @return [Range]
|
23
|
+
def range
|
24
|
+
attributes.fetch(:range)
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# The highlight kind, default is DocumentHighlightKind.Text.
|
29
|
+
#
|
30
|
+
# @return [number]
|
31
|
+
def kind
|
32
|
+
attributes.fetch(:kind)
|
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
|
+
# A document link is a range in a text document that links to an internal or external resource, like another
|
6
|
+
# text document or a web site.
|
7
|
+
#
|
8
|
+
class DocumentLink
|
9
|
+
def initialize(range:, target: nil)
|
10
|
+
@attributes = {}
|
11
|
+
|
12
|
+
@attributes[:range] = range
|
13
|
+
@attributes[:target] = target if target
|
14
|
+
|
15
|
+
@attributes.freeze
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# The range this link applies to.
|
20
|
+
#
|
21
|
+
# @return [Range]
|
22
|
+
def range
|
23
|
+
attributes.fetch(:range)
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# The uri this link points to. If missing a resolve request is sent later.
|
28
|
+
#
|
29
|
+
# @return [string]
|
30
|
+
def target
|
31
|
+
attributes.fetch(:target)
|
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,32 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Document link options
|
6
|
+
#
|
7
|
+
class DocumentLinkOptions
|
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
|
+
# Document links have 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 DocumentLinkParams
|
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 provide document links 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 DocumentLinkRegistrationOptions
|
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
|
+
# Document links have 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,41 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Format document on type options
|
6
|
+
#
|
7
|
+
class DocumentOnTypeFormattingOptions
|
8
|
+
def initialize(first_trigger_character:, more_trigger_character: nil)
|
9
|
+
@attributes = {}
|
10
|
+
|
11
|
+
@attributes[:firstTriggerCharacter] = first_trigger_character
|
12
|
+
@attributes[:moreTriggerCharacter] = more_trigger_character if more_trigger_character
|
13
|
+
|
14
|
+
@attributes.freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# A character on which formatting should be triggered, like `}`.
|
19
|
+
#
|
20
|
+
# @return [string]
|
21
|
+
def first_trigger_character
|
22
|
+
attributes.fetch(:firstTriggerCharacter)
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# More trigger characters.
|
27
|
+
#
|
28
|
+
# @return [string[]]
|
29
|
+
def more_trigger_character
|
30
|
+
attributes.fetch(:moreTriggerCharacter)
|
31
|
+
end
|
32
|
+
|
33
|
+
attr_reader :attributes
|
34
|
+
|
35
|
+
def to_json(*args)
|
36
|
+
attributes.to_json(*args)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DocumentOnTypeFormattingParams
|
5
|
+
def initialize(text_document:, position:, ch:, options:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
@attributes[:position] = position
|
10
|
+
@attributes[:ch] = ch
|
11
|
+
@attributes[:options] = options
|
12
|
+
|
13
|
+
@attributes.freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# The document to format.
|
18
|
+
#
|
19
|
+
# @return [TextDocumentIdentifier]
|
20
|
+
def text_document
|
21
|
+
attributes.fetch(:textDocument)
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# The position at which this request was sent.
|
26
|
+
#
|
27
|
+
# @return [Position]
|
28
|
+
def position
|
29
|
+
attributes.fetch(:position)
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# The character that has been typed.
|
34
|
+
#
|
35
|
+
# @return [string]
|
36
|
+
def ch
|
37
|
+
attributes.fetch(:ch)
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# The format options.
|
42
|
+
#
|
43
|
+
# @return [FormattingOptions]
|
44
|
+
def options
|
45
|
+
attributes.fetch(:options)
|
46
|
+
end
|
47
|
+
|
48
|
+
attr_reader :attributes
|
49
|
+
|
50
|
+
def to_json(*args)
|
51
|
+
attributes.to_json(*args)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/language_server/protocol/interfaces/document_on_type_formatting_registration_options.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DocumentOnTypeFormattingRegistrationOptions
|
5
|
+
def initialize(first_trigger_character:, more_trigger_character: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:firstTriggerCharacter] = first_trigger_character
|
9
|
+
@attributes[:moreTriggerCharacter] = more_trigger_character if more_trigger_character
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# A character on which formatting should be triggered, like `}`.
|
16
|
+
#
|
17
|
+
# @return [string]
|
18
|
+
def first_trigger_character
|
19
|
+
attributes.fetch(:firstTriggerCharacter)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# More trigger characters.
|
24
|
+
#
|
25
|
+
# @return [string[]]
|
26
|
+
def more_trigger_character
|
27
|
+
attributes.fetch(:moreTriggerCharacter)
|
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,47 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DocumentRangeFormattingParams
|
5
|
+
def initialize(text_document:, range:, options:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
@attributes[:range] = range
|
10
|
+
@attributes[:options] = options
|
11
|
+
|
12
|
+
@attributes.freeze
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# The document to format.
|
17
|
+
#
|
18
|
+
# @return [TextDocumentIdentifier]
|
19
|
+
def text_document
|
20
|
+
attributes.fetch(:textDocument)
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# The range to format
|
25
|
+
#
|
26
|
+
# @return [Range]
|
27
|
+
def range
|
28
|
+
attributes.fetch(:range)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# The format options
|
33
|
+
#
|
34
|
+
# @return [FormattingOptions]
|
35
|
+
def options
|
36
|
+
attributes.fetch(:options)
|
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,29 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
class DocumentSymbolParams
|
5
|
+
def initialize(text_document:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:textDocument] = text_document
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The text document.
|
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,32 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interfaces
|
4
|
+
#
|
5
|
+
# Execute command options.
|
6
|
+
#
|
7
|
+
class ExecuteCommandOptions
|
8
|
+
def initialize(commands:)
|
9
|
+
@attributes = {}
|
10
|
+
|
11
|
+
@attributes[:commands] = commands
|
12
|
+
|
13
|
+
@attributes.freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# The commands to be executed on the server
|
18
|
+
#
|
19
|
+
# @return [string[]]
|
20
|
+
def commands
|
21
|
+
attributes.fetch(:commands)
|
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
|