change command palette prefix and suffix

This commit is contained in:
quenousimporte 2023-11-15 21:52:28 +01:00
parent 2d313db2d3
commit eab69a487f
1 changed files with 6 additions and 6 deletions

12
main.js
View File

@ -1768,7 +1768,7 @@ function commandpalette()
.concat(snippets.map(s => .concat(snippets.map(s =>
{ {
return { return {
prefix: "snippet: ", prefix: "snippet ",
text: s.hint, text: s.hint,
suffix: [s.command] suffix: [s.command]
}; };
@ -1776,7 +1776,7 @@ function commandpalette()
.concat(localdata.map(n => .concat(localdata.map(n =>
{ {
return { return {
prefix: "note: ", prefix: "note ",
text: n.title, text: n.title,
suffix: gettags(n).map(t => tagmark + t) suffix: gettags(n).map(t => tagmark + t)
}; };
@ -1784,24 +1784,24 @@ function commandpalette()
.concat(Object.keys(settings).map(s => .concat(Object.keys(settings).map(s =>
{ {
return { return {
prefix: "setting: ", prefix: "setting ",
text: s, text: s,
suffix: s == "password" ? null : [settings[s]] suffix: s == "password" ? null : [settings[s]]
}; };
}))) })))
.then(selected => .then(selected =>
{ {
if (selected.prefix == "snippet: ") if (selected.prefix == "snippet ")
{ {
var snippet = snippets.find(s => s.hint == selected.text); var snippet = snippets.find(s => s.hint == selected.text);
insert(snippet.insert, snippet.cursor); insert(snippet.insert, snippet.cursor);
md.focus(); md.focus();
} }
else if (selected.prefix == "note: ") else if (selected.prefix == "note ")
{ {
loadnote(selected.text); loadnote(selected.text);
} }
else if (selected.prefix == "setting: ") else if (selected.prefix == "setting ")
{ {
editsetting(selected.text); editsetting(selected.text);
} }