Skip to content

Migrate boundedNonWhitespaceSequence to use a scope handler #1057

Closed
@pokey

Description

@pokey

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    ^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions