MCPcopy Create free account
hub / github.com/docker/docker-language-server / urlPath

Function urlPath

internal/pkg/server/initialize.go:22–37  ·  view source on GitHub ↗
(u string)

Source from the content-addressed store, hash-verified

20)
21
22func urlPath(u string) (string, error) {
23 parsed, err := url.Parse(u)
24 if err != nil {
25 var ee url.EscapeError
26 if errors.As(err, &ee) && strings.HasSuffix(err.Error(), "invalid URL escape \"%24\"") {
27 if strings.HasPrefix(u, "file://wsl%24/") {
28 return "\\\\wsl$\\" + strings.ReplaceAll(u[len("file://wsl%24/"):], "/", "\\"), nil
29 }
30 }
31 return "", &jsonrpc2.Error{
32 Code: -32602,
33 Message: fmt.Sprintf("invalid rootUri specified in the initialize request (%v): %v", u, err.Error()),
34 }
35 }
36 return parsed.Path, nil
37}
38
39func (s *Server) Initialize(ctx *glsp.Context, params *protocol.InitializeParams) (any, error) {
40 bytes, err := json.Marshal(params.Capabilities.Experimental)

Callers 1

InitializeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected