Skip to content

Commit 4b0e29e

Browse files
committed
bug fix: update files when rename directory
1 parent 8f1ee44 commit 4b0e29e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

EmmyLua-LS/src/main/kotlin/com/tang/vscode/LuaWorkspaceService.kt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class LuaWorkspaceService : WorkspaceService, IWorkspace {
6767
when (change.type) {
6868
FileChangeType.Created -> addFile(change.uri)
6969
FileChangeType.Deleted -> removeFile(change.uri)
70-
FileChangeType.Changed -> {
70+
/*FileChangeType.Changed -> {
7171
removeFile(change.uri)
7272
addFile(change.uri)
73-
}
73+
}*/
7474
else -> { }
7575
}
7676
}
@@ -272,11 +272,19 @@ class LuaWorkspaceService : WorkspaceService, IWorkspace {
272272
return folder?.findFile(fileURI.name)
273273
}
274274

275+
private fun addDirectory(file: File) {
276+
if (file.isDirectory) {
277+
file.listFiles()?.forEach {
278+
addFile(it)
279+
}
280+
}
281+
}
282+
275283
override fun addFile(file: File, text: String?): ILuaFile? {
276-
if (file.isDirectory)
277-
return null
278-
if (!fileManager.isInclude(file))
284+
if (file.isDirectory) {
285+
addDirectory(file)
279286
return null
287+
}
280288
val fileURI = FileURI(file.toURI(), false)
281289
return addFile(fileURI, text)
282290
}

0 commit comments

Comments
 (0)