Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Autoclosing Single Quote in Macro Programming #255

Closed
kkdaisuki opened this issue Jun 16, 2023 · 3 comments
Closed

Autoclosing Single Quote in Macro Programming #255

kkdaisuki opened this issue Jun 16, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@kkdaisuki
Copy link

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?

@nicolasstucki nicolasstucki added the enhancement New feature or request label Jun 16, 2023
@nicolasstucki
Copy link
Contributor

We might also use the notIn guard.

@Jentsch
Copy link
Contributor

Jentsch commented Oct 8, 2024

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 }

Jentsch added a commit to Jentsch/vscode-scala-syntax that referenced this issue Oct 8, 2024
Fixes Autoclosing Single Quote in Macro Programming scala#255
@tgodzik
Copy link
Contributor

tgodzik commented Oct 9, 2024

We stopped adding the second ' as it proved to be a problem here and overall not a great improvement over just typing it normally

@tgodzik tgodzik closed this as completed Oct 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants