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 remaining text based scope types to new scope handler setup #1052

Open
7 of 9 tasks
pokey opened this issue Oct 21, 2022 · 5 comments
Open
7 of 9 tasks

Migrate remaining text based scope types to new scope handler setup #1052

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

Comments

@pokey
Copy link
Member

pokey commented Oct 21, 2022

We'd like to migrate all of our scope types to use the new scope handler setup introduced in #1031. See

  • existing scope handlers such as TokenScopeHandler,
  • the ScopeHandler interface definition, and
  • the NestedScopeHandler class, which might be of use

Scope types to migrate

@pokey pokey added bug Something isn't working enhancement New feature or request labels Oct 21, 2022
@pokey pokey added this to the Short list milestone Jul 6, 2023
@pokey pokey modified the milestones: Short list, 1.0 Jul 24, 2024
@AndreasArvidsson AndreasArvidsson changed the title Migrate remaining scope types to new scope handler setup Migrate remaining text based scope types to new scope handler setup Oct 22, 2024
@AndreasArvidsson
Copy link
Member

@phillco @pokey

I'm looking into migrating the notebook cell scope and just realize that we are actually using notebookCell in markdown.

(
(fenced_code_block
(fenced_code_block_delimiter) @_.interior.start.endOf
.
(block_continuation)
(fenced_code_block_delimiter) @_.interior.end.startOf
) @notebookCell
(#trim-end! @notebookCell)
(#insertion-delimiter! @notebookCell "\n\n")
)

The problem of course is that you can have markdown cells in a python notebook. What would "take next cell" do in a markdown cell?

@pokey
Copy link
Member Author

pokey commented Nov 21, 2024

I think that should just function like a nested scope, no? Haven't thought much about implementation but I think desired behaviour is well defined. Ie if you're in a code block in a markdown cell, then it targets next code block in the same cell if it exists, otherwise next cell. I believe that's how a nested scope would behave

@AndreasArvidsson
Copy link
Member

But what if you are not in a code block in markdown? Should next cell refer to a markdown code block further down or a next notebook cell?

Implementation wise I think it simplest to just ask the language scope provider and if we get no results go for a notebook cell. Does that sound good?

@pokey
Copy link
Member Author

pokey commented Nov 21, 2024

I think the consistent thing to do if we're treating it as nested scope would be to go to next markdown code block if we find one in current cell, otherwise next cell

Tho I do think that might be surprising, which kinda argues they should really be different scopes

@AndreasArvidsson
Copy link
Member

I think we will get that behavior if we do as I specified above.

But a different scope for notebook cells is of course another option. Maybe we should start with a combined one and see if anyone runs into problem?

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