Skip to content

Commit 4fd2122

Browse files
committed
Move properties to the top of the class in SourcePath/KTDS
1 parent a6d9369 commit 4fd2122

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

server/src/main/kotlin/org/javacs/kt/KotlinTextDocumentService.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class KotlinTextDocumentService(
4747
val lintTodo = mutableSetOf<URI>()
4848
var lintCount = 0
4949

50-
fun connect(client: LanguageClient) {
51-
this.client = client
52-
}
50+
var lintRecompilationCallback: () -> Unit
51+
get() = sp.beforeCompileCallback
52+
set(callback) { sp.beforeCompileCallback = callback }
5353

5454
private val TextDocumentItem.filePath: Path?
5555
get() = parseURI(uri).filePath
@@ -63,6 +63,10 @@ class KotlinTextDocumentService(
6363
private val TextDocumentIdentifier.content: String
6464
get() = uriContentProvider.contentOf(parseURI(uri))
6565

66+
fun connect(client: LanguageClient) {
67+
this.client = client
68+
}
69+
6670
private enum class Recompile {
6771
ALWAYS, AFTER_DOT, NEVER
6872
}
@@ -302,9 +306,6 @@ class KotlinTextDocumentService(
302306
override fun close() {
303307
shutdownExecutors(awaitTermination = true)
304308
}
305-
306-
var lintRecompilationCallback: () -> Unit = {}
307-
set(callback) { sp.beforeCompileCallback = callback }
308309
}
309310

310311
private inline fun<T> reportTime(block: () -> T): T {

server/src/main/kotlin/org/javacs/kt/SourcePath.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class SourcePath(
1919
private val files = mutableMapOf<URI, SourceFile>()
2020
private val parseDataWriteLock = ReentrantLock()
2121

22+
var beforeCompileCallback: () -> Unit = {};
23+
2224
private inner class SourceFile(
2325
val uri: URI,
2426
var content: String,
@@ -141,8 +143,6 @@ class SourcePath(
141143
fun latestCompiledVersion(uri: URI): CompiledFile =
142144
sourceFile(uri).prepareCompiledFile()
143145

144-
var beforeCompileCallback: () -> Unit = { };
145-
146146
/**
147147
* Compile changed files
148148
*/

0 commit comments

Comments
 (0)