Skip to content
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

[Scala] Tweak string and interpolation scopes #4132

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

deathaxe
Copy link
Collaborator

@deathaxe deathaxe commented Jan 7, 2025

This commit tweaks string and interpolation related scopes after the scheme of Python and ShellScript.

  1. from python use meta.string.interpolated and string.quoted.double.block

  2. from shell use interpolation scopes.

    Scope guidelines request punctuation.section.interpolation.[begin|end], but $ variables are historically scoped punctuation.definition.variable.

    This commit (as shellscript) attempt to satisfy both.

    Hence $ in ${} is scoped punctuation.definition.variable, which may appear odd in the first place.

    Actually $ is some sort of expansion operator, which adds a variable's or expression's result into containing string. Perl calls it dereferencing operator.

    Most core syntaxes supporting that kind of syntax struggle with it, currently.

    TL;TR This commit aligns scopes with existing core syntaxes even though there are still some caveats. Solving them is however a bigger task affecting various syntaxes. Good consistent alternatives are required first.

This commit tweaks string and interpolation related scopes after the scheme
of Python and ShellScript.

1. from python use `meta.string.interpolated` and `string.quoted.double.block`
2. from shell use interpolation scopes.

   Scope guidelines request `punctuation.section.interpolation.[begin|end]`,
   but `$` variables are historically scoped `punctuation.definition.variable`.

   This commit (as shellscript) attempt to satisfy both.

   Hence `$` in `${}` is scoped punctuation.definition.variable, which may
   appear odd in the first place.

   Actually `$` is some sort of expansion operator, which adds a variable's
   or expression's result into containing string. Perl calls it dereferencing
   operator.

   Most core syntaxes supporting that kind of syntax struggle with it,
   currently.

   TL;TR This commit aligns scopes with existing core syntaxes even though
   there are still some caveats.
Scala/Scala.sublime-syntax Outdated Show resolved Hide resolved
Scala/Scala.sublime-syntax Show resolved Hide resolved
Scala/Scala.sublime-syntax Outdated Show resolved Hide resolved
michaelblyons
michaelblyons previously approved these changes Jan 7, 2025
Copy link
Collaborator

@michaelblyons michaelblyons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@deathaxe
Copy link
Collaborator Author

deathaxe commented Jan 7, 2025

Reverted triple-quoted scope to string.quoted.triple as it is also used in C# and Java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants