artempyanykh / marksman

Write Markdown with code assist and intelligence in the comfort of your favourite editor.
MIT License
1.98k stars 35 forks source link

Several tag related improvements #262

Closed TheBlob42 closed 10 months ago

TheBlob42 commented 10 months ago

This PR improves tag related functionality with the following:

Obviously these changes are somewhat opinionated but I am open for discussion. Having tags available as symbols makes it easier to find related content. Especially for people using a Zettelkasten or other note taking system with marksman. Quickly finding all notes related to a certain tag or quickly jumping to a relevant section in a long markdown document should ease these workflows.

In regards to the filtering I always wondered why I could not enter any more text after the initial # to filter for a specific tag. I found the related comment in the code, but I don't understand why this decision was made.

Problem to separate headings and tags

Since all symbols in markdown are of the type "String" (nothing else really fits) they are hard to distinguish from another. For the workspace symbols I have made the prefix (e.g. "Tag", "H1", "H2" etc.) filterable as well so that one could easily filter only for tags or heading. However this only makes sense for people using some sort of fuzzy searching instead of a literal string matching where this could lead to usability issues. I am open for other ideas on how to solve this

Once this is clarified I would also check the formatting and add tests for these new cases :slightly_smiling_face:

artempyanykh commented 10 months ago

Thanks for putting it together @TheBlob42! 💖 I'll have a close look shortly

TheBlob42 commented 10 months ago

The one thing missing currently are dedicated tests for the DocumentSymbold and WorkspaceSymbol functionalities. If you're cool with the changes and the layout I would take some time to add those 🙂

TheBlob42 commented 10 months ago

I have cleaned up my changes and the commit history. I have also added some missing tests (workspace symbols) and adapted the existing ones to incorporate the changes in relation to tags, so that they get tested as well.

@artempyanykh please have a look. I am happy to discuss any changes being made :slightly_smiling_face:

artempyanykh commented 10 months ago

I'll push a new release shortly

petobens commented 10 months ago

Hi @TheBlob42 and @artempyanykh thanks for the change! Works great (feel free to close #261). One minior comment: if I have an url like https://docs.google.com/spreadsheets/d/1Rr7GcfjUwhZfylUk0FGL0Et4kYF5etl49OpRwRmhhlg/edit#gid=1116260529&range=D12 marksman will treat this as tag. Is it possible to filter out these cases?

TheBlob42 commented 10 months ago

@petobens good catch :thinking: would probably be worth its own issue

petobens commented 10 months ago

Sure! Done. Thanks!

Gelio commented 10 months ago

I'm super excited this was added! I've been using tags for some time and I missed the LSP features for them.

One enhancement I can suggest is supporting nested tags from Obsidian, like #home/chore, #work/meeting. This would make my Neovim authoring experience even better. I can create an issue for it if you'd like

artempyanykh commented 10 months ago

@Gelio please do create a separate issue for this. Would be great if you could elaborate more on what kind of support you want from nested tags, example use cases.

Gelio commented 10 months ago

Sure thing, I created https://github.com/artempyanykh/marksman/issues/267