cmd/golsp: log elapsed times in milliseconds rather than microseconds.

Language servers provided by Microsoft seem to use Date.Now()
for calculating elapsed times. In javascript and typescript Date.Now()
reports milliseconds.

Change-Id: Ic12fc4a1d31f2548d8808b8b22aba80c44f000c3
Reviewed-on: https://go-review.googlesource.com/c/155018
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Peter Weinberger 2018-12-19 09:55:15 -05:00
parent 537d06c362
commit 3ad2d988d5
1 changed files with 2 additions and 1 deletions

View File

@ -97,7 +97,8 @@ func (s *server) Run(ctx context.Context, args ...string) error {
}
fmt.Fprint(outx, "'")
if elapsed >= 0 {
fmt.Fprintf(outx, " in %vms", elapsed.Nanoseconds()/1000)
msec := int(elapsed.Round(time.Millisecond) / time.Millisecond)
fmt.Fprintf(outx, " in %dms", msec)
}
params := string(*payload)
if params == "null" {