fix open other project clear ext doc cache | 修复打开其他项目时清空配置缓存
This commit is contained in:
@@ -59,6 +59,12 @@ public class ConfCache {
|
|||||||
return ConfCacheGetUtils.get(file, TREE_MID_EXT, TREE_CACHE);
|
return ConfCacheGetUtils.get(file, TREE_MID_EXT, TREE_CACHE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clearAll() {
|
||||||
|
KEY_CACHE.clear();
|
||||||
|
DOC_CACHE.clear();
|
||||||
|
TREE_CACHE.clear();
|
||||||
|
}
|
||||||
|
|
||||||
static void remove(@NotNull VirtualFile file, String name) {
|
static void remove(@NotNull VirtualFile file, String name) {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
int i = name.lastIndexOf('.');
|
int i = name.lastIndexOf('.');
|
||||||
@@ -102,9 +108,6 @@ public class ConfCache {
|
|||||||
DumbService.getInstance(project).runReadActionInSmartMode(() -> {
|
DumbService.getInstance(project).runReadActionInSmartMode(() -> {
|
||||||
Collection<VirtualFile> files = FilenameIndex.getAllFilesByExt(project, EXT);
|
Collection<VirtualFile> files = FilenameIndex.getAllFilesByExt(project, EXT);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
KEY_CACHE.clear();
|
|
||||||
DOC_CACHE.clear();
|
|
||||||
TREE_CACHE.clear();
|
|
||||||
for (VirtualFile file : files) {
|
for (VirtualFile file : files) {
|
||||||
load(project, file);
|
load(project, file);
|
||||||
sb.append(file.getPath()).append("\n");
|
sb.append(file.getPath()).append("\n");
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package io.github.linwancen.plugin.show.ext.conf;
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.AnAction;
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* call ConfCache.clearAll
|
||||||
|
* <br>Use Reset only for file sort
|
||||||
|
*/
|
||||||
|
public class ResetExtDocAction extends AnAction {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||||
|
ConfCache.clearAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,5 +92,11 @@
|
|||||||
text="🔄 // Reload External Comment">
|
text="🔄 // Reload External Comment">
|
||||||
<add-to-group group-id="ToolsMenu"/>
|
<add-to-group group-id="ToolsMenu"/>
|
||||||
</action>
|
</action>
|
||||||
|
<action
|
||||||
|
id="io.github.linwancen.plugin.show.ext.conf.ResetExtDocAction"
|
||||||
|
class="io.github.linwancen.plugin.show.ext.conf.ResetExtDocAction"
|
||||||
|
text="🆑 // Clear External Comment">
|
||||||
|
<add-to-group group-id="ToolsMenu"/>
|
||||||
|
</action>
|
||||||
</actions>
|
</actions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
Reference in New Issue
Block a user