diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransApiAction.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransApiAction.java index 8d632e3a688f2c4b84a2133f96539ed6fec8e056..c7f7dde94a3cac08d85e0e8c19dca75556329e06 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransApiAction.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransApiAction.java @@ -74,6 +74,11 @@ public class TransApiAction extends AnAction { @Override public void actionPerformed(@NotNull AnActionEvent e) { + if (!OperatorSearchService.INSTANCE.isInit()) { + NotificationUtils.notify(NotificationUtils.NotifyGroup.SEARCH, NotificationType.WARNING, + "Api Mapping resource is still loading, please try later!"); + return; + } DataContext dataContext = e.getDataContext(); PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(dataContext); importMap = new HashMap<>(); @@ -116,7 +121,7 @@ public class TransApiAction extends AnAction { toolWindow.show(); } else { NotificationUtils.notify( - NotificationUtils.NotifyGroup.API_SCANNING, NotificationType.INFORMATION, "无相关API"); + NotificationUtils.NotifyGroup.SEARCH, NotificationType.INFORMATION, "没有相关的API"); } EventCenter.INSTANCE.publish(new CommonEvent()); } @@ -416,16 +421,16 @@ public class TransApiAction extends AnAction { public static void translateImport(PsiElement psiElement, Map importMap, Map fromMap, Map fromAsMap) { PyImportElement importElement; for (PsiElement element : psiElement.getChildren()) { - try { - if (element instanceof PyImportStatementBase) { - PyImportStatementBase importStatementBase = (PyImportStatementBase) element; - if (element instanceof PyImportStatement) { - // import mindspore.numpy as mnp; key是mindspore, value是mnp - // import mindspore; key是mindspore, value是null - importElement = importStatementBase.getImportElements()[0]; - importMap.put(importElement.getImportedQName().toString(), importElement.getAsName()); - } else if (element instanceof PyFromImportStatement) { - PyFromImportStatement pyFromImportStatement = (PyFromImportStatement) element; + if (element instanceof PyImportStatementBase) { + PyImportStatementBase importStatementBase = (PyImportStatementBase) element; + if (element instanceof PyImportStatement) { + // import mindspore.numpy as mnp; key是mindspore, value是mnp + // import mindspore; key是mindspore, value是null + importElement = importStatementBase.getImportElements()[0]; + importMap.put(importElement.getImportedQName().toString(), importElement.getAsName()); + } else if (element instanceof PyFromImportStatement) { + PyFromImportStatement pyFromImportStatement = (PyFromImportStatement) element; + if (pyFromImportStatement.getImportSourceQName() != null) { if (pyFromImportStatement.getImportElements().length >= 1) { if (pyFromImportStatement.getImportElements()[0].getAsName() == null) { // from mindspore.numpy import nn; key是mindspore.numpy.nn, value是nn @@ -438,16 +443,14 @@ public class TransApiAction extends AnAction { } } else { // from mindspore import *; key是mindspore, value是null - //fromMap.put(pyFromImportStatement.getImportSourceQName().toString(), null); + fromMap.put(pyFromImportStatement.getImportSourceQName().toString(), null); } - } else { - log.info("psiFile exceptions"); } } else { - translateImport(element, importMap, fromMap, fromAsMap); + log.info("psiFile exceptions"); } - } catch (Throwable ex) { - log.debug("import analyse error", ex); + } else { + translateImport(element, importMap, fromMap, fromAsMap); } } } diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransProjectApiAction.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransProjectApiAction.java index db164db67e50121f5966fd0ce8e346e8049e2ba4..93bb74cf99443ed8d6f63e1c3b65f1e235971c9d 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransProjectApiAction.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/TransProjectApiAction.java @@ -1,10 +1,8 @@ package com.mindspore.ide.toolkit.apiscanning; import com.intellij.ide.projectView.actions.MarkRootActionBase; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; +import com.intellij.notification.NotificationType; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; @@ -26,6 +24,10 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.psi.util.PsiUtilCore; import com.mindspore.ide.toolkit.apiscanning.handler.ApiMappingHandler; +import com.mindspore.ide.toolkit.common.events.CommonEvent; +import com.mindspore.ide.toolkit.common.events.EventCenter; +import com.mindspore.ide.toolkit.common.utils.NotificationUtils; +import com.mindspore.ide.toolkit.search.OperatorSearchService; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -36,58 +38,43 @@ public class TransProjectApiAction extends AnAction { @Override public void actionPerformed(@NotNull AnActionEvent e) { + if (!OperatorSearchService.INSTANCE.isInit()) { + NotificationUtils.notify(NotificationUtils.NotifyGroup.SEARCH, NotificationType.WARNING, + "Api Mapping resource is still loading, please try later!"); + return; + } long startTime = System.currentTimeMillis(); - - - Optional projectOp = Optional.ofNullable(e.getData(PlatformDataKeys.PROJECT)); - if (projectOp.isPresent()) { - ProgressManager.getInstance().run(new Task.Backgroundable(projectOp.get(), "API Scan " + - "project-level") { - @Override - public void run(@NotNull ProgressIndicator indicator) { - Optional projectUrlOp = Optional.ofNullable(projectOp.get().getPresentableUrl()); - ApiMappingHandler apiMappingHandler = new ApiMappingHandler(projectOp.get()); - Optional virtualFileOP = - Optional.ofNullable(StandardFileSystems.local().findFileByPath(projectUrlOp.get())); - - - List psiFiles = ApplicationManager.getApplication() - .runReadAction((Computable>) () -> { - virtualFileOP.ifPresent( - virtualFileRoot -> { - Editor editor = e.getData(CommonDataKeys.EDITOR); - if (editor != null) { - Module moduleForFile = ProjectRootManager - .getInstance(projectOp.get()).getFileIndex() - .getModuleForFile(PsiDocumentManager - .getInstance(projectOp.get()) - .getPsiFile(editor - .getDocument()).getVirtualFile()); - if (moduleForFile != null) { - ModifiableRootModel modifiableModel = ModuleRootManager - .getInstance(moduleForFile) - .getModifiableModel(); - ContentEntry contentEntry = MarkRootActionBase - .findContentEntry(modifiableModel, virtualFileRoot); - if (contentEntry != null) { - ApiMappingHandler.excludedFilesMap.put(projectOp.get(), - contentEntry.getExcludeFolderFiles()); - } - } - } - } - ); - virtualFileOP.ifPresent(apiMappingHandler::iterateVfsTreeNode); - return PsiUtilCore.toPsiFiles(PsiManager.getInstance(projectOp.get()), - apiMappingHandler.getVirtualFileSet()); - }); - ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication() - .runReadAction(() -> apiMappingHandler.handleProjectApiMapping(psiFiles))); + Module module = e.getData(LangDataKeys.MODULE); + Optional virturalFileOp; + if (module != null) { + ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel(); + Optional projectOp = Optional.ofNullable(e.getData(PlatformDataKeys.PROJECT)); + if (projectOp.isPresent()) { + Optional projectUrlOp = Optional.ofNullable(projectOp.get().getPresentableUrl()); + ApiMappingHandler apiMappingHandler = new ApiMappingHandler(projectOp.get()); + if (projectUrlOp.isPresent()) { + virturalFileOp = Optional.ofNullable(StandardFileSystems.local().findFileByPath(projectUrlOp.get())); + virturalFileOp.ifPresent( + virtualFileRoot -> { + ContentEntry contentEntry = MarkRootActionBase.findContentEntry(model, virtualFileRoot); + if (contentEntry != null) { + ApiMappingHandler.excludedFilesMap.put(projectOp.get(), + contentEntry.getExcludeFolderFiles()); + } + } + ); + virturalFileOp.ifPresent(apiMappingHandler::iterateVfsTreeNode); } - }); + List psiFiles = PsiUtilCore.toPsiFiles(PsiManager.getInstance(projectOp.get()), + apiMappingHandler.getVirtualFileSet()); + apiMappingHandler.handleProjectApiMapping(psiFiles); + } else { + log.warn("get project failed, can't execute api mapping"); + } } else { - log.warn("get project failed, can't execute api mapping"); + log.warn("current module is null, can't execute api mapping"); } - log.info("api mapping for project cost " + (System.currentTimeMillis() - startTime) + " ms"); + log.info("api mapping for project cost" + (System.currentTimeMillis() - startTime) + "ms"); + EventCenter.INSTANCE.publish(new CommonEvent()); } } diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileNode.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileNode.java index e6c5c4230587de281381a058e88402769d732625..19744a242d1609fdeff9ff0f68ab76135044ddd9 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileNode.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileNode.java @@ -4,6 +4,11 @@ import com.intellij.openapi.vfs.VirtualFile; import java.util.Vector; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class VirtualFileNode { public VirtualFile virtualFile; @@ -12,7 +17,7 @@ public class VirtualFileNode { public Vector children; - public boolean markedPy; + public Boolean markedPy; public VirtualFileNode(VirtualFile virtualFile) { parent= null; @@ -25,7 +30,7 @@ public class VirtualFileNode { if (newChild == null) { throw new IllegalArgumentException("new child is null"); } - VirtualFileNode oldParent = newChild.getParent(); + VirtualFileNode oldParent = (VirtualFileNode) newChild.getParent(); if (oldParent != null) { oldParent.remove(newChild); @@ -80,35 +85,4 @@ public class VirtualFileNode { public String toString() { return virtualFile.getName(); } - public VirtualFile getVirtualFile() { - return virtualFile; - } - - public void setVirtualFile(VirtualFile virtualFile) { - this.virtualFile = virtualFile; - } - - public VirtualFileNode getParent() { - return parent; - } - - public void setParent(VirtualFileNode parent) { - this.parent = parent; - } - - public Vector getChildren() { - return children; - } - - public void setChildren(Vector children) { - this.children = children; - } - - public boolean isMarkedPy() { - return markedPy; - } - - public void setMarkedPy(boolean markedPy) { - this.markedPy = markedPy; - } } diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileTreeSelectionListener.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileTreeSelectionListener.java index 18bf3f25fa2b372f3604bfc425e7076d2fb2bb16..47ab65df69bef34a7f60fc550930a52cc4f73190 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileTreeSelectionListener.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/VirtualFileTreeSelectionListener.java @@ -21,10 +21,5 @@ public class VirtualFileTreeSelectionListener implements TreeSelectionListener { log.info("tree node selected"); TreePath virtualFileNodePath = e.getNewLeadSelectionPath(); VirtualFileNode virtualFileNode = (VirtualFileNode) virtualFileNodePath.getLastPathComponent(); - try { - new ApiMappingHandler(project).handleTreeNodeSelection(virtualFileNode); - } catch (Exception ex) { - log.info(ex); - } } } diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/handler/ApiMappingHandler.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/handler/ApiMappingHandler.java index fe00020353d85b73cca9038ff92f4f63a2fb3fb4..1cd4e19dd712f6f4b7c73f9aeb1c1ef1a5b0c0e9 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/handler/ApiMappingHandler.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/handler/ApiMappingHandler.java @@ -1,10 +1,6 @@ package com.mindspore.ide.toolkit.apiscanning.handler; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ContentIterator; import com.intellij.openapi.vfs.VfsUtilCore; @@ -41,6 +37,13 @@ import java.util.List; import java.util.Map; import java.util.Set; +import lombok.Getter; +import lombok.Setter; + +import static com.mindspore.ide.toolkit.apiscanning.TransApiAction.filteringDataReverse; + +@Getter +@Setter public class ApiMappingHandler { private static final Logger log = Logger.getInstance(ApiMappingHandler.class); private static final String NO_PACKAGE_PLACEHOLDER = ""; @@ -100,95 +103,76 @@ public class ApiMappingHandler { } public void handleProjectApiMapping(List psiFiles) { - importMap = new HashMap<>(); - fromMap = new HashMap<>(); - fromAsMap = new HashMap<>(); - apiNameList = new LinkedHashSet<>(); + psiFiles.stream() + .filter(psiFile -> psiFile.getName().contains(".py")) + .forEach(this::getProjectApiMappingInfoByPsi); List apiNameNullList = new LinkedList<>(); List straightApiMappingList = sortList(apiNameFiltering, apiNameNullList); - List blurredApiMappingList = sortList(apiBlurredNameFiltering, null); - ApiMappingProjectUI projectMap = new ApiMappingProjectUI(trans(straightApiMappingList), - trans(blurredApiMappingList), - trans(apiNameNullList), myProject, root, root); - JBScrollPane jbScrollPane = new JBScrollPane(projectMap.splitPane); - Content content = ContentFactory.SERVICE.getInstance() - .createContent(jbScrollPane, myProject.getName(), true); - contentManager.addContent(content); - projectContentMap.put(content, projectMap); - contentManager.setSelectedContent(content, false, false); + List blurredApiMappingList = sortListAnti(apiBlurredNameFiltering, null); + if (straightApiMappingList.size() > 0 || blurredApiMappingList.size() > 0 || apiNameNullList.size() > 0) { + ApiMappingProjectUI projectMap = new ApiMappingProjectUI(trans(straightApiMappingList), + trans(blurredApiMappingList), + trans(apiNameNullList), myProject, root, root); + JBScrollPane jbScrollPane = new JBScrollPane(projectMap.splitPane); + Content content = ContentFactory.SERVICE.getInstance() + .createContent(jbScrollPane, myProject.getName(), true); + contentManager.addContent(content); + projectContentMap.put(content, projectMap); + contentManager.setSelectedContent(content, false, false); + } toolWindow.show(); } public void handleTreeNodeSelection(@NotNull VirtualFileNode virtualFileNode) throws Exception { - final ApiMappingHandler apiMappingHandler = this; VirtualFile chosenFile = virtualFileNode.getVirtualFile(); + VfsUtilCore.iterateChildrenRecursively(chosenFile, virtualFileFilter, contentIterator); long startTime = System.currentTimeMillis(); - Boolean isRun = ProgressManager.getInstance().run(new Task.WithResult(myProject, "Scanning", - false) { - @Override - public Boolean compute(@NotNull ProgressIndicator indicator) { - ApplicationManager.getApplication() - .runReadAction(() -> { - VfsUtilCore.iterateChildrenRecursively(chosenFile, virtualFileFilter, contentIterator); - List psiFiles = PsiUtilCore.toPsiFiles( - PsiManager.getInstance(myProject), virtualFileSet); - importMap = new HashMap<>(); - fromMap = new HashMap<>(); - fromAsMap = new HashMap<>(); - apiNameList = new LinkedHashSet<>(); - psiFiles.stream() - .filter(psiFile -> psiFile.getName().contains(".py")) - .forEach(apiMappingHandler::getProjectApiMappingInfoByPsi); - }); - return true; - } - }); - if (!isRun) { - return; - } ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); ToolWindow toolWindow = toolWindowManager.getToolWindow("MindSporeApiMapping"); + ContentManager contentManager = toolWindow.getContentManager(); + List psiFiles = PsiUtilCore.toPsiFiles(PsiManager.getInstance(myProject), virtualFileSet); + psiFiles.stream() + .filter(psiFile -> psiFile.getName().contains(".py")) + .forEach(this::getProjectApiMappingInfoByPsi); List apiNameNullList = new LinkedList<>(); List straightApiMappingList = sortList(apiNameFiltering, apiNameNullList); - List blurredApiMappingList = sortList(apiBlurredNameFiltering, null); + List blurredApiMappingList = sortListAnti(apiBlurredNameFiltering, null); ApiMappingProjectUI projectMap = projectContentMap.get(contentManager.getSelectedContent()); String name = chosenFile.getName(); projectMap.reload(trans(straightApiMappingList), trans(blurredApiMappingList), trans(apiNameNullList), name); - ContentManager contentManagerLocal = toolWindow.getContentManager(); - contentManagerLocal.removeContent(contentManagerLocal.getSelectedContent(), true); + contentManager.removeContent(contentManager.getSelectedContent(), true); Content content = ContentFactory.SERVICE.getInstance() .createContent(new JBScrollPane(projectMap.splitPane), name, true); - contentManagerLocal.addContent(content); + contentManager.addContent(content); projectContentMap.put(content, projectMap); - contentManagerLocal.setSelectedContent(content, true, true); + contentManager.setSelectedContent(content, true, true); toolWindow.show(); - log.info("api mapping for project const" + (System.currentTimeMillis() - startTime) + " ms"); + log.info("api mapping for project cost5" + (System.currentTimeMillis() - startTime) + " ms"); } public void getProjectApiMappingInfoByPsi(@NotNull PsiFile psiFile) { - apiBlurredNameList = new LinkedHashSet<>(); + importMap = new HashMap<>(); + fromMap = new HashMap<>(); + fromAsMap = new HashMap<>(); + apiNameList = new LinkedHashSet<>(); translateImport(psiFile, importMap, fromMap, fromAsMap); translateCallExpression(psiFile); Set apiNameFiltering1 = filteringApi(apiNameList); - Set apiBlurredNameFiltering1 = filteringApi(apiBlurredNameList); + Set apiBlurredNameFiltering1 = filteringApi(apiNameList); apiNameFiltering.addAll(apiNameFiltering1); apiBlurredNameFiltering.addAll(apiBlurredNameFiltering1); } - public Set getVirtualFileSet(){ - return virtualFileSet; - } - private Set filteringApi(Set apiNameList) { return TransApiAction.filteringApi(apiNameList); } private Object[][] trans(List data) { - return TransApiAction.trans((data)); + return TransApiAction.trans(data); } private List sortList(Set apiNameList, List apiNameNullList) { @@ -199,6 +183,22 @@ public class ApiMappingHandler { return searchData(filteringData(apiString), apiNameNullList); } + private List sortListAnti(Set apiNameList, List apiNameNullList) { + Set apiString = filteringDataReverse(apiNameList); + apiString = blurSort(apiString, apiNameList); + return searchData(filteringDataReverse(apiString), apiNameNullList); + } + + private Set blurSort(Set apiString, Set apiNameList) { + Set result = new LinkedHashSet<>(); + apiString.forEach((value) -> { + String[] split = value.split("\\."); + String last = split[split.length-1]; + result.add(last); + }); + return result; + } + private void importMapDataSort(Set apiString, Set apiNameList) { importMap.forEach((key, value) -> { if (value == null) { @@ -290,18 +290,10 @@ public class ApiMappingHandler { int last = formerFunction.size() - 1; String lastKey = formerFunction.get(last)[0]; formerFunction.forEach(record -> { - if (record[0].equals(lastKey)) { - if (NO_PACKAGE_PLACEHOLDER.equals(record[1])) { - apiNameList.add(lastKey); - } else { - apiNameList.add(lastKey + "." + record[1]); - } + if (NO_PACKAGE_PLACEHOLDER.equals(record[1])) { + apiNameList.add(lastKey); } else { - if (NO_PACKAGE_PLACEHOLDER.equals(record[1])) { - apiBlurredNameList.add(lastKey); - } else { - apiBlurredNameList.add(lastKey + "." + record[1]); - } + apiNameList.add(lastKey + "." + record[1]); } }); } diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/utils/VirtualFileTreeUtil.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/utils/VirtualFileTreeUtil.java index f1b0a0f24ad0940a044a8cee12adcfe8b8c6e0a4..c62631f3f31e12c4856803b45337c53680ab4b31 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/utils/VirtualFileTreeUtil.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/apiscanning/utils/VirtualFileTreeUtil.java @@ -1,6 +1,5 @@ package com.mindspore.ide.toolkit.apiscanning.utils; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.vfs.VirtualFile; @@ -13,8 +12,6 @@ import java.util.Arrays; import java.util.Iterator; public class VirtualFileTreeUtil { - private static final Logger log = Logger.getInstance(VirtualFileTreeUtil.class); - public static VirtualFileNode initVirtualFileNode(VirtualFileNode root, Project project) { VirtualFile[] excludedFiles = ApiMappingHandler.excludedFilesMap.get(project); for (VirtualFile child : root.getVirtualFile().getChildren()) { @@ -56,7 +53,7 @@ public class VirtualFileTreeUtil { } return o1.getVirtualFile().getName().compareToIgnoreCase(o2.getVirtualFile().getName()); } catch (Exception ex) { - log.debug("sort error"); + ex.printStackTrace(); } return 0; }); @@ -65,7 +62,7 @@ public class VirtualFileTreeUtil { public static void setNodeRootPy(VirtualFileNode leaf) { leaf.setMarkedPy(true); - while (leaf.getParent() != null && !leaf.getParent().isMarkedPy()) { + while (leaf.getParent() != null && !leaf.getParent().getMarkedPy()) { leaf = leaf.getParent(); leaf.setMarkedPy(true); } @@ -75,7 +72,7 @@ public class VirtualFileTreeUtil { Iterator iterator = root.getChildren().iterator(); while (iterator.hasNext()) { VirtualFileNode virtualFileNode = iterator.next(); - if (!virtualFileNode.isMarkedPy()) { + if (!virtualFileNode.getMarkedPy()) { iterator.remove(); } else { if (virtualFileNode.getChildren() != null) { diff --git a/pycharm/src/main/java/com/mindspore/ide/toolkit/search/OperatorSearchService.java b/pycharm/src/main/java/com/mindspore/ide/toolkit/search/OperatorSearchService.java index b95733bdf66a9bb74e406fcfd5378d83a67eef17..c303167faf999b6c7c350c3e7abf1f95e28da001 100644 --- a/pycharm/src/main/java/com/mindspore/ide/toolkit/search/OperatorSearchService.java +++ b/pycharm/src/main/java/com/mindspore/ide/toolkit/search/OperatorSearchService.java @@ -102,4 +102,11 @@ public enum OperatorSearchService { public List searchFullMatch(String inputString) { return recentHub.fetchAllMatch(inputString); } + + public boolean isInit() { + if (recentHub == null) { + return false; + } + return true; + } } \ No newline at end of file