vscode-scala-syntax
vscode-scala-syntax copied to clipboard
Autoclosing Single Quote in Macro Programming
Hello!
I am working on some macros recently on VS Code. Nevertheless I find it quite bothering that whenever I try to create a quoted expression, the plugin automatically closed it for me. A simple example,
def concatImpl(a: Expr[String], b: Expr[String])(using Quotes): String =
a.valueOrAbort + b.valueOrAbort
inline def concat(a: String, b: String)(using Quotes): String = ${ concatImpl('...'...) }
// ^
// A single quote is automatically created here by the plugin during editing
It seems that language-configuration.json defines single quote to be one of the autoclosing pairs. Removing it would certainly solve this problem, but it may also impact the user experience of the users without the need to use macros. What do you think?
We might also use the notIn guard.
I don't think notIn can help here. If I understand the syntax correctly after an single ' it's unkown if we want to contiue with a charater literal or a quote.
val incomplete = '
val singlechar = 'a'
val marcoquote = '{ 1 }
We stopped adding the second ' as it proved to be a problem here and overall not a great improvement over just typing it normally