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

Migrate boundedNonWhitespaceSequence to use a scope handler #1057

Open
Tracked by #1052
pokey opened this issue Oct 21, 2022 · 0 comments
Open
Tracked by #1052

Migrate boundedNonWhitespaceSequence to use a scope handler #1057

pokey opened this issue Oct 21, 2022 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@pokey
Copy link
Member

pokey commented Oct 21, 2022

Proposed implementation

  • First run "paint"
  • For each scope returned from paint, iterate scopes from surrounding pair using the following hints:
    {
       "distalPosition": endOfPaintScope,)
       "includeDescendantScopes": true,
    }
  • Note that we want to use a modified surrounding pair scope handler which uses "inside" as content range
  • For each such surrounding pair scope, yield a scope which is the intersection of the surrounding pair scope with the paint scope
  • Yield the paint scope itself
  • For iteration scope, just use a Implement fallback scope handler #1097 scope combinator which falls back from a version of surrounding pair where the domain is actually just the inside (including whitespace), falling back to "line"

Dependencies

Test cases to add

(using syntax proposed in #1524)

#!! scope: {type: boundedNonWhitespaceSequence}
#!! languageId: plaintext, python, typescript

    foo(bar)
#!1 ^^^^^^^^
#!2     ^^^
#!3 ********
#!4     ***

    foo(bar baz)
#!1 ^^^^^^^     
#!2     ^^^     
#!3         ^^^ 
#!4         ^^^^
#!5 ************
#!6     ******* 

    (foo)bar
#!1  ^^^
#!2 ^^^^^^^^

    foo(bar)baz
#!1 ^^^^^^^^^^^
#!2     ^^^

    foo( bar )
#!1 ^^^^
#!2      ^^^
#!3          ^

    foo(bar )
#!1 ^^^^^^^
#!2     ^^^
#!3         ^

    (  foo)bar(baz  )
#!1 ^                
#!2    ^^^           
#!3    ^^^^^^^^^^^   
#!4            ^^^   
#!5                 ^

    colors.back)ground.dark
#!1 ^^^^^^^^^^^
#!2 ^^^^^^^^^^^^^^^^^^^^^^^

    ( foo)bar
#!1 ^
#!2   ^^^
#!3   ^^^^^^^

    (( foo)bar)baz
#!1 ^^            
#!2  ^            
#!3    ^^^        
#!4    ^^^^^^^    
#!5    ^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants