Skip to content

Inline comments (e.g., gcw) in Python #234

@IamGianluca

Description

@IamGianluca

Hi,

I just discovered the plugin and getting up to speed. I've seen that with some languages, the plugin is smart enough to comment out an argument in a function call:

-- from this
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
-- to this
vim.keymap.set('n',--[[  '<space>e' ]], vim.diagnostic.open_float, opts)

In Python, however, the plugin doesn't return a valid syntax if we comment out an argument.

# from this
def my_function(a, b):
    return b
# to this
def my_function( #a, b):
    return b

I would have expected it to return something like this...

def my_function(b):  #a):
    return b

I'm assuming this is because Python doesn't have inline comments, but I was wondering if there was a way to achieve something similar to what I described. It would be particularly useful when refactoring code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions