posit-dev / posit-dev/positron

Nested statements are sometimes incorrectly detected

Open
#3,464 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug lang: python
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

Positron Version:

Positron Version: 2024.06.0 (Universal) build 40

Steps to reproduce the issue:

  1. Run this code with the cursor on the assert statement:

    if 0:
        assert (1 + 2
        ) == 3
    
  2. The entire snippet will be execute.

Here's another example that does not work as expected:

if 0:
    if 0:
        assert 1 + 2 == 3

What did you expect to happen?

Only the assert statement should be executed.

Were there any error messages in the output or Developer Tools console?

No.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Positron using both Python snippets, with the cursor on the assert statement, and observe which code is executed. Trace the statement-detection or execution entry point responsible for nested blocks; done means only the selected assert statement executes in both examples, with no regression in existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.