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

Python DogeGenerate documentation indentation #85

Closed
samkatt opened this issue May 12, 2020 · 5 comments
Closed

Python DogeGenerate documentation indentation #85

samkatt opened this issue May 12, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@samkatt
Copy link

samkatt commented May 12, 2020

Describe the bug

DogeGenerate does not adapt to function indentation when next line is empty in python.

Calling :DogeGenerate on a function will generate the (correct) string documentation with (sometimes incorrect) zero indentation. This seems to only happen if the next line is empty --- If the next line contains code with the correct indentation then Doge works as expected

Settings
None. Reproducible with zero modifications.

To Reproduce

  1. Empty vimrc other than the Doge plugin
  2. Create simple python file with indented function, test.py:
def bar():

    print('hello')
  1. :DogeGenerate <CR>
  2. Result:
def bar():
"""
[TODO:description]

"""
    print('hello')

Expected behavior
I expect the result (instead of step 4.) to be

def bar():
    """
    [TODO:description]

    """
    print('hello')

Screenshots

Initial situation:
init

Result:
result

Expected:
expected

@samkatt samkatt added the bug Something isn't working label May 12, 2020
@kkoomen
Copy link
Owner

kkoomen commented May 15, 2020

This bug has been fixed and released in v2.2.9.

Feel free to submit any new issues if you experience any unwanted behavior in the future. Thanks for your contribution.

@kkoomen kkoomen closed this as completed May 15, 2020
@l00sed
Copy link

l00sed commented Jan 5, 2023

@kkoomen
Thanks for a great plugin. I seem to be having the same issue again on the latest version.
Running :DogeGenerate on the given python function indents the documentation at 2 spaces rather than the expected 4.
My buffer's tw=2 ts=2, but it seems to happen when I set those to 4 as well.
image

@kkoomen
Copy link
Owner

kkoomen commented Jan 5, 2023

@l00sed Indentation is based on shiftwidth() which is based on the tabstop variable. If you've set ts=2 then obviously it will indent at 2. This is expected behavior.

@l00sed
Copy link

l00sed commented Jan 5, 2023

@kkoomen Yes, sorry if I was unclear, it also seems to use 2 spaces with tabstop set to 4:
image

@l00sed
Copy link

l00sed commented Jan 5, 2023

@kkoomen Ah, okay, nvm. Setting sw=4 and ts=4 fixes the issue. sw was still set to 2 in my previous comment, thanks! I like the denser indent markings with sw=2/ts=2, but alas I think this screws up other behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants