Skip to content

Commit

Permalink
refresh file system handler
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinVaadin committed Apr 24, 2024
1 parent 79d33af commit abf9329
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import com.intellij.openapi.vfs.VfsUtil
import com.intellij.psi.PsiDirectory
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.PsiManager
import com.vaadin.plugin.copilot.handler.RedoHandler
import com.vaadin.plugin.copilot.handler.ShowInIdeHandler
import com.vaadin.plugin.copilot.handler.UndoHandler
import com.vaadin.plugin.copilot.handler.WriteFileHandler
import com.vaadin.plugin.copilot.handler.*
import com.vaadin.plugin.copilot.service.CopilotServerService
import java.io.BufferedWriter
import java.io.File
Expand Down Expand Up @@ -54,6 +51,7 @@ class CopilotPluginUtil {
WRITE("write"),
UNDO("undo"),
REDO("redo"),
REFRESH("refresh"),
SHOW_IN_IDE("showInIde")
}

Expand Down Expand Up @@ -145,6 +143,7 @@ class CopilotPluginUtil {
HANDLERS.UNDO.command -> return UndoHandler(project, data)
HANDLERS.REDO.command -> return RedoHandler(project, data)
HANDLERS.SHOW_IN_IDE.command -> return ShowInIdeHandler(project, data)
HANDLERS.REFRESH.command -> return RefreshHandler(project)
else -> {
LOG.warn("Command $command not supported by plugin")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.vaadin.plugin.copilot.handler

import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFileManager

class RefreshHandler(project: Project) : AbstractHandler(project) {

override fun run() {
VirtualFileManager.getInstance().asyncRefresh { }
}

}

0 comments on commit abf9329

Please sign in to comment.