mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-12-23 09:19:21 +00:00
Fix deadlock in DocumentProvider
This commit is contained in:
parent
63907c5ec6
commit
0dc4b2b53c
1 changed files with 8 additions and 12 deletions
|
|
@ -1,7 +1,5 @@
|
|||
package texlab.completion.latex
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import org.eclipse.lsp4j.CompletionItem
|
||||
import texlab.Document
|
||||
import texlab.Workspace
|
||||
|
|
@ -13,18 +11,16 @@ import java.nio.file.Paths
|
|||
|
||||
abstract class DocumentProvider<T>(private val workspace: Workspace,
|
||||
private val documentClass: Class<T>,
|
||||
private val includeExtension: Boolean) : LatexArgumentProvider() where T : Document {
|
||||
private val includeExtension: Boolean)
|
||||
: LatexArgumentProvider() where T : Document {
|
||||
override val argumentIndex: Int = 0
|
||||
|
||||
override fun complete(request: CompletionRequest, command: LatexCommandSyntax)
|
||||
: List<CompletionItem> = runBlocking {
|
||||
workspace.withLock {
|
||||
workspace.documents
|
||||
.filterIsInstance(documentClass)
|
||||
.filter { !request.relatedDocuments.contains(it) }
|
||||
.map { relativize(request.uri, it.uri) }
|
||||
.map { CompletionItemFactory.createFile(it) }
|
||||
}
|
||||
override fun complete(request: CompletionRequest, command: LatexCommandSyntax): List<CompletionItem> {
|
||||
return workspace.documents
|
||||
.filterIsInstance(documentClass)
|
||||
.filter { !request.relatedDocuments.contains(it) }
|
||||
.map { relativize(request.uri, it.uri) }
|
||||
.map { CompletionItemFactory.createFile(it) }
|
||||
}
|
||||
|
||||
private fun relativize(base: URI, relative: URI): String {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue