Skip to content

Commit 8e43c3a

Browse files
committedNov 11, 2024·
Add proper version
1 parent 9bae8eb commit 8e43c3a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
 

‎internal/lsp/general.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
9898

9999
setTrace(params.Trace)
100100

101+
version := "devel"
102+
if v, ok := ctx.Value("version").(string); ok {
103+
version = v
104+
}
105+
101106
return &protocol.InitializeResult{
102107
Capabilities: protocol.ServerCapabilities{
103108
InlayHintProvider: s.registerInlayHintIfNoDynReg(),
@@ -133,7 +138,7 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
133138
ServerInfo: struct {
134139
Name string `json:"name"`
135140
Version string `json:"version,omitempty"`
136-
}{Name: "ntt", Version: "0.12.0"},
141+
}{Name: "ntt", Version: version},
137142
}, nil
138143
}
139144

‎langserver.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"os"
66

7-
"github.com/nokia/ntt/internal/lsp/fakenet"
87
"github.com/nokia/ntt/internal/lsp"
8+
"github.com/nokia/ntt/internal/lsp/fakenet"
99
"github.com/nokia/ntt/internal/lsp/jsonrpc2"
1010
"github.com/spf13/cobra"
1111
)
@@ -21,5 +21,6 @@ var (
2121

2222
func langserver(cmd *cobra.Command, args []string) error {
2323
stream := jsonrpc2.NewHeaderStream(fakenet.NewConn("stdio", os.Stdin, os.Stdout))
24-
return lsp.NewServer(stream).Serve(context.TODO())
24+
ctx := context.WithValue(context.Background(), "version", version)
25+
return lsp.NewServer(stream).Serve(ctx)
2526
}

0 commit comments

Comments
 (0)
Please sign in to comment.