mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Allow exact match to be ranked higher than any other result
This commit is contained in:
parent
3deebc8642
commit
cbae1857e7
1 changed files with 6 additions and 7 deletions
|
@ -80,7 +80,6 @@ define [], () ->
|
||||||
doc = session.getValue()
|
doc = session.getValue()
|
||||||
parser = new Parser(doc)
|
parser = new Parser(doc)
|
||||||
commands = parser.parse()
|
commands = parser.parse()
|
||||||
|
|
||||||
completions = []
|
completions = []
|
||||||
for command in commands
|
for command in commands
|
||||||
caption = "\\#{command[0]}"
|
caption = "\\#{command[0]}"
|
||||||
|
@ -94,12 +93,12 @@ define [], () ->
|
||||||
snippet += "{${#{i}}}"
|
snippet += "{${#{i}}}"
|
||||||
caption += "{}"
|
caption += "{}"
|
||||||
i++
|
i++
|
||||||
unless caption == prefix
|
completions.push {
|
||||||
completions.push {
|
caption: caption
|
||||||
caption: caption
|
snippet: snippet
|
||||||
snippet: snippet
|
meta: "cmd"
|
||||||
meta: "cmd"
|
score: if prefix == caption then 99 else 50
|
||||||
}
|
}
|
||||||
|
|
||||||
callback null, completions
|
callback null, completions
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue