11// Copyright 2025 CloudWeGo Authors
2- //
2+ //
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
55// You may obtain a copy of the License at
6- //
6+ //
77// https://www.apache.org/licenses/LICENSE-2.0
8- //
8+ //
99// Unless required by applicable law or agreed to in writing, software
1010// distributed under the License is distributed on an "AS IS" BASIS,
1111// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@ func NewLSPClient(repo string, openfile string, wait time.Duration, opts ClientO
5050 return nil , err
5151 }
5252
53- cli , err := initLSPClient (context .Background (), svr , "file://" + repo , opts .Verbose )
53+ cli , err := initLSPClient (context .Background (), svr , lsp . DocumentURI ( NewURI ( repo )) , opts .Verbose )
5454 if err != nil {
5555 return nil , err
5656 }
@@ -110,7 +110,7 @@ type initializeResult struct {
110110 Capabilities interface {} `json:"capabilities,omitempty"`
111111}
112112
113- func initLSPClient (ctx context.Context , svr io.ReadWriteCloser , dir string , verbose bool ) (* LSPClient , error ) {
113+ func initLSPClient (ctx context.Context , svr io.ReadWriteCloser , dir lsp. DocumentURI , verbose bool ) (* LSPClient , error ) {
114114 h := newLSPHandler ()
115115 stream := jsonrpc2 .NewBufferedStream (svr , jsonrpc2.VSCodeObjectCodec {})
116116 conn := jsonrpc2 .NewConn (ctx , stream , h )
@@ -131,7 +131,7 @@ func initLSPClient(ctx context.Context, svr io.ReadWriteCloser, dir string, verb
131131
132132 initParams := initializeParams {
133133 ProcessID : os .Getpid (),
134- RootURI : lsp . DocumentURI ( dir ) ,
134+ RootURI : dir ,
135135 Capabilities : cs ,
136136 Trace : lsp .Trace (trace ),
137137 ClientInfo : lsp.ClientInfo {Name : "vscode" },
0 commit comments