Skip to content

Commit

Permalink
Improve version info
Browse files Browse the repository at this point in the history
  • Loading branch information
5nord committed Feb 17, 2021
1 parent 91093de commit 9f2aa76
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions internal/lsp/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"bytes"
"context"
"os"
"runtime/debug"
"os/exec"
"strings"
"text/template"

"github.com/nokia/ntt/internal/ntt"
Expand All @@ -15,7 +16,7 @@ const statusTemplate = `
=== Language Server Status ===
Executable : {{ .Executable }}
Version : {{ .Version }} {{ .Sum }}
Version : {{ .Version }}
Process ID : {{ .PID }}
Expand All @@ -30,7 +31,6 @@ Known Files: {{- range .Suite.Files}}
type Status struct {
Executable string
Version string
Sum string
PID int
Suite struct {
Root string
Expand All @@ -45,11 +45,9 @@ func NewStatus(suite *ntt.Suite) *Status {

if path, err := os.Executable(); err == nil {
s.Executable = path
}

if info, ok := debug.ReadBuildInfo(); ok {
s.Version = info.Main.Version
s.Sum = info.Main.Sum
if out, err := exec.Command(path, "version").Output(); err == nil {
s.Version = strings.TrimSpace(string(out))
}
}

if root := suite.Root(); root != nil {
Expand Down

0 comments on commit 9f2aa76

Please sign in to comment.