Python code snippet comments become tags

Steps to reproduce

Add a code snippet with Python code including a comment:
with model as model: # do stuff #do more stuff

Expected result

Just the snippet, no new tags.

Actual result

Both comments are now counted as a tag: specifically an empty tag # and a #do tag.



I don’t have this problem

Also consider using piotr’s code snippets extension as indicated above on gif. Find it here:

Sorry, I was apparently a bit careless in the original post. What I am actually seeing upon closer inspection is that the comments are counted as empty tags, i.e. #, in the tag pane. They do appear as code in the actual file where they are typed as you show.

I realised as I was typing this answer that what is happening is that somewhere I have a piece of code, outside of quotation marks, therefore an empty tag has been created for comments like ‘# a python comment’. When clicking this in the tag pane it apparently finds ALL mentions of a hashtag.

Screenshots of my current situation on the OSX app.

As it looks in the document:

When going to tag pane and clicking the empy tag ‘#’ I get that note (among other files I have as search results)

After removing any occurrences of code outside of back quotes, the empty tag has disappeared as it should.

Sorry for the confusion.

1 Like