anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: fwcd/kotlin-language-server
Issue: VSCode Format on Save deletes any file changes

Having fwcd-kotlin and editor.formatOnSave enabled in VSCode makes saving files impossible.
https://i.gyazo.com/9bdfba2d927450a0a8aac00c545f1384.mp4


Changed files:
server/src/main/kotlin/org/javacs/kt/SourceFiles.kt, server/src/main/kotlin/org/javacs/kt/KotlinTextDocumentService.kt

diff --git a/server/src/main/kotlin/org/javacs/kt/KotlinTextDocumentService.kt b/server/src/main/kotlin/org/javacs/kt/KotlinTextDocumentService.kt
index fd3e1f0..a7c89ce 100644
--- a/server/src/main/kotlin/org/javacs/kt/KotlinTextDocumentService.kt
+++ b/server/src/main/kotlin/org/javacs/kt/KotlinTextDocumentService.kt
@@ -61,7 +61,10 @@ class KotlinTextDocumentService(
         get() = uri.endsWith(".kts")
 
     private val TextDocumentIdentifier.content: String
-        get() = uriContentProvider.contentOf(parseURI(uri))
+        get() {
+            val uri = parseURI(uri)
+            return sf.contentOfTracked(uri) ?: uriContentProvider.contentOf(uri)
+        }
 
     fun connect(client: LanguageClient) {
         this.client = client
diff --git a/server/src/main/kotlin/org/javacs/kt/SourceFiles.kt b/server/src/main/kotlin/org/javacs/kt/SourceFiles.kt
index b1d67e9..9153d51 100644
--- a/server/src/main/kotlin/org/javacs/kt/SourceFiles.kt
+++ b/server/src/main/kotlin/org/javacs/kt/SourceFiles.kt
@@ -113,6 +113,10 @@ class SourceFiles(
         }
     }
 
+    fun contentOfTracked(uri: URI):String? {
+        return files[uri]?.content
+    }
+
     fun createdOnDisk(uri: URI) {
         changedOnDisk(uri)
     }
Repository: fwcd/kotlin-language-server
Issue: Resource hog and slow startup

The file-walk change made in this commit https://github.com/fwcd/kotlin-language-server/commit/adff2f93f43d6fd10635ad2a4d81226c4348c37b makes my fan go crazy and makes the server use several minues to start up. If I revert that commit it takes seconds, and no fan.

I'm testing on a small project on macOS with nvim-lsp. Have the same issue with coc.nvim on stable vim.

I might be able to look further on why, some other time.

Changed files:
shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt

diff --git a/shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt b/shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt
index 9f4f40a..a5bf531 100644
--- a/shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt
+++ b/shared/src/main/kotlin/org/javacs/kt/classpath/DefaultClassPathResolver.kt
@@ -19,21 +19,12 @@ private fun workspaceResolvers(workspaceRoot: Path): Sequence<ClassPathResolver>
 }
 
 /** Searches the folder for all build-files. */
-private fun folderResolvers(root: Path, ignored: List<PathMatcher>): Collection<ClassPathResolver> {
-    val resolvers = mutableListOf<ClassPathResolver>()
-
-    for (file in Files.walk(root)) {
-        // Only test whether non-ignored file is a build-file
-        if (ignored.none { it.matches(root.relativize(file)) }) {
-            val resolver = asClassPathProvider(file)
-            if (resolver != null) {
-                resolvers.add(resolver)
-            }
-        }
-    }
-
-    return resolvers
-}
+private fun folderResolvers(root: Path, ignored: List<PathMatcher>): Collection<ClassPathResolver> =
+    root.toFile()
+        .walk()
+        .onEnter { file -> ignored.none { it.matches(root.relativize(file.toPath())) } }
+        .mapNotNull { asClassPathProvider(it.toPath()) }
+        .toList()
 
 /** Tries to read glob patterns from a gitignore. */
 private fun ignoredPathPatterns(path: Path): List<PathMatcher> =