(feat): tag completion via capf (#1017)

This commit is contained in:
Jethro Kuan
2020-08-09 21:49:06 +08:00
committed by GitHub
parent 5d02e6407b
commit 0ed9057a87
2 changed files with 49 additions and 26 deletions

View File

@ -314,6 +314,16 @@ Insertions can fail if the key is already in the database."
:limit 1]
file)))
(defun org-roam-db--get-tags ()
"Return all distinct tags from the cache."
(let ((rows (org-roam-db-query [:select :distinct [tags] :from tags]))
acc)
(dolist (row rows)
(dolist (tag (car row))
(unless (member tag acc)
(push tag acc))))
acc))
(defun org-roam-db--connected-component (file)
"Return all files reachable from/connected to FILE, including the file itself.
If the file does not have any connections, nil is returned."