Merge branch 'main' into feature-sorting

This commit is contained in:
DominikDoom
2023-09-13 21:56:29 +02:00
3 changed files with 10 additions and 4 deletions

View File

@@ -149,6 +149,7 @@ class UmiParser extends BaseTagParser {
finalResults.push(result);
});
finalResults = finalResults.sort((a, b) => b.count - a.count);
return finalResults;
} else if (showAll) {
let filteredWildcardsSorted = filteredWildcards("");
@@ -163,6 +164,8 @@ class UmiParser extends BaseTagParser {
originalTagword = tagword;
tagword = "";
finalResults = finalResults.sort((a, b) => b.count - a.count);
return finalResults;
}
} else {
@@ -178,6 +181,8 @@ class UmiParser extends BaseTagParser {
originalTagword = tagword;
tagword = "";
finalResults = finalResults.sort((a, b) => b.count - a.count);
return finalResults;
}
}

View File

@@ -1009,7 +1009,7 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
tagword = tagword.toLowerCase().replace(/[\n\r]/g, "");
// Process all parsers
let resultCandidates = await processParsers(textArea, prompt);
let resultCandidates = (await processParsers(textArea, prompt))?.filter(x => x.length > 0);
// If one ore more result candidates match, use their results
if (resultCandidates && resultCandidates.length > 0) {
// Flatten our candidate(s)

View File

@@ -89,7 +89,9 @@ def is_umi_format(data):
break
return not issue_found
def parse_umi_format(umi_tags, count, data):
count = 0
def parse_umi_format(umi_tags, data):
global count
for item in data:
umi_tags[count] = ','.join(data[item]['Tags'])
count += 1
@@ -119,7 +121,6 @@ def get_yaml_wildcards():
yaml_wildcards = {}
umi_tags = {} # { tag: count }
count = 0
for path in yaml_files:
try:
@@ -127,7 +128,7 @@ def get_yaml_wildcards():
data = yaml.safe_load(file)
if (data):
if (is_umi_format(data)):
parse_umi_format(umi_tags, count, data)
parse_umi_format(umi_tags, data)
else:
parse_dynamic_prompt_format(yaml_wildcards, data, path)
else: