vscode-markdown-notes icon indicating copy to clipboard operation
vscode-markdown-notes copied to clipboard

Autocomplete by title

Open ais opened this issue 5 years ago • 9 comments

Is your feature request related to a problem? Please describe.

I use ID-based filenames for my notes. There are two problems with this:

  1. I need to type at least one digit and explicitly press CTRL+SPACE to see file suggestions (#99); and
  2. the file suggestions aren't very helpful at a glance (they're just numerical IDs).

Describe the solution you'd like

I would like to search by title and insert the filepath (example: https://github.com/ais/vscode-markdown-notes/commit/61d88b298fa0e7c4f9c58beeb94c3c48ff929763).

This seems to allow as-you-type suggestions and I can more easily to identify what I'm after.

Describe alternatives you've considered

I have a script to find matching titles and display IDs to titles, but it would be more convenient if I could do it within the editor.

Additional context

N/A

ais avatar Jan 15 '21 23:01 ais

Seems like I always have to manually enter my keybinding for Trigger Suggest too though I don't need an explicit character first, my filenames are all titlecase and many have spaces.

ChristinWhite avatar Mar 14 '21 21:03 ChristinWhite

@ais: what do you mean search by "title" -- would that be the first line of text in the note that begins with a #? If so, I could imagine that being a cool feature.

@ChristinWhite: since about a year ago (due to some vscode update) I now also always have to manually Trigger Suggest - I would love it if we could fix this, but as far as I can tell, it is a vscode issue, not an issue with this extension.

kortina avatar Mar 15 '21 15:03 kortina

@kortina Ah, gotcha, that makes sense.

ChristinWhite avatar Mar 15 '21 17:03 ChristinWhite

@kortina:

would that be the first line of text in the note that begins with a #?

Precisely. I'm currently hardcoding it this way in my fork (ais@4a6058a).

gif

210315_3793

Suggest-as-you-type was also magically working in my fork (until it wasn't), but that was just a happy accident.

ais avatar Mar 15 '21 17:03 ais

Alternatively you could use this unofficial standard:

---
title: my title
author: my name
date: today
---

(rest of document)

See: https://stackoverflow.com/questions/47221925/is-there-a-markdown-syntax-for-titles-author-etc

alexis- avatar Apr 06 '21 19:04 alexis-

Yea, I think I would prolly say best course of action is to default to what @alexis suggests, fallback to the first # h1 heading if there is no frontmatter title.

I love this idea and it is probably a fairly straightforward thing to implement (we already have a routine that parses the body of every note to find backlinks and tags, so just a matter of hooking into that, building the index, and adding it to the CompletionHandler.

I think this is a good first PR if someone wants to give it a shot (happy to help if there are implementation questions)

kortina avatar Apr 07 '21 01:04 kortina

@kortina I'm interested in implementing this. I'll let you know if I get stuck.

Awesome extension btw!

thetimmorland avatar Apr 21 '21 14:04 thetimmorland

Awesome! Please (1) give an eye to performance, eg, there is already a routine that parses the bodies of notes to look for tags you can hook into when you build up the search index for tittles (2) write some tests (the tests use no vscode dependencies so you can run them with jest on the command line).

Thank you!

kortina avatar Apr 21 '21 15:04 kortina

I too am looking for this functionality.

I have files with names like some_topic.md, and currently autocompletion options are either some_topic.md, some_topic or some topic depending on the settings configured. I've been using the spaces some topic style.

What I would like is the ability to specify whether a particular topic is a pronoun or not and then have the autocompletion respect that when generating options. That way, if an individual file has marked that it is a pronoun (using a tag? Or some other mechanism?), then its completion option would automatically apply a "title case" transformation on its insertion text, e.g. Some Topic. This would not apply for things that lack the pronoun flag; such terms would autocomplete as some topic or however you specified it in settings.

I'm curious how things are going for you @thetimmorland.

willnationsdev avatar Jun 14 '21 00:06 willnationsdev