Skip to content

Commit

Permalink
bug fix: update files when rename directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tangzx committed Oct 13, 2019
1 parent 8f1ee44 commit 4b0e29e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions EmmyLua-LS/src/main/kotlin/com/tang/vscode/LuaWorkspaceService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class LuaWorkspaceService : WorkspaceService, IWorkspace {
when (change.type) {
FileChangeType.Created -> addFile(change.uri)
FileChangeType.Deleted -> removeFile(change.uri)
FileChangeType.Changed -> {
/*FileChangeType.Changed -> {
removeFile(change.uri)
addFile(change.uri)
}
}*/
else -> { }
}
}
Expand Down Expand Up @@ -272,11 +272,19 @@ class LuaWorkspaceService : WorkspaceService, IWorkspace {
return folder?.findFile(fileURI.name)
}

private fun addDirectory(file: File) {
if (file.isDirectory) {
file.listFiles()?.forEach {
addFile(it)
}
}
}

override fun addFile(file: File, text: String?): ILuaFile? {
if (file.isDirectory)
return null
if (!fileManager.isInclude(file))
if (file.isDirectory) {
addDirectory(file)
return null
}
val fileURI = FileURI(file.toURI(), false)
return addFile(fileURI, text)
}
Expand Down

0 comments on commit 4b0e29e

Please sign in to comment.