Skip to content

Commit 5a4db15

Browse files
authored
LSP: add definitions for workspace/configuration and workspace/didChangeConfiguration (#285)
1 parent 8c1eb00 commit 5a4db15

File tree

3 files changed

+89
-5
lines changed

3 files changed

+89
-5
lines changed

LSP/src/LSP.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ include("language-features/rename.jl")
3232
include("workspace-features/workspace-folders.jl")
3333
include("workspace-features/files.jl")
3434
include("workspace-features/did-change-watched-files.jl")
35+
include("workspace-features/configuration.jl")
3536
include("workspace-features/execute-command.jl")
3637
include("workspace-features/apply-edit.jl")
3738
include("window-features.jl")

LSP/src/lifecycle-messages/initialize.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,11 @@ provides text document synchronization (e.g. open, changed and close notificatio
513513
"""
514514
workspaceEdit::Union{WorkspaceEditClientCapabilities, Nothing} = nothing
515515

516-
# """
517-
# Capabilities specific to the `workspace/didChangeConfiguration`
518-
# notification.
519-
# """
520-
# didChangeConfiguration::Union{DidChangeConfigurationClientCapabilities, Nothing} = nothing
516+
"""
517+
Capabilities specific to the `workspace/didChangeConfiguration`
518+
notification.
519+
"""
520+
didChangeConfiguration::Union{DidChangeConfigurationClientCapabilities, Nothing} = nothing
521521

522522
"""
523523
Capabilities specific to the `workspace/didChangeWatchedFiles`
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
@interface DidChangeConfigurationClientCapabilities begin
2+
"""
3+
Did change configuration notification supports dynamic registration.
4+
5+
# Tags
6+
- since - 3.6.0 to support the new pull model.
7+
"""
8+
dynamicRegistration::Union{Nothing, Bool} = nothing
9+
end
10+
11+
@interface ConfigurationItem begin
12+
"""
13+
The scope to get the configuration section for.
14+
"""
15+
scopeUri::Union{Nothing, URI} = nothing
16+
17+
"""
18+
The configuration section asked for.
19+
"""
20+
section::Union{Nothing, String} = nothing
21+
end
22+
23+
@interface ConfigurationParams begin
24+
items::Vector{ConfigurationItem}
25+
end
26+
27+
"""
28+
The `workspace/configuration` request is sent from the server to the client to
29+
fetch configuration settings from the client. The request can fetch several
30+
configuration settings in one roundtrip. The order of the returned configuration
31+
settings correspond to the order of the passed `ConfigurationItems` (e.g. the
32+
first item in the response is the result for the first configuration item in
33+
the params).
34+
35+
A `ConfigurationItem` consists of the configuration section to ask for and an
36+
additional scope URI. The configuration section asked for is defined by the
37+
server and doesn't necessarily need to correspond to the configuration store
38+
used by the client. So a server might ask for a configuration
39+
`cpp.formatterOptions` but the client stores the configuration in an XML store
40+
layout differently. It is up to the client to do the necessary conversion. If a
41+
scope URI is provided the client should return the setting scoped to the
42+
provided resource. If the client for example uses EditorConfig to manage its
43+
settings the configuration should be returned for the passed resource URI. If
44+
the client can't provide a configuration setting for a given scope then `null`
45+
needs to be present in the returned array.
46+
47+
This pull model replaces the old push model were the client signaled
48+
configuration change via an event. If the server still needs to react to
49+
configuration changes (since the server caches the result of
50+
`workspace/configuration` requests) the server should register for an empty
51+
configuration change using the following registration pattern:
52+
53+
```julia
54+
connection.client.register(DidChangeConfigurationNotification.type, undefined)
55+
```
56+
57+
# Tags
58+
- since - 3.6.0
59+
"""
60+
@interface ConfigurationRequest @extends RequestMessage begin
61+
method::String = "workspace/configuration"
62+
params::ConfigurationParams
63+
end
64+
65+
@interface ConfigurationResponse @extends ResponseMessage begin
66+
result::Vector{LSPAny}
67+
end
68+
69+
@interface DidChangeConfigurationParams begin
70+
"""
71+
The actual changed settings
72+
"""
73+
settings::LSPAny
74+
end
75+
76+
"""
77+
A notification sent from the client to the server to signal the change of
78+
configuration settings.
79+
"""
80+
@interface DidChangeConfigurationNotification @extends NotificationMessage begin
81+
method::String = "workspace/didChangeConfiguration"
82+
params::DidChangeConfigurationParams
83+
end

0 commit comments

Comments
 (0)