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

Complete keyword arguments #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Complete keyword arguments #5

wants to merge 1 commit into from

Conversation

tompng
Copy link
Member

@tompng tompng commented Dec 3, 2023

kwarg

For obj.foo ba, ba can be an lvar, method or keyword that starts with ba.
We need to check two things, type of obj and scope at ba in a single analyze.
Completion candidates will be:

  • keyword arguments names of obj.foo
  • local variables in scope at ba
  • methods of self in scope at ba

To do it, ReplTypeCompletion::TypeAnalyze::DigTargets is changed.

# This class is used to check if the node is analyze target, and to skip analyze for some node.
# For `def f;long_code;end; def g; 1.a`, `def f` is skipped, `1` is target_node.

# Only single target_node
DigTargets.new(parent_nodes_to_analyze, target_node){
  callback_when_analyzed_target_node
}
# ↓
# Multiple target nodes
dig_targets = DigTargets.new(parent_nodes_to_analyze)
dig_targets.on(node1){callback1}
dig_targets.on(node2){callback2}

@tompng tompng added the enhancement New feature or request label Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant