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

Two issues with python-mode snippets #490

Open
joostkremers opened this issue Feb 13, 2024 · 4 comments
Open

Two issues with python-mode snippets #490

joostkremers opened this issue Feb 13, 2024 · 4 comments

Comments

@joostkremers
Copy link

joostkremers commented Feb 13, 2024

When I open a Python file, I get two yasnippet warnings. First:

Ignoring unknown directive "NOTE" in file: /home/joost/.emacs.d/elpa/yasnippet-snippets-20240115.1138/snippets/python-mode/function_docstring

function_docstring has the following line in its header:

# NOTE: Use minimum indentation, because Emacs 25+ doesn't dedent docstrings.

Removing the colon (or the entire "NOTE: " part) solves the issue.

Second:

Multiple snippets with same identity: "__iter__"

There are two snippets for __iter__, one in a file called iter and one in a file called __iter__. Unfortunately, both use __iter__ for the name: directive. Since both snippets essentially do the same thing, perhaps one can be removed?

I know these are minor issues, but the warnings are displayed in the echo area and may push out other, more important, warnings. (Such as an issue with Eglot, in my case...)

@swinkels
Copy link
Contributor

I just had a look at the warning about the unknown directive "NOTE". That exact line has been in the snippet for 7 years so it must be something in yasnippet itself. Indeed, yasnippet commit joaotavora/yasnippet@25f5d88 (19 January) added the warning message for unknown directives.

Removing the colon seems like a valid workaround, but of course a pull request to modify the snippet is better.

@swinkels
Copy link
Contributor

About the message for the multiple snippets with the same identity, I see that message is added in yasnippet commit joaotavora/yasnippet@8e9ce76 (12 February). Looking at the code comment, it is allowed for one snippet to overwrite another one, but apparently this is not one of these cases.

@swinkels
Copy link
Contributor

@JulienPalard Your commit 9f67370 adds Python snippet file __iter__. This file adds a snippet with the name __iter__, just as the much older snippet file iter does. This leads to a "Multiple snippets with same identity" message.

The snippets are slightly different. Is there a need to support both but if not, which should be the one to keep?

@JulienPalard
Copy link
Contributor

Thanks for reporting.

I opened pr #500 to remove one of the two iter. I kept the one consistent with the other snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants