diff --git a/CHANGELOG.md b/CHANGELOG.md index f0c440c73136eb15e0cb584cb38663eba15096e1..d46764335c59d7359a20f9e3d282ab82686850f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Solon Changelog + +## [0.0.6-M4] +### Added +- Code prompt garbled +- Fix configuration issues under native project +- Fix the issue of occasionally not displaying configuration prompts + + +## [0.0.6-M3] +### Added +- Fix configuration issues under native project +- Fix the issue of occasionally not displaying configuration prompts + + +## [0.0.6-M2] +### Added +- Code prompt garbled + +## [0.0.6-M1] +### Added +- Code prompt garbled + ## [0.0.5] ### Added - Fix exceptions diff --git a/gradle.properties b/gradle.properties index c2240808dd2cac51a27a2038a7d05243487c496b..b0960d07460757b085b8e1708cda8b6dd9ec8855 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ pluginName = Solon pluginRepositoryUrl = https://gitee.com/noear/solon-idea-plugin # SemVer format -> https://semver.org -pluginVersion = 0.0.5 +pluginVersion = 0.0.6-M4 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 213 diff --git a/src/main/java/org/noear/solon/idea/plugin/suggestion/completion/YamlCompletionProvider.java b/src/main/java/org/noear/solon/idea/plugin/suggestion/completion/YamlCompletionProvider.java index a40a63db9b98dc48654b57eee4e768cb49f72bb0..fa190f500f6309a064a394da737e086334d3f054 100644 --- a/src/main/java/org/noear/solon/idea/plugin/suggestion/completion/YamlCompletionProvider.java +++ b/src/main/java/org/noear/solon/idea/plugin/suggestion/completion/YamlCompletionProvider.java @@ -22,6 +22,8 @@ import org.jetbrains.yaml.psi.YAMLKeyValue; import org.jetbrains.yaml.psi.impl.YAMLBlockMappingImpl; import org.jetbrains.yaml.psi.impl.YAMLPlainTextImpl; import org.noear.solon.idea.plugin.common.util.GenericUtil; +import org.noear.solon.idea.plugin.common.util.LoggerUtil; +import org.noear.solon.idea.plugin.initializr.util.SolonInitializrUtil; import org.noear.solon.idea.plugin.suggestion.filetype.SolonYamlFileType; import org.noear.solon.idea.plugin.suggestion.service.SuggestionService; import org.yaml.snakeyaml.Yaml; @@ -29,16 +31,16 @@ import org.yaml.snakeyaml.Yaml; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Optional; public class YamlCompletionProvider extends CompletionProvider implements FileEditorManagerListener { private final String SUB_OPTION = "."; - private SuggestionService suggestionService; private DocumentListener yamlDocumentListener; + @Override - public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { + public void fileOpenedSync(@NotNull FileEditorManager source, @NotNull VirtualFile file, + @NotNull Pair editors) { // 检查文件是否是 YAML 文件 if (file.getFileType().getName().equalsIgnoreCase(SolonYamlFileType.INSTANCE.getName())) { // 这里可以执行你的逻辑,当打开 YAML 文件时触发 @@ -47,23 +49,24 @@ public class YamlCompletionProvider extends CompletionProvider logger.debug("yaml get fail")); } - yamlDocumentListener=new DocumentListener() { + yamlDocumentListener = new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent event) { DocumentListener.super.documentChanged(event); String text = event.getDocument().getText(); - try{ + try { Yaml yaml = new Yaml(); Map yamlMap = yaml.load(text); - YamlCompletionContributor.yamlMapCache.put(file.getName(),yamlMap); - }catch (RuntimeException ignored){ + YamlCompletionContributor.yamlMapCache.put(file.getName(), yamlMap); + } catch (RuntimeException ignored) { } } @@ -72,21 +75,6 @@ public class YamlCompletionProvider extends CompletionProvider elementBuilders = new ArrayList<>(); String yamlKey = getYamlKey(yaml); @@ -115,21 +106,12 @@ public class YamlCompletionProvider extends CompletionProvider { - Project project = element.getProject(); - SuggestionService suggestionService = SuggestionService.getInstance(project); - return suggestionService; - }); - } - - private String getYamlKey(YAMLPlainTextImpl yamlPlainText) { if (yamlPlainText == null) { return ""; } List keys = new ArrayList<>(); - PsiElement parent = yamlPlainText.getParent(); + PsiElement parent = yamlPlainText.getFirstChild(); StringBuffer yamlKey = new StringBuffer(); while (parent != null) { if (parent instanceof YAMLKeyValue) { @@ -138,7 +120,7 @@ public class YamlCompletionProvider extends CompletionProvider