@@ -126,28 +126,28 @@ func NewInoHandler(stdio io.ReadWriteCloser, board lsp.Board) *InoHandler {
126126 },
127127 }
128128 handler .clangdStarted = sync .NewCond (& handler .dataMux )
129- stdStream := jsonrpc2 .NewBufferedStream (stdio , jsonrpc2.VSCodeObjectCodec {})
130- var stdHandler jsonrpc2.Handler = jsonrpc2 .HandlerWithError (handler .HandleMessageFromIDE )
131- handler .StdioConn = jsonrpc2 .NewConn (context .Background (), stdStream , stdHandler ,
132- jsonrpc2 .OnRecv (streams .JSONRPCConnLogOnRecv ("IDE --> LS CL:" )),
133- jsonrpc2 .OnSend (streams .JSONRPCConnLogOnSend ("IDE <-- LS CL:" )),
134- )
135129
136130 if buildPath , err := paths .MkTempDir ("" , "arduino-language-server" ); err != nil {
137131 log .Fatalf ("Could not create temp folder: %s" , err )
138132 } else {
139133 handler .buildPath = buildPath .Canonical ()
140134 handler .buildSketchRoot = handler .buildPath .Join ("sketch" )
141135 }
142-
143- handler .progressHandler = NewProgressProxy (handler .StdioConn )
144-
145136 if enableLogging {
146137 log .Println ("Initial board configuration:" , board )
147138 log .Println ("Language server build path:" , handler .buildPath )
148139 log .Println ("Language server build sketch root:" , handler .buildSketchRoot )
149140 }
150141
142+ stdStream := jsonrpc2 .NewBufferedStream (stdio , jsonrpc2.VSCodeObjectCodec {})
143+ var stdHandler jsonrpc2.Handler = jsonrpc2 .HandlerWithError (handler .HandleMessageFromIDE )
144+ handler .StdioConn = jsonrpc2 .NewConn (context .Background (), stdStream , stdHandler ,
145+ jsonrpc2 .OnRecv (streams .JSONRPCConnLogOnRecv ("IDE --> LS CL:" )),
146+ jsonrpc2 .OnSend (streams .JSONRPCConnLogOnSend ("IDE <-- LS CL:" )),
147+ )
148+
149+ handler .progressHandler = NewProgressProxy (handler .StdioConn )
150+
151151 go handler .rebuildEnvironmentLoop ()
152152 return handler
153153}
0 commit comments