@@ -4,18 +4,31 @@ import (
4
4
"context"
5
5
"encoding/json"
6
6
7
- // "reflect"
8
-
9
7
"github.com/mrjosh/helm-ls/internal/util"
10
8
lsp "go.lsp.dev/protocol"
11
9
)
12
10
13
11
func (h * ServerHandler ) DidChangeConfiguration (ctx context.Context , params * lsp.DidChangeConfigurationParams ) (err error ) {
14
- // go h.retrieveWorkspaceConfiguration(ctx)
15
- logger .Println ("Changing workspace config is not implemented" )
12
+ logger .Printf ("Running DidChangeConfiguration with settings %+v \n " , params .Settings )
13
+
14
+ // since the push based approach is deprecated, we always refresh the configuration
15
+ h .retrieveWorkspaceConfiguration (ctx )
16
+
16
17
return nil
17
18
}
18
19
20
+ func (h * ServerHandler ) registerDidChangeConfiguration (ctx context.Context ) {
21
+ // For DidChangeConfiguration to be called on changes in the configuration we need to register
22
+ h .client .RegisterCapability (ctx , & lsp.RegistrationParams {
23
+ Registrations : []lsp.Registration {
24
+ {
25
+ ID : "helm-ls" ,
26
+ Method : "workspace/didChangeConfiguration" ,
27
+ },
28
+ },
29
+ })
30
+ }
31
+
19
32
func (h * ServerHandler ) retrieveWorkspaceConfiguration (ctx context.Context ) {
20
33
logger .Debug ("Calling workspace/configuration" )
21
34
configurationParams := lsp.ConfigurationParams {
@@ -35,7 +48,7 @@ func (h *ServerHandler) retrieveWorkspaceConfiguration(ctx context.Context) {
35
48
h .initializationWithConfig (ctx )
36
49
}
37
50
38
- func parseWorkspaceConfiguration (rawResult []interface {} , currentConfig util.HelmlsConfiguration ) (result util.HelmlsConfiguration ) {
51
+ func parseWorkspaceConfiguration (rawResult []any , currentConfig util.HelmlsConfiguration ) (result util.HelmlsConfiguration ) {
39
52
logger .Debug ("Raw Workspace configuration:" , rawResult )
40
53
41
54
if len (rawResult ) == 0 {
0 commit comments