Skip to content

Use treesitter to make insertion of debuglines smarterΒ #174

@jakubbortlik

Description

@jakubbortlik

Hi @andrewferrier, thanks for your amazing plugin! I'm using it daily in my work. One thing that keeps bugging me, however, is the pasting of debugprint lines inside multiline statements.

Example

With the cursor on the file variable:

file = requests.get(
    data["result"]["file_url"]
)

When I type g?v, I get the following:

file = requests.get(
        print(f"DEBUGPRINT[1]: ahoj.py:29: file={file}")
    data["result"]["file_url"]
)

Instead, what the mapping should produce is:

file = requests.get(
    data["result"]["file_url"]
)
print(f"DEBUGPRINT[1]: ahoj.py:29: file={file}")

This is what ThePrimeagen/refactoring.nvim produces for comparison:

file = requests.get(
    data["result"]["file_url"]
)
# __AUTO_GENERATED_PRINT_VAR_START__
print(f" file: {str(file)}") # __AUTO_GENERATED_PRINT_VAR_END__

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions