Skip to content

Commit

Permalink
Sort variables by name when debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaumgarten committed Apr 16, 2021
1 parent 20748e5 commit b23eac7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/debug/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -483,8 +484,15 @@ func (h *YODKHandler) OnVariablesRequest(arguments *dap.VariablesArguments) (*da
i++
}

sortVariableList(resp.Variables)

return resp, nil
}

func sortVariableList(vars []dap.Variable) {
sort.Slice(vars, func(i, j int) bool {
return vars[i].Name < vars[j].Name
})
}

// OnSetVariableRequest implements the Handler interface
Expand Down

0 comments on commit b23eac7

Please sign in to comment.