mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Allow exact match to be ranked higher than any other result
This commit is contained in:
+6
-7
@@ -80,7 +80,6 @@ define [], () ->
|
||||
doc = session.getValue()
|
||||
parser = new Parser(doc)
|
||||
commands = parser.parse()
|
||||
|
||||
completions = []
|
||||
for command in commands
|
||||
caption = "\\#{command[0]}"
|
||||
@@ -94,12 +93,12 @@ define [], () ->
|
||||
snippet += "{${#{i}}}"
|
||||
caption += "{}"
|
||||
i++
|
||||
unless caption == prefix
|
||||
completions.push {
|
||||
caption: caption
|
||||
snippet: snippet
|
||||
meta: "cmd"
|
||||
}
|
||||
completions.push {
|
||||
caption: caption
|
||||
snippet: snippet
|
||||
meta: "cmd"
|
||||
score: if prefix == caption then 99 else 50
|
||||
}
|
||||
|
||||
callback null, completions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user