language_server-protocol 0.5.0 → 3.7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +13 -7
- data/lib/language_server/protocol/constant.rb +35 -11
- data/lib/language_server/protocol/constant/completion_item_kind.rb +7 -0
- data/lib/language_server/protocol/constant/completion_trigger_kind.rb +25 -0
- data/lib/language_server/protocol/constant/insert_text_format.rb +0 -2
- data/lib/language_server/protocol/constant/markup_kind.rb +23 -0
- data/lib/language_server/protocol/constant/symbol_kind.rb +8 -0
- data/lib/language_server/protocol/constant/watch_kind.rb +20 -0
- data/lib/language_server/protocol/interface.rb +217 -87
- data/lib/language_server/protocol/interface/apply_workspace_edit_params.rb +12 -1
- data/lib/language_server/protocol/interface/client_capabilities.rb +1 -1
- data/lib/language_server/protocol/interface/color.rb +63 -0
- data/lib/language_server/protocol/interface/color_information.rb +42 -0
- data/lib/language_server/protocol/interface/color_presentation.rb +56 -0
- data/lib/language_server/protocol/interface/color_presentation_params.rb +51 -0
- data/lib/language_server/protocol/interface/color_provider_options.rb +27 -0
- data/lib/language_server/protocol/interface/completion_context.rb +46 -0
- data/lib/language_server/protocol/interface/completion_item.rb +37 -6
- data/lib/language_server/protocol/interface/completion_params.rb +34 -0
- data/lib/language_server/protocol/interface/completion_registration_options.rb +8 -1
- data/lib/language_server/protocol/interface/configuration_item.rb +42 -0
- data/lib/language_server/protocol/interface/configuration_params.rb +30 -0
- data/lib/language_server/protocol/interface/diagnostic.rb +12 -2
- data/lib/language_server/protocol/interface/diagnostic_related_information.rb +47 -0
- data/lib/language_server/protocol/interface/did_change_text_document_params.rb +3 -1
- data/lib/language_server/protocol/interface/did_change_watched_files_registration_options.rb +36 -0
- data/lib/language_server/protocol/interface/did_change_workspace_folders_params.rb +33 -0
- data/lib/language_server/protocol/interface/did_save_text_document_params.rb +1 -1
- data/lib/language_server/protocol/interface/document_link.rb +11 -1
- data/lib/language_server/protocol/interface/file_system_watcher.rb +44 -0
- data/lib/language_server/protocol/interface/hover.rb +1 -1
- data/lib/language_server/protocol/interface/initialize_params.rb +15 -1
- data/lib/language_server/protocol/interface/initialized_params.rb +24 -0
- data/lib/language_server/protocol/interface/markup_content.rb +66 -0
- data/lib/language_server/protocol/interface/notification_message.rb +1 -1
- data/lib/language_server/protocol/interface/parameter_information.rb +1 -1
- data/lib/language_server/protocol/interface/position.rb +6 -1
- data/lib/language_server/protocol/interface/registration.rb +1 -1
- data/lib/language_server/protocol/interface/rename_params.rb +1 -1
- data/lib/language_server/protocol/interface/request_message.rb +1 -1
- data/lib/language_server/protocol/interface/server_capabilities.rb +44 -2
- data/lib/language_server/protocol/interface/signature_help.rb +2 -2
- data/lib/language_server/protocol/interface/signature_information.rb +1 -1
- data/lib/language_server/protocol/interface/static_registration_options.rb +37 -0
- data/lib/language_server/protocol/interface/symbol_information.rb +23 -3
- data/lib/language_server/protocol/interface/text_document_change_registration_options.rb +2 -2
- data/lib/language_server/protocol/interface/text_document_client_capabilities.rb +48 -5
- data/lib/language_server/protocol/interface/text_document_item.rb +1 -1
- data/lib/language_server/protocol/interface/text_document_sync_options.rb +2 -2
- data/lib/language_server/protocol/interface/versioned_text_document_identifier.rb +5 -1
- data/lib/language_server/protocol/interface/workspace_client_capabilities.rb +104 -0
- data/lib/language_server/protocol/interface/workspace_edit.rb +4 -3
- data/lib/language_server/protocol/interface/workspace_folder.rb +43 -0
- data/lib/language_server/protocol/interface/workspace_folders_change_event.rb +45 -0
- data/lib/language_server/protocol/version.rb +1 -1
- data/scripts/generateFiles.ts +29 -9
- metadata +25 -3
@@ -12,7 +12,14 @@ module LanguageServer
|
|
12
12
|
end
|
13
13
|
|
14
14
|
#
|
15
|
-
#
|
15
|
+
# Most tools trigger completion request automatically without explicitly requesting
|
16
|
+
# it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
|
17
|
+
# starts to type an identifier. For example if the user types `c` in a JavaScript file
|
18
|
+
# code complete will automatically pop up present `console` besides others as a
|
19
|
+
# completion item. Characters that make up identifiers don't need to be listed here.
|
20
|
+
#
|
21
|
+
# If code complete should automatically be trigger on characters not being valid inside
|
22
|
+
# an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
|
16
23
|
#
|
17
24
|
# @return [string[]]
|
18
25
|
def trigger_characters
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
class ConfigurationItem
|
5
|
+
def initialize(scope_uri: nil, section: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:scopeUri] = scope_uri if scope_uri
|
9
|
+
@attributes[:section] = section if section
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# The scope to get the configuration section for.
|
16
|
+
#
|
17
|
+
# @return [string]
|
18
|
+
def scope_uri
|
19
|
+
attributes.fetch(:scopeUri)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# The configuration section asked for.
|
24
|
+
#
|
25
|
+
# @return [string]
|
26
|
+
def section
|
27
|
+
attributes.fetch(:section)
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_reader :attributes
|
31
|
+
|
32
|
+
def to_hash
|
33
|
+
attributes
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_json(*args)
|
37
|
+
to_hash.to_json(*args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
class ConfigurationParams
|
5
|
+
def initialize(items:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:items] = items
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [ConfigurationItem[]]
|
14
|
+
def items
|
15
|
+
attributes.fetch(:items)
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :attributes
|
19
|
+
|
20
|
+
def to_hash
|
21
|
+
attributes
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_json(*args)
|
25
|
+
to_hash.to_json(*args)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -2,7 +2,7 @@ module LanguageServer
|
|
2
2
|
module Protocol
|
3
3
|
module Interface
|
4
4
|
class Diagnostic
|
5
|
-
def initialize(range:, severity: nil, code: nil, source: nil, message:)
|
5
|
+
def initialize(range:, severity: nil, code: nil, source: nil, message:, related_information: nil)
|
6
6
|
@attributes = {}
|
7
7
|
|
8
8
|
@attributes[:range] = range
|
@@ -10,6 +10,7 @@ module LanguageServer
|
|
10
10
|
@attributes[:code] = code if code
|
11
11
|
@attributes[:source] = source if source
|
12
12
|
@attributes[:message] = message
|
13
|
+
@attributes[:relatedInformation] = related_information if related_information
|
13
14
|
|
14
15
|
@attributes.freeze
|
15
16
|
end
|
@@ -32,7 +33,7 @@ module LanguageServer
|
|
32
33
|
end
|
33
34
|
|
34
35
|
#
|
35
|
-
# The diagnostic's code
|
36
|
+
# The diagnostic's code, which might appear in the user interface.
|
36
37
|
#
|
37
38
|
# @return [string | number]
|
38
39
|
def code
|
@@ -56,6 +57,15 @@ module LanguageServer
|
|
56
57
|
attributes.fetch(:message)
|
57
58
|
end
|
58
59
|
|
60
|
+
#
|
61
|
+
# An array of related diagnostic information, e.g. when symbol-names within
|
62
|
+
# a scope collide all definitions can be marked via this property.
|
63
|
+
#
|
64
|
+
# @return [DiagnosticRelatedInformation[]]
|
65
|
+
def related_information
|
66
|
+
attributes.fetch(:relatedInformation)
|
67
|
+
end
|
68
|
+
|
59
69
|
attr_reader :attributes
|
60
70
|
|
61
71
|
def to_hash
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
#
|
5
|
+
# Represents a related message and source code location for a diagnostic. This should be
|
6
|
+
# used to point to code locations that cause or related to a diagnostics, e.g when duplicating
|
7
|
+
# a symbol in a scope.
|
8
|
+
#
|
9
|
+
class DiagnosticRelatedInformation
|
10
|
+
def initialize(location:, message:)
|
11
|
+
@attributes = {}
|
12
|
+
|
13
|
+
@attributes[:location] = location
|
14
|
+
@attributes[:message] = message
|
15
|
+
|
16
|
+
@attributes.freeze
|
17
|
+
end
|
18
|
+
|
19
|
+
#
|
20
|
+
# The location of this related diagnostic information.
|
21
|
+
#
|
22
|
+
# @return [Location]
|
23
|
+
def location
|
24
|
+
attributes.fetch(:location)
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# The message of this related diagnostic information.
|
29
|
+
#
|
30
|
+
# @return [string]
|
31
|
+
def message
|
32
|
+
attributes.fetch(:message)
|
33
|
+
end
|
34
|
+
|
35
|
+
attr_reader :attributes
|
36
|
+
|
37
|
+
def to_hash
|
38
|
+
attributes
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_json(*args)
|
42
|
+
to_hash.to_json(*args)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -22,7 +22,9 @@ module LanguageServer
|
|
22
22
|
end
|
23
23
|
|
24
24
|
#
|
25
|
-
# The actual content changes.
|
25
|
+
# The actual content changes. The content changes describe single state changes
|
26
|
+
# to the document. So if there are two content changes c1 and c2 for a document
|
27
|
+
# in state S10 then c1 move the document to S11 and c2 to S12.
|
26
28
|
#
|
27
29
|
# @return [TextDocumentContentChangeEvent[]]
|
28
30
|
def content_changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
#
|
5
|
+
# Describe options to be used when registering for text document change events.
|
6
|
+
#
|
7
|
+
class DidChangeWatchedFilesRegistrationOptions
|
8
|
+
def initialize(watchers:)
|
9
|
+
@attributes = {}
|
10
|
+
|
11
|
+
@attributes[:watchers] = watchers
|
12
|
+
|
13
|
+
@attributes.freeze
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# The watchers to register.
|
18
|
+
#
|
19
|
+
# @return [FileSystemWatcher[]]
|
20
|
+
def watchers
|
21
|
+
attributes.fetch(:watchers)
|
22
|
+
end
|
23
|
+
|
24
|
+
attr_reader :attributes
|
25
|
+
|
26
|
+
def to_hash
|
27
|
+
attributes
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_json(*args)
|
31
|
+
to_hash.to_json(*args)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
class DidChangeWorkspaceFoldersParams
|
5
|
+
def initialize(event:)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:event] = event
|
9
|
+
|
10
|
+
@attributes.freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# The actual workspace folder change event.
|
15
|
+
#
|
16
|
+
# @return [WorkspaceFoldersChangeEvent]
|
17
|
+
def event
|
18
|
+
attributes.fetch(:event)
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_reader :attributes
|
22
|
+
|
23
|
+
def to_hash
|
24
|
+
attributes
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_json(*args)
|
28
|
+
to_hash.to_json(*args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -6,11 +6,12 @@ module LanguageServer
|
|
6
6
|
# text document or a web site.
|
7
7
|
#
|
8
8
|
class DocumentLink
|
9
|
-
def initialize(range:, target: nil)
|
9
|
+
def initialize(range:, target: nil, data: nil)
|
10
10
|
@attributes = {}
|
11
11
|
|
12
12
|
@attributes[:range] = range
|
13
13
|
@attributes[:target] = target if target
|
14
|
+
@attributes[:data] = data if data
|
14
15
|
|
15
16
|
@attributes.freeze
|
16
17
|
end
|
@@ -31,6 +32,15 @@ module LanguageServer
|
|
31
32
|
attributes.fetch(:target)
|
32
33
|
end
|
33
34
|
|
35
|
+
#
|
36
|
+
# A data entry field that is preserved on a document link between a
|
37
|
+
# DocumentLinkRequest and a DocumentLinkResolveRequest.
|
38
|
+
#
|
39
|
+
# @return [any]
|
40
|
+
def data
|
41
|
+
attributes.fetch(:data)
|
42
|
+
end
|
43
|
+
|
34
44
|
attr_reader :attributes
|
35
45
|
|
36
46
|
def to_hash
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
class FileSystemWatcher
|
5
|
+
def initialize(glob_pattern:, kind: nil)
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
@attributes[:globPattern] = glob_pattern
|
9
|
+
@attributes[:kind] = kind if kind
|
10
|
+
|
11
|
+
@attributes.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# The glob pattern to watch
|
16
|
+
#
|
17
|
+
# @return [string]
|
18
|
+
def glob_pattern
|
19
|
+
attributes.fetch(:globPattern)
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# The kind of events of interest. If omitted it defaults
|
24
|
+
# to WatchKind.Create | WatchKind.Change | WatchKind.Delete
|
25
|
+
# which is 7.
|
26
|
+
#
|
27
|
+
# @return [number]
|
28
|
+
def kind
|
29
|
+
attributes.fetch(:kind)
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :attributes
|
33
|
+
|
34
|
+
def to_hash
|
35
|
+
attributes
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_json(*args)
|
39
|
+
to_hash.to_json(*args)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -17,7 +17,7 @@ module LanguageServer
|
|
17
17
|
#
|
18
18
|
# The hover's content
|
19
19
|
#
|
20
|
-
# @return [string | { language: string; value: string; } | MarkedString[]]
|
20
|
+
# @return [string | MarkupContent | { language: string; value: string; } | MarkedString[]]
|
21
21
|
def contents
|
22
22
|
attributes.fetch(:contents)
|
23
23
|
end
|
@@ -2,7 +2,7 @@ module LanguageServer
|
|
2
2
|
module Protocol
|
3
3
|
module Interface
|
4
4
|
class InitializeParams
|
5
|
-
def initialize(process_id:, root_path: nil, root_uri:, initialization_options: nil, capabilities:, trace: nil)
|
5
|
+
def initialize(process_id:, root_path: nil, root_uri:, initialization_options: nil, capabilities:, trace: nil, workspace_folders: nil)
|
6
6
|
@attributes = {}
|
7
7
|
|
8
8
|
@attributes[:processId] = process_id
|
@@ -11,6 +11,7 @@ module LanguageServer
|
|
11
11
|
@attributes[:initializationOptions] = initialization_options if initialization_options
|
12
12
|
@attributes[:capabilities] = capabilities
|
13
13
|
@attributes[:trace] = trace if trace
|
14
|
+
@attributes[:workspaceFolders] = workspace_folders if workspace_folders
|
14
15
|
|
15
16
|
@attributes.freeze
|
16
17
|
end
|
@@ -68,6 +69,19 @@ module LanguageServer
|
|
68
69
|
attributes.fetch(:trace)
|
69
70
|
end
|
70
71
|
|
72
|
+
#
|
73
|
+
# The workspace folders configured in the client when the server starts.
|
74
|
+
# This property is only available if the client supports workspace folders.
|
75
|
+
# It can be `null` if the client supports workspace folders but none are
|
76
|
+
# configured.
|
77
|
+
#
|
78
|
+
# Since 3.6.0
|
79
|
+
#
|
80
|
+
# @return [WorkspaceFolder[]]
|
81
|
+
def workspace_folders
|
82
|
+
attributes.fetch(:workspaceFolders)
|
83
|
+
end
|
84
|
+
|
71
85
|
attr_reader :attributes
|
72
86
|
|
73
87
|
def to_hash
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
class InitializedParams
|
5
|
+
def initialize()
|
6
|
+
@attributes = {}
|
7
|
+
|
8
|
+
|
9
|
+
@attributes.freeze
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :attributes
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
attributes
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_json(*args)
|
19
|
+
to_hash.to_json(*args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module LanguageServer
|
2
|
+
module Protocol
|
3
|
+
module Interface
|
4
|
+
#
|
5
|
+
# A `MarkupContent` literal represents a string value which content is interpreted base on its
|
6
|
+
# kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
|
7
|
+
#
|
8
|
+
# If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
|
9
|
+
# See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
|
10
|
+
#
|
11
|
+
# Here is an example how such a string can be constructed using JavaScript / TypeScript:
|
12
|
+
# ```ts
|
13
|
+
# let markdown: MarkdownContent = {
|
14
|
+
# kind: MarkupKind.Markdown,
|
15
|
+
# value: [
|
16
|
+
# '# Header',
|
17
|
+
# 'Some text',
|
18
|
+
# '```typescript',
|
19
|
+
# 'someCode();',
|
20
|
+
# '```'
|
21
|
+
# ].join('\n')
|
22
|
+
# };
|
23
|
+
# ```
|
24
|
+
#
|
25
|
+
# *Please Note* that clients might sanitize the return markdown. A client could decide to
|
26
|
+
# remove HTML from the markdown to avoid script execution.
|
27
|
+
#
|
28
|
+
class MarkupContent
|
29
|
+
def initialize(kind:, value:)
|
30
|
+
@attributes = {}
|
31
|
+
|
32
|
+
@attributes[:kind] = kind
|
33
|
+
@attributes[:value] = value
|
34
|
+
|
35
|
+
@attributes.freeze
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# The type of the Markup
|
40
|
+
#
|
41
|
+
# @return [MarkupKind]
|
42
|
+
def kind
|
43
|
+
attributes.fetch(:kind)
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# The content itself
|
48
|
+
#
|
49
|
+
# @return [string]
|
50
|
+
def value
|
51
|
+
attributes.fetch(:value)
|
52
|
+
end
|
53
|
+
|
54
|
+
attr_reader :attributes
|
55
|
+
|
56
|
+
def to_hash
|
57
|
+
attributes
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_json(*args)
|
61
|
+
to_hash.to_json(*args)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|