mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-12-23 09:19:21 +00:00
Test OrderByQualityProvider
This commit is contained in:
parent
5536efd756
commit
8fcfaae4ed
2 changed files with 19 additions and 1 deletions
|
|
@ -31,7 +31,7 @@ class OrderByQualityProvider(private val provider: CompletionProvider) : Complet
|
|||
when (node) {
|
||||
is LatexGroupSyntax -> ""
|
||||
is LatexCommandSyntax -> node.name.text.substring(1)
|
||||
is LatexTextSyntax -> node.words[0].text
|
||||
is LatexTextSyntax -> node.words.last().text
|
||||
is LatexDocumentSyntax -> null
|
||||
null -> null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package texlab.completion
|
||||
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
import texlab.WorkspaceBuilder
|
||||
import texlab.completion.latex.LatexKernelCommandProvider
|
||||
|
||||
class OrderByQualityProviderTests {
|
||||
@Test
|
||||
fun `it should prioritize items that begin with the query`() {
|
||||
val provider = OrderByQualityProvider(LatexKernelCommandProvider)
|
||||
val request = WorkspaceBuilder()
|
||||
.document("foo.tex", "\\usep")
|
||||
.completion("foo.tex", 0, 5)
|
||||
val items = provider.complete(request)
|
||||
assertEquals("usepackage", items[0].label)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue