fwcd / kotlin-language-server

Kotlin code completion, diagnostics and more for any editor/IDE using the Language Server Protocol
MIT License
1.66k stars 209 forks source link

Accessing text document content #281

Open pajatopmr opened 3 years ago

pajatopmr commented 3 years ago

What is the preferred way to access content inside tests after invoking open(file) in a test fixture?

pajatopmr commented 3 years ago

Best I could find is do something like this:

val file = "DocumentSymbols.kt" private val fileId = TextDocumentIdentifier(uri(file).toString()) private val params = DocumentSymbolParams(fileId) private val documentUri by lazy { parseURI(params.textDocument.uri) } private val content by lazy { languageServer.textDocumentService.sp.content(documentUri) }

Is there a simpler way?