@@ -153,16 +153,16 @@ func NewINOLanguageServer(stdin io.Reader, stdout io.Writer, config *Config) *IN
153153 return ls
154154}
155155
156- func (ls * INOLanguageServer ) InitializeReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , inoParams * lsp.InitializeParams ) (* lsp.InitializeResult , * jsonrpc.ResponseError ) {
156+ func (ls * INOLanguageServer ) InitializeReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger , ideParams * lsp.InitializeParams ) (* lsp.InitializeResult , * jsonrpc.ResponseError ) {
157157 go func () {
158158 defer streams .CatchAndLogPanic ()
159159 // Unlock goroutines waiting for clangd
160160 defer ls .clangdStarted .Broadcast ()
161161
162162 logger := NewLSPFunctionLogger (color .HiCyanString , "INIT --- " )
163- logger .Logf ("initializing workbench: %s" , inoParams .RootURI )
163+ logger .Logf ("initializing workbench: %s" , ideParams .RootURI )
164164
165- ls .sketchRoot = inoParams .RootURI .AsPath ()
165+ ls .sketchRoot = ideParams .RootURI .AsPath ()
166166 ls .sketchName = ls .sketchRoot .Base ()
167167 ls .buildSketchCpp = ls .buildSketchRoot .Join (ls .sketchName + ".ino.cpp" )
168168
@@ -178,8 +178,8 @@ func (ls *INOLanguageServer) InitializeReqFromIDE(ctx context.Context, logger js
178178 logger .Logf ("ERROR: updating compile_commands: %s" , err )
179179 }
180180
181- if cppContent , err := ls .buildSketchCpp .ReadFile (); err == nil {
182- ls .sketchMapper = sourcemapper .CreateInoMapper (cppContent )
181+ if inoCppContent , err := ls .buildSketchCpp .ReadFile (); err == nil {
182+ ls .sketchMapper = sourcemapper .CreateInoMapper (inoCppContent )
183183 ls .sketchMapper .CppText .Version = 1
184184 } else {
185185 logger .Logf ("error starting clang: reading generated cpp file from sketch: %s" , err )
@@ -205,17 +205,17 @@ func (ls *INOLanguageServer) InitializeReqFromIDE(ctx context.Context, logger js
205205 // Send initialization command to clangd (1 sec. timeout)
206206 ctx , cancel := context .WithTimeout (context .Background (), time .Second )
207207 defer cancel ()
208- cppInitializeParams := * inoParams
209- cppInitializeParams .RootPath = ls .buildSketchRoot .String ()
210- cppInitializeParams .RootURI = lsp .NewDocumentURIFromPath (ls .buildSketchRoot )
211- if initRes , clangErr , err := ls .Clangd .conn .Initialize (ctx , & cppInitializeParams ); err != nil {
208+ clangInitializeParams := * ideParams
209+ clangInitializeParams .RootPath = ls .buildSketchRoot .String ()
210+ clangInitializeParams .RootURI = lsp .NewDocumentURIFromPath (ls .buildSketchRoot )
211+ if clangInitializeResult , clangErr , err := ls .Clangd .conn .Initialize (ctx , & clangInitializeParams ); err != nil {
212212 logger .Logf ("error initilizing clangd: %v" , err )
213213 return
214214 } else if clangErr != nil {
215215 logger .Logf ("error initilizing clangd: %v" , clangErr .AsError ())
216216 return
217217 } else {
218- logger .Logf ("clangd successfully started: %s" , string (lsp .EncodeMessage (initRes )))
218+ logger .Logf ("clangd successfully started: %s" , string (lsp .EncodeMessage (clangInitializeResult )))
219219 }
220220
221221 if err := ls .Clangd .conn .Initialized (& lsp.InitializedParams {}); err != nil {
@@ -297,7 +297,7 @@ func (ls *INOLanguageServer) InitializeReqFromIDE(ctx context.Context, logger js
297297}
298298
299299func (ls * INOLanguageServer ) ShutdownReqFromIDE (ctx context.Context , logger jsonrpc.FunctionLogger ) * jsonrpc.ResponseError {
300- ls .Clangd .conn .Shutdown (context .Background ())
300+ _ , _ = ls .Clangd .conn .Shutdown (context .Background ())
301301 return nil
302302}
303303
0 commit comments