Skip to content

Switch from Scala String + comma separated values syntax to whitespace delimited list #1954

New issue

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

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

Already on GitHub? Sign in to your account

Closed
bishabosha opened this issue Mar 23, 2023 · 2 comments · Fixed by #2076
Closed
Assignees
Labels
enhancement New feature or request

Comments

@bishabosha
Copy link
Contributor

bishabosha commented Mar 23, 2023

Is your feature request related to a problem? Please describe.
To improve the ability to copy-paste snippets, such as compiler options.

Describe the solution you'd like
implement changes in the directives parser so that

//> using options "-Xasync", "-Xfatal-warnings"

can be written as

//> using options -Xasync -Xfatal-warnings

Quotes can still be used for when a value needs to include whitespace, with the same escape characters for scala strings.

Here is a larger example:

//> using scala 3.2.2
//> using toolkit latest
//> using options -Xfatal-warnings -Yexplicit-nulls -Ysafe-init -source:future
//> using dep com.lihaoyi::cask:0.9.0
//> using some.key "I have spaces"

We do not anticipate issues in adapting scala/vscode-scala-syntax to support the new syntax. Additionally, values are still of string type.

Describe alternatives you've considered
no alternative considered.

Additional context
Since directives will not become scala syntax, there is no need to reuse the same rules as the scala parser.

Discussed at the Scala Tooling Summit March 2023

@bishabosha bishabosha added the enhancement New feature or request label Mar 23, 2023
@sjrd
Copy link

sjrd commented Mar 23, 2023

Bringing some additional associated spec that we discussed:

  • For any value that does not immediately start with a ":
    • They cannot contain any " until the next whitespace
    • All other characters, including backslash, are taking verbatim.
  • For values that start with a ":
    • They follow Scala syntax for single-line single-quoted strings
    • Including backslash-based escapes

@bjornregnell
Copy link
Contributor

This is a very nice simplification for newcomers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants