@@ -303,7 +303,11 @@ func (s *Server) handleDidClose(req *lsproto.RequestMessage) error {
303
303
func (s * Server ) handleDocumentDiagnostic (req * lsproto.RequestMessage ) error {
304
304
params := req .Params .(* lsproto.DocumentDiagnosticParams )
305
305
file , project := s .getFileAndProject (params .TextDocument .Uri )
306
- diagnostics := project .LanguageService ().GetDocumentDiagnostics (file .FileName ())
306
+ diagnostics , err := project .LanguageService ().GetDocumentDiagnostics (file .FileName ())
307
+ if err != nil {
308
+ return s .sendError (req .ID , err )
309
+ }
310
+
307
311
lspDiagnostics := make ([]lsproto.Diagnostic , len (diagnostics ))
308
312
for i , diag := range diagnostics {
309
313
if lspDiagnostic , err := s .converters .toLspDiagnostic (diag ); err != nil {
@@ -330,7 +334,11 @@ func (s *Server) handleHover(req *lsproto.RequestMessage) error {
330
334
return s .sendError (req .ID , err )
331
335
}
332
336
333
- hoverText := project .LanguageService ().ProvideHover (file .FileName (), pos )
337
+ hoverText , err := project .LanguageService ().ProvideHover (file .FileName (), pos )
338
+ if err != nil {
339
+ return s .sendError (req .ID , err )
340
+ }
341
+
334
342
return s .sendResult (req .ID , & lsproto.Hover {
335
343
Contents : lsproto.MarkupContentOrMarkedStringOrMarkedStrings {
336
344
MarkupContent : & lsproto.MarkupContent {
@@ -349,7 +357,11 @@ func (s *Server) handleDefinition(req *lsproto.RequestMessage) error {
349
357
return s .sendError (req .ID , err )
350
358
}
351
359
352
- locations := project .LanguageService ().ProvideDefinitions (file .FileName (), pos )
360
+ locations , err := project .LanguageService ().ProvideDefinitions (file .FileName (), pos )
361
+ if err != nil {
362
+ return s .sendError (req .ID , err )
363
+ }
364
+
353
365
lspLocations := make ([]lsproto.Location , len (locations ))
354
366
for i , loc := range locations {
355
367
if lspLocation , err := s .converters .toLspLocation (loc ); err != nil {
0 commit comments