Skip to content

"take round" also takes leading $ #1812

Open

Description

@jmegner

"take round air" on $($a) selects $($a), but it should select ($a).

Activity

  1. pokey commented on Aug 19, 2023

    @pokey
    Member

    That is intentional. We consider the $ to be part of the pair

  2. AndreasArvidsson commented on Aug 19, 2023

    @AndreasArvidsson
    Member

    Defined here

    To be honest I've never been one hundred percent sure about that decision.

  3. pokey commented on Aug 19, 2023

    @pokey
    Member

    The idea is to include the full delimiter token, similar to the way we handle f-strings and triple quotes in Python. But if @AndreasArvidsson @josharian and @jmegner all want to push for this one I'll cave

  4. jmegner commented on Aug 19, 2023

    @jmegner
    CollaboratorAuthor

    ....I now better appreciate the benefits of including the dollar sign, but I fear it's just going to cause more surprise and mistakes than benefit. Let me play with it more now that I know it is deliberate.

  5. AndreasArvidsson commented on Aug 24, 2023

    @AndreasArvidsson
    Member

    After discussion with @pokey we came to the following conclusion

    • Matching pairs should be dumb and don't try to expand to anything else than the given pair
    • the string scope type should be implemented per language(eg f"foo" would be implemented by python) with a fall back to matching pairs. This is similar to what we do for item
    • The argument scope type could be used for interpolated variables like ${foo}
  6. pokey commented on Sep 9, 2023

    @pokey
    Member

    the string scope type should be implemented per language(eg f"foo" would be implemented by python) with a fall back to matching pairs. This is similar to what we do for item

    Note that one drawback of this approach is that if you have something like

    aaa = "bbb 'ccc' ddd"
    

    Saying "string cap" will give you the whole string "bbb 'ccc' ddd" rather than 'ccc'.

    However, we have the same problem with "item", where we'll leap to the syntactic item even if you're inside a smaller textual item. We should be able to fix both of these issues more easily once item and pair are migrated to next-gen scopes, so I don't think this problem should keep us from implementing the proposal in @AndreasArvidsson's comment in the meantime

  7. AndreasArvidsson commented on Sep 9, 2023

    @AndreasArvidsson
    Member

    Yes if you just want to match on the ' delimiters you should use a matching pair and not the string scope type. Now we have just overloaded the same word to mean both of them, but in the future we would have this distinction.

  8. pokey commented on Sep 10, 2023

    @pokey
    Member

    Yes if you just want to match on the ' delimiters you should use a matching pair and not the string scope type. Now we have just overloaded the same word to mean both of them, but in the future we would have this distinction.

    I don't think that lines up with what you propose in your bullet points above. See where it says "the string scope type should be implemented per language ... with a fall back to matching pairs"

  9. AndreasArvidsson commented on Sep 10, 2023

    @AndreasArvidsson
    Member

    I see no contradicition in that? The string scope is defined per language and a string in a programming language is (mostly) well defined. Matching quotes inside a string you would have to use matching pairs for.

  10. pokey commented on Jun 12, 2024

    @pokey
    Member

    I think the problem I propose in #1812 (comment) can be solved by a oneOf matcher combining matching pairs and syntactic string. Then it would just be nested as we'd like. We can do this once matching pairs are migrated to next-gen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions