It would seem that the Language Server is unable to deal with empty .mojo files. This is particularly an issue with __init__.mojo files which are often meant to be empty.
This creates a false positive as the packages are highlighted as containing errors, which in fact do not:
This is the error message received when opening an empty .mojo file:
A crash happened in the Mojo Language Server when processing this document. The Language Server will try to reprocess this document once it is edited again. Please report this issue in https://github.com/modularml/mojo/issues along with all the relevant source codes with their current contents.
Steps to reproduce:
Create an empty __init__.mojo file. Open said mojo file.
Observe error:
Request:
The LSP should be able to deal with empty .mojo files and not report a crash.
Workaround:
Adding a comment or a blank line to the top of the init file removes the error.
Issue Description
It would seem that the Language Server is unable to deal with empty .mojo files. This is particularly an issue with
__init__.mojo
files which are often meant to be empty.This creates a false positive as the packages are highlighted as containing errors, which in fact do not:
This is the error message received when opening an empty .mojo file:
Steps to reproduce:
Create an empty
__init__.mojo
file. Open said mojo file. Observe error:Request:
The LSP should be able to deal with empty .mojo files and not report a crash.
Workaround:
Adding a comment or a blank line to the top of the init file removes the error.