Skip to content

Commit 7a79998

Browse files
committed
Add proper version
1 parent 1a1c72b commit 7a79998

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
@@ -72,6 +72,11 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
7272

7373
setTrace(params.Trace)
7474

75+
version := "devel"
76+
if v, ok := ctx.Value("version").(string); ok {
77+
version = v
78+
}
79+
7580
return &protocol.InitializeResult{
7681
Capabilities: protocol.ServerCapabilities{
7782
CodeActionProvider: false,
@@ -106,7 +111,7 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
106111
ServerInfo: struct {
107112
Name string `json:"name"`
108113
Version string `json:"version,omitempty"`
109-
}{Name: "ntt", Version: "0.12.0"},
114+
}{Name: "ntt", Version: version},
110115
}, nil
111116
}
112117

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)