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

Added iteration scope for python arguments #2757

Merged
merged 1 commit into from
Jan 25, 2025
Merged

Conversation

AndreasArvidsson
Copy link
Member

Fixes #2729

Checklist

  • I have added tests
  • [/] I have updated the docs and cheatsheet
  • [/] I have not broken the cheatsheet

@AndreasArvidsson AndreasArvidsson requested a review from a team as a code owner January 25, 2025 06:06
"(" @argumentOrParameter.iteration.start.endOf
")" @argumentOrParameter.iteration.end.startOf
) @argumentOrParameter.iteration.domain
"(" @argumentOrParameter.iteration.start.endOf @name.iteration.start.endOf @value.iteration.start.endOf
Copy link
Member

Choose a reason for hiding this comment

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

NB: Andreas says there's a limit of three captures on each node and more are silently discarded by tree-sitter, so beware.

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we should lint this - or adding to SCM tests

@@ -7,10 +7,16 @@ export const pythonScopeSupport: LanguageScopeSupportFacetMap = {
"name.foreach": supported,
"name.resource": supported,
"name.resource.iteration": supported,
"name.argument.actual": supported,
Copy link
Member

Choose a reason for hiding this comment

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

NB: we could extend this to other languages that support keyword arguments like ruby, but we need to have familiarity with them. A quick check of

(hash) @map
shows that it doesn't even support argument yet

@@ -0,0 +1,16 @@
aaa(bbb=0, ccc=1)
Copy link
Member

Choose a reason for hiding this comment

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

Names come from compiler history -- an "actual" parameter is where it is passed, a formal parameter is where it is defined in the function definition (if there is one)

@phillco phillco added this pull request to the merge queue Jan 25, 2025
Merged via the queue into main with commit 220e381 Jan 25, 2025
15 checks passed
@phillco phillco deleted the pythonArgumentIteration branch January 25, 2025 19:22
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.

python: No iteration scope for "name" and "value" in function call args
2 participants