Fix star import completions missing in Interpreter mode#2092
Closed
worksbyfriday wants to merge 3 commits intodavidhalter:masterfrom
Closed
Fix star import completions missing in Interpreter mode#2092worksbyfriday wants to merge 3 commits intodavidhalter:masterfrom
worksbyfriday wants to merge 3 commits intodavidhalter:masterfrom
Conversation
When completing `object. \n` at position (1, 8), jedi gets the leaf
at the cursor position, which is a newline node. The code only
checked for `endmarker` as a special case where the leaf isn't the
dot, but newline nodes need the same treatment.
Without this fix, the newline leaf gets passed through to
`_complete_trailer`, which eventually calls `_infer_node` on the
dot operator, triggering an AssertionError ("unhandled operator '.'").
The fix adds `newline` to the type check alongside `endmarker`.
Fixes davidhalter#1954
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a function like ``def f(x, **kwargs): return f((x,), **kwargs)`` is analyzed, ``_iter_nodes_for_param`` follows the ``**kwargs`` usage back to the same function, triggering infinite recursion through ``process_params`` → ``_iter_nodes_for_param`` → ``_goes_to_param_name`` → back into the inference engine. Add a module-level ``_processing_params`` set to track which (function_node, param_name) pairs are currently being processed and break the cycle. Fixes davidhalter#2085 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MixedModuleContext.get_filters() was not delegating to the underlying module value's filters, causing star imports (from x import *) to be missing from Interpreter completions while working correctly in Script. The fix mirrors ModuleContext.get_filters(): get the value's filters, skip the first one (replaced by MixedParserTreeFilter), then yield the remaining filters which include star imports, sub-modules, and module attributes. Fixes davidhalter#2087. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Hi, I'm sorry to say this, but I decided to not work at all with AI generated pull requests/content. There are multiple reasons for this:
Thank you anyway for trying to contribute to Open Source. I would really appreciate if you avoid the usage of LLMs in my projects. It is obviously fine to use LLMs as a search/brainstorming tool with my projects, just don't use it to interact with me. PS: As a side note I want to mention that I'm probably not the only maintainer that is annoyed by LLM content. So you probably should not use LLMs for other repositories either. My initial emotions towards LLM content was way more negative than this message is and I assume other maintainers frequently have very negative feelings as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Interpreter.complete()returns no results for star imports (from json import *) whileScript.complete()works correctly.Root cause:
MixedModuleContext.get_filters()was not delegating to the underlying module value's filter chain. This meant star import filters (fromModuleValue.iter_star_filters()) were never included in the completion results.Fix: Mirror
ModuleContext.get_filters()— get the value's filters, skip the first one (replaced byMixedParserTreeFilter), then yield the remaining filters which include star imports, sub-modules, and module attributes.Before:
After:
Test plan
test_star_import_completionsto verify star imports work inInterpreterFixes #2087.
🤖 Generated with Claude Code