Add support for indexing and auto-completing story notes

This commit is contained in:
Veronica Berglyd Olsen
2025-05-18 22:36:25 +02:00
parent f2f2e6cb46
commit f22f80dafd
3 changed files with 25 additions and 4 deletions
+11 -2
View File
@@ -2099,8 +2099,8 @@ class CommandCompleter(QMenu):
if pos <= len(kw):
offset = 0
length = len(kw.rstrip())
suffix = "" if sep else ": "
options = list(filter(
suffix = "" if sep else ":"
options = sorted(filter(
lambda x: x.startswith(kw.rstrip()), nwKeyWords.VALID_KEYS
))
else:
@@ -2143,6 +2143,15 @@ class CommandCompleter(QMenu):
lambda x: x.startswith(key.rstrip()),
SHARED.project.index.getStoryKeys(),
))
elif clean[:5] == "note.":
pre, _, key = cmd.partition(".")
offset = len(pre) + 1
length = len(key)
suffix = "" if sep else ": "
options = sorted(filter(
lambda x: x.startswith(key.rstrip()),
SHARED.project.index.getNoteKeys(),
))
elif pos < 12:
offset = 0
length = len(cmd.rstrip())