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 smartparens Fix #10

Closed

Conversation

LaurenceWarne
Copy link
Contributor

Hi 👋 I think this PR should fix #5 (at least the behaviour with python + smartparens).

What I think was happening was that if docstr-trigger-python detected the next three chars were """ it would remove them and not call (docstr--insert-doc-string (docstr-python--parse)) by virtue of the if-then-else (I don't think behaviour is intended? - please correct me on this if it is).

This path was always hit if smartparens mode was enabled since it inserts the three chars """ after the point once it detects three """ in a row.

Let me know if this fixes the issue ~ thanks Laurence

@jcs090218
Copy link
Member

Thanks for the fix! I have opened another PR at #10. I think this should be the correct fix and your PR definitely gives me the hint about the conflict. Thanks for spending time on this! :D

@jcs090218 jcs090218 added the bug Something isn't working label Apr 17, 2021
@jcs090218 jcs090218 mentioned this pull request Apr 17, 2021
1 task
@LaurenceWarne
Copy link
Contributor Author

Cool 🙂 , I've pulled and python + smartparens works.

I see that (looking-at-p "\"\"\"") has been pulled into the first conditional, does this not mean that without smartparens automatically inserting """ after a user types """, (docstr--insert-doc-string (docstr-python--parse)) will not be triggered? - So docstrings won't be triggered unless a user has smartparens installed (or some equivalent)?

@jcs090218
Copy link
Member

jcs090218 commented Apr 17, 2021

Since we have function docstr-trigger-python binds to command self-insert-command hence every click would trigger this function. I assumed the issue was smartparens does insertion for character " so it triggered the document string twice.

I see that (looking-at-p """"") has been pulled into the first conditional, does this not mean that without smartparens automatically inserting """ after a user types """, (docstr--insert-doc-string (docstr-python--parse)) will not be triggered? - So docstrings won't be triggered unless a user has smartparens installed (or some equivalent)?

Ah, yes. You are correct. I have tried with python-mode and I think python-mode does the insertion job for you? I don't know if #11 is the best solution since this package attend to support python-mode only for now. If you have another major mode that you use to code for python code and yet it does not help you insert """ then it won't be triggered...


Edit: Ah, okay. I figured that I have electric-pair-mode on. That's why I am able to get the document string triggered.

@LaurenceWarne
Copy link
Contributor Author

I'm using master and the changes lgtm 👍 , shall I close this PR?

@jcs090218
Copy link
Member

I'm using master and the changes lgtm 👍 , shall I close this PR?

Yes! Thanks for spending time looking into code for issue #5. :)

@jcs090218 jcs090218 closed this Apr 18, 2021
@LaurenceWarne
Copy link
Contributor Author

No problem, thanks for your fast response 🙂

@LaurenceWarne LaurenceWarne deleted the python-smartparens-fix branch September 23, 2024 09:03
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

Successfully merging this pull request may close these issues.

Conflict with smartparens-mode enabled
2 participants