Skip to content

Commit

Permalink
Add proper version
Browse files Browse the repository at this point in the history
  • Loading branch information
5nord committed Nov 11, 2024
1 parent 1a1c72b commit 7a79998
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion internal/lsp/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ

setTrace(params.Trace)

version := "devel"
if v, ok := ctx.Value("version").(string); ok {
version = v
}

return &protocol.InitializeResult{
Capabilities: protocol.ServerCapabilities{
CodeActionProvider: false,
Expand Down Expand Up @@ -106,7 +111,7 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
ServerInfo: struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
}{Name: "ntt", Version: "0.12.0"},
}{Name: "ntt", Version: version},
}, nil
}

Expand Down
5 changes: 3 additions & 2 deletions langserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"os"

"github.com/nokia/ntt/internal/lsp/fakenet"
"github.com/nokia/ntt/internal/lsp"
"github.com/nokia/ntt/internal/lsp/fakenet"
"github.com/nokia/ntt/internal/lsp/jsonrpc2"
"github.com/spf13/cobra"
)
Expand All @@ -21,5 +21,6 @@ var (

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

0 comments on commit 7a79998

Please sign in to comment.