rascal
rascal copied to clipboard
Last line of a rascal.mf file is ignored if there is no newline
Describe the bug
I had a RASCAL.MF file:
Manifest-Version: 0.0.1
Project-Name: test-repo
Source: src/main/rascal
Require-Libraries: |lib://rascal-lsp|
the last line (require libraries) was ignored due to a missing newline at the end of the file. There is no warning or error helping the user out.
this does work:
Manifest-Version: 0.0.1
Project-Name: test-repo
Source: src/main/rascal
Require-Libraries: |lib://rascal-lsp|
Expected behavior I understand we are using the Manifest file standard for this, but can we maybe get it to be a bit more flexible? Or print a warning on a rascal.mf file if we are reading from it but detect the file doesn't end in a newline?
It's a nasty feature to add since we reuse the parsers from the standard library. We have to open the file again and read the last line to produce the warning message.
I'd rather add an LSP server for this file with some more interesting checks such that the IDE helps us get this right without adding another parser to the core system that reads these files.
So that's a proposal: to fix this elsewhere and add META-INF/RASCAL.MF to the Rascal LSP implementation with some meaningful checks including this one. For example, we could also check if people have rewritten Require-Libraries instead of Required-Libraries or whatever the right incantation is :-) Some auto-completion would also be great.
We have to open the file again and read the last line to produce the warning message.
We are doing this quite a lot already. Just read through fromSourceProjectRascalManifest, every call to RascalManifest gets a fresh InputStream for the location.
I don't mean the CPU or I/O time, I'm talking about code to write and maintain for this. I don't want our specific code that parses Manifest strings at this low level in the architecture. I'll go and have a look why the standard library code fails on this input again. It's an old issue, that's for sure.
ah okay. sure, I agree, less code is better.
I've been bit by this a few time the past years :)