language_server-protocol 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.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +5 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Dockerfile-node.development +6 -0
  6. data/Dockerfile.development +14 -0
  7. data/Gemfile +6 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +43 -0
  10. data/Rakefile +10 -0
  11. data/bin/console +14 -0
  12. data/bin/generate_files +5 -0
  13. data/bin/setup +8 -0
  14. data/language_server-protocol.gemspec +27 -0
  15. data/lib/language_server/protocol/constants/completion_item_kind.rb +29 -0
  16. data/lib/language_server/protocol/constants/diagnostic_severity.rb +24 -0
  17. data/lib/language_server/protocol/constants/document_highlight_kind.rb +23 -0
  18. data/lib/language_server/protocol/constants/error_codes.rb +18 -0
  19. data/lib/language_server/protocol/constants/file_change_type.rb +23 -0
  20. data/lib/language_server/protocol/constants/initialize_error.rb +15 -0
  21. data/lib/language_server/protocol/constants/insert_text_format.rb +27 -0
  22. data/lib/language_server/protocol/constants/message_type.rb +24 -0
  23. data/lib/language_server/protocol/constants/symbol_kind.rb +29 -0
  24. data/lib/language_server/protocol/constants/text_document_save_reason.rb +24 -0
  25. data/lib/language_server/protocol/constants/text_document_sync_kind.rb +26 -0
  26. data/lib/language_server/protocol/constants.rb +11 -0
  27. data/lib/language_server/protocol/interfaces/apply_workspace_edit_params.rb +29 -0
  28. data/lib/language_server/protocol/interfaces/apply_workspace_edit_response.rb +29 -0
  29. data/lib/language_server/protocol/interfaces/cancel_params.rb +29 -0
  30. data/lib/language_server/protocol/interfaces/client_capabilities.rb +47 -0
  31. data/lib/language_server/protocol/interfaces/code_action_context.rb +33 -0
  32. data/lib/language_server/protocol/interfaces/code_action_params.rb +50 -0
  33. data/lib/language_server/protocol/interfaces/code_lens.rb +55 -0
  34. data/lib/language_server/protocol/interfaces/code_lens_options.rb +32 -0
  35. data/lib/language_server/protocol/interfaces/code_lens_params.rb +29 -0
  36. data/lib/language_server/protocol/interfaces/code_lens_registration_options.rb +29 -0
  37. data/lib/language_server/protocol/interfaces/command.rb +48 -0
  38. data/lib/language_server/protocol/interfaces/completion_item.rb +145 -0
  39. data/lib/language_server/protocol/interfaces/completion_list.rb +43 -0
  40. data/lib/language_server/protocol/interfaces/completion_options.rb +42 -0
  41. data/lib/language_server/protocol/interfaces/completion_registration_options.rb +39 -0
  42. data/lib/language_server/protocol/interfaces/diagnostic.rb +67 -0
  43. data/lib/language_server/protocol/interfaces/did_change_configuration_params.rb +29 -0
  44. data/lib/language_server/protocol/interfaces/did_change_text_document_params.rb +40 -0
  45. data/lib/language_server/protocol/interfaces/did_change_watched_files_params.rb +29 -0
  46. data/lib/language_server/protocol/interfaces/did_close_text_document_params.rb +29 -0
  47. data/lib/language_server/protocol/interfaces/did_open_text_document_params.rb +29 -0
  48. data/lib/language_server/protocol/interfaces/did_save_text_document_params.rb +39 -0
  49. data/lib/language_server/protocol/interfaces/document_filter.rb +47 -0
  50. data/lib/language_server/protocol/interfaces/document_formatting_params.rb +38 -0
  51. data/lib/language_server/protocol/interfaces/document_highlight.rb +43 -0
  52. data/lib/language_server/protocol/interfaces/document_link.rb +42 -0
  53. data/lib/language_server/protocol/interfaces/document_link_options.rb +32 -0
  54. data/lib/language_server/protocol/interfaces/document_link_params.rb +29 -0
  55. data/lib/language_server/protocol/interfaces/document_link_registration_options.rb +29 -0
  56. data/lib/language_server/protocol/interfaces/document_on_type_formatting_options.rb +41 -0
  57. data/lib/language_server/protocol/interfaces/document_on_type_formatting_params.rb +56 -0
  58. data/lib/language_server/protocol/interfaces/document_on_type_formatting_registration_options.rb +38 -0
  59. data/lib/language_server/protocol/interfaces/document_range_formatting_params.rb +47 -0
  60. data/lib/language_server/protocol/interfaces/document_symbol_params.rb +29 -0
  61. data/lib/language_server/protocol/interfaces/execute_command_options.rb +32 -0
  62. data/lib/language_server/protocol/interfaces/execute_command_params.rb +38 -0
  63. data/lib/language_server/protocol/interfaces/execute_command_registration_options.rb +32 -0
  64. data/lib/language_server/protocol/interfaces/file_event.rb +41 -0
  65. data/lib/language_server/protocol/interfaces/formatting_options.rb +41 -0
  66. data/lib/language_server/protocol/interfaces/hover.rb +42 -0
  67. data/lib/language_server/protocol/interfaces/initialize_error.rb +35 -0
  68. data/lib/language_server/protocol/interfaces/initialize_params.rb +79 -0
  69. data/lib/language_server/protocol/interfaces/initialize_result.rb +29 -0
  70. data/lib/language_server/protocol/interfaces/location.rb +32 -0
  71. data/lib/language_server/protocol/interfaces/log_message_params.rb +38 -0
  72. data/lib/language_server/protocol/interfaces/message.rb +26 -0
  73. data/lib/language_server/protocol/interfaces/message_action_item.rb +29 -0
  74. data/lib/language_server/protocol/interfaces/notification_message.rb +38 -0
  75. data/lib/language_server/protocol/interfaces/parameter_information.rb +44 -0
  76. data/lib/language_server/protocol/interfaces/position.rb +38 -0
  77. data/lib/language_server/protocol/interfaces/publish_diagnostics_params.rb +38 -0
  78. data/lib/language_server/protocol/interfaces/range.rb +38 -0
  79. data/lib/language_server/protocol/interfaces/reference_context.rb +29 -0
  80. data/lib/language_server/protocol/interfaces/reference_params.rb +26 -0
  81. data/lib/language_server/protocol/interfaces/registration.rb +51 -0
  82. data/lib/language_server/protocol/interfaces/registration_params.rb +26 -0
  83. data/lib/language_server/protocol/interfaces/rename_params.rb +49 -0
  84. data/lib/language_server/protocol/interfaces/request_message.rb +47 -0
  85. data/lib/language_server/protocol/interfaces/response_error.rb +48 -0
  86. data/lib/language_server/protocol/interfaces/response_message.rb +48 -0
  87. data/lib/language_server/protocol/interfaces/save_options.rb +32 -0
  88. data/lib/language_server/protocol/interfaces/server_capabilities.rb +183 -0
  89. data/lib/language_server/protocol/interfaces/show_message_params.rb +38 -0
  90. data/lib/language_server/protocol/interfaces/show_message_request_params.rb +47 -0
  91. data/lib/language_server/protocol/interfaces/signature_help.rb +64 -0
  92. data/lib/language_server/protocol/interfaces/signature_help_options.rb +33 -0
  93. data/lib/language_server/protocol/interfaces/signature_help_registration_options.rb +30 -0
  94. data/lib/language_server/protocol/interfaces/signature_information.rb +54 -0
  95. data/lib/language_server/protocol/interfaces/symbol_information.rb +60 -0
  96. data/lib/language_server/protocol/interfaces/text_document_change_registration_options.rb +33 -0
  97. data/lib/language_server/protocol/interfaces/text_document_client_capabilities.rb +155 -0
  98. data/lib/language_server/protocol/interfaces/text_document_content_change_event.rb +51 -0
  99. data/lib/language_server/protocol/interfaces/text_document_edit.rb +38 -0
  100. data/lib/language_server/protocol/interfaces/text_document_identifier.rb +29 -0
  101. data/lib/language_server/protocol/interfaces/text_document_item.rb +57 -0
  102. data/lib/language_server/protocol/interfaces/text_document_position_params.rb +38 -0
  103. data/lib/language_server/protocol/interfaces/text_document_registration_options.rb +30 -0
  104. data/lib/language_server/protocol/interfaces/text_document_save_registration_options.rb +29 -0
  105. data/lib/language_server/protocol/interfaces/text_document_sync_options.rb +66 -0
  106. data/lib/language_server/protocol/interfaces/text_edit.rb +40 -0
  107. data/lib/language_server/protocol/interfaces/unregistration.rb +42 -0
  108. data/lib/language_server/protocol/interfaces/unregistration_params.rb +26 -0
  109. data/lib/language_server/protocol/interfaces/versioned_text_document_identifier.rb +29 -0
  110. data/lib/language_server/protocol/interfaces/will_save_text_document_params.rb +41 -0
  111. data/lib/language_server/protocol/interfaces/workspace_client_capabilites.rb +78 -0
  112. data/lib/language_server/protocol/interfaces/workspace_edit.rb +40 -0
  113. data/lib/language_server/protocol/interfaces/workspace_symbol_params.rb +32 -0
  114. data/lib/language_server/protocol/interfaces.rb +87 -0
  115. data/lib/language_server/protocol/transport/stdio/reader.rb +39 -0
  116. data/lib/language_server/protocol/transport/stdio/writer.rb +38 -0
  117. data/lib/language_server/protocol/transport/stdio.rb +2 -0
  118. data/lib/language_server/protocol/version.rb +5 -0
  119. data/lib/language_server/protocol.rb +7 -0
  120. data/package.json +10 -0
  121. data/scripts/generateFiles.ts +224 -0
  122. data/yarn.lock +293 -0
  123. metadata +207 -0
@@ -0,0 +1,24 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ module MessageType
5
+ #
6
+ # An error message.
7
+ #
8
+ ERROR = 1
9
+ #
10
+ # A warning message.
11
+ #
12
+ WARNING = 2
13
+ #
14
+ # An information message.
15
+ #
16
+ INFO = 3
17
+ #
18
+ # A log message.
19
+ #
20
+ LOG = 4
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # A symbol kind.
6
+ #
7
+ module SymbolKind
8
+ FILE = 1
9
+ MODULE = 2
10
+ NAMESPACE = 3
11
+ PACKAGE = 4
12
+ CLASS = 5
13
+ METHOD = 6
14
+ PROPERTY = 7
15
+ FIELD = 8
16
+ CONSTRUCTOR = 9
17
+ ENUM = 10
18
+ INTERFACE = 11
19
+ FUNCTION = 12
20
+ VARIABLE = 13
21
+ CONSTANT = 14
22
+ STRING = 15
23
+ NUMBER = 16
24
+ BOOLEAN = 17
25
+ ARRAY = 18
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # Represents reasons why a text document is saved.
6
+ #
7
+ module TextDocumentSaveReason
8
+ #
9
+ # Manually triggered, e.g. by the user pressing save, by starting debugging,
10
+ # or by an API call.
11
+ #
12
+ MANUAL = 1
13
+ #
14
+ # Automatic after a delay.
15
+ #
16
+ AFTER_DELAY = 2
17
+ #
18
+ # When the editor lost focus.
19
+ #
20
+ FOCUS_OUT = 3
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,26 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Constants
4
+ #
5
+ # Defines how the host (editor) should sync document changes to the language server.
6
+ #
7
+ module TextDocumentSyncKind
8
+ #
9
+ # Documents should not be synced at all.
10
+ #
11
+ NONE = 0
12
+ #
13
+ # Documents are synced by always sending the full content
14
+ # of the document.
15
+ #
16
+ FULL = 1
17
+ #
18
+ # Documents are synced by sending the full content on open.
19
+ # After that only incremental updates to the document are
20
+ # send.
21
+ #
22
+ INCREMENTAL = 2
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ require "language_server/protocol/constants/error_codes"
2
+ require "language_server/protocol/constants/diagnostic_severity"
3
+ require "language_server/protocol/constants/initialize_error"
4
+ require "language_server/protocol/constants/text_document_sync_kind"
5
+ require "language_server/protocol/constants/message_type"
6
+ require "language_server/protocol/constants/text_document_save_reason"
7
+ require "language_server/protocol/constants/file_change_type"
8
+ require "language_server/protocol/constants/insert_text_format"
9
+ require "language_server/protocol/constants/completion_item_kind"
10
+ require "language_server/protocol/constants/document_highlight_kind"
11
+ require "language_server/protocol/constants/symbol_kind"
@@ -0,0 +1,29 @@
1
+ module LanguageServer
2
+ module Protocol
3
+ module Interfaces
4
+ class ApplyWorkspaceEditParams
5
+ def initialize(edit:)
6
+ @attributes = {}
7
+
8
+ @attributes[:edit] = edit
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # The edits to apply.
15
+ #
16
+ # @return [WorkspaceEdit]
17
+ def edit
18
+ attributes.fetch(:edit)
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 ApplyWorkspaceEditResponse
5
+ def initialize(applied:)
6
+ @attributes = {}
7
+
8
+ @attributes[:applied] = applied
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # Indicates whether the edit was applied or not.
15
+ #
16
+ # @return [boolean]
17
+ def applied
18
+ attributes.fetch(:applied)
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 CancelParams
5
+ def initialize(id:)
6
+ @attributes = {}
7
+
8
+ @attributes[:id] = id
9
+
10
+ @attributes.freeze
11
+ end
12
+
13
+ #
14
+ # The request id to cancel.
15
+ #
16
+ # @return [string | number]
17
+ def id
18
+ attributes.fetch(:id)
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,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