scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

"No Scala version" error does not help when quotes are missing in using scala directive, improve error message or help rewrite

Open bjornregnell opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. It is easy to forget, esp. for a beginner, the quotes around the version as in:

//> using scala 3.1.1

Currently the error message does not help very much, and can really make your head scratch if you have forgotten or missed that quotes are necessary:

$ scala-cli run .
[error]  No Scala version provided to using scala directive

Describe the solution you'd like It would be very helpful with an explicit hint in the error message, something similar to this proposal:

$ scala-cli run .
[error]  The Scala version should be quoted as in:
//> using scala "3.1.1"

The error detection could even ask if quotes should be inserted and the file be rewritten with inserted quotes -- that would be awesome. But at least a better error message would help a lot.

$ scala-cli run .
[error]  The Scala version should be quoted. 
Do you want your using scala directive be re-written to:
//> using scala "3.1.1"
Y/n?

bjornregnell avatar Apr 10 '22 11:04 bjornregnell