From 50c135cd65051163e64e7bd76ef23d3f2c5b8ba1 Mon Sep 17 00:00:00 2001 From: Patrick Scheibe Date: Wed, 2 May 2018 13:00:00 +0200 Subject: [PATCH] Fix subtreeChanged() to call super and minor refactorings --- build.gradle | 6 +++--- resources/META-INF/change-notes.html | 1 + .../editoractions/enter/CommentStarInsertEnterHandler.kt | 2 -- .../packageexport/MathematicaPackageExportIndex.java | 6 +----- .../mathematica/lang/psi/impl/ExpressionImpl.java | 8 +------- .../mathematica/lang/psi/impl/MathematicaPsiFileImpl.java | 1 + .../halirutan/mathematica/lang/psi/impl/SymbolImpl.java | 1 + 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 9fc13216..e7f61b9d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.2.40' + ext.kotlin_version = '1.2.41' repositories { mavenCentral() @@ -12,7 +12,7 @@ buildscript { plugins { - id "org.jetbrains.kotlin.jvm" version "1.2.40" + id "org.jetbrains.kotlin.jvm" version "1.2.41" id "org.jetbrains.intellij" version "0.3.1" } @@ -65,7 +65,7 @@ task wrapper(type: Wrapper) { // Information about the plugin // Plugin version number -version '3.0pre10' +version '3.0pre11' intellij { version = '2018.1.2' diff --git a/resources/META-INF/change-notes.html b/resources/META-INF/change-notes.html index 7a40154f..5d9717e8 100644 --- a/resources/META-INF/change-notes.html +++ b/resources/META-INF/change-notes.html @@ -2,6 +2,7 @@ New features and bug-fixes in version 3:
diff --git a/src/de/halirutan/mathematica/codeinsight/editoractions/enter/CommentStarInsertEnterHandler.kt b/src/de/halirutan/mathematica/codeinsight/editoractions/enter/CommentStarInsertEnterHandler.kt index ea18f6dd..ed0ad111 100644 --- a/src/de/halirutan/mathematica/codeinsight/editoractions/enter/CommentStarInsertEnterHandler.kt +++ b/src/de/halirutan/mathematica/codeinsight/editoractions/enter/CommentStarInsertEnterHandler.kt @@ -52,12 +52,10 @@ class CommentStarInsertEnterHandler : MathematicaEnterHandler() { if (comment is PsiComment && offset >= commentRange.startOffset + 2 && offset <= commentRange.endOffset - 2) { val document = editor.document - val textLength = document.textLength val lineNumber = document.getLineNumber(offset) val elementStartLine = document.getLineNumber(comment.textOffset) val elementEndLine = document.getLineNumber(comment.textOffset + comment.textLength) - val lineStartOffset = document.getLineStartOffset(lineNumber) val insertString: String val move: Int diff --git a/src/de/halirutan/mathematica/index/packageexport/MathematicaPackageExportIndex.java b/src/de/halirutan/mathematica/index/packageexport/MathematicaPackageExportIndex.java index 5332b06c..8d4ee9d7 100644 --- a/src/de/halirutan/mathematica/index/packageexport/MathematicaPackageExportIndex.java +++ b/src/de/halirutan/mathematica/index/packageexport/MathematicaPackageExportIndex.java @@ -25,8 +25,6 @@ import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.psi.PsiFile; -import com.intellij.util.containers.HashMap; -import com.intellij.util.containers.HashSet; import com.intellij.util.indexing.DataIndexer; import com.intellij.util.indexing.FileBasedIndex.InputFilter; import com.intellij.util.indexing.FileContent; @@ -36,9 +34,7 @@ import de.halirutan.mathematica.lang.MathematicaLanguage; import org.jetbrains.annotations.NotNull; -import java.util.Collection; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * Simple file index for functions that are exported from a package by giving them a usage message. diff --git a/src/de/halirutan/mathematica/lang/psi/impl/ExpressionImpl.java b/src/de/halirutan/mathematica/lang/psi/impl/ExpressionImpl.java index e0f28c95..9b4f635d 100644 --- a/src/de/halirutan/mathematica/lang/psi/impl/ExpressionImpl.java +++ b/src/de/halirutan/mathematica/lang/psi/impl/ExpressionImpl.java @@ -47,13 +47,7 @@ public String toString() { @Override public void subtreeChanged() { -// final PsiElement[] children = getChildren(); -// for (PsiElement child : children) { -// if (child instanceof ExpressionImpl) { -// ((ExpressionImpl) child).subtreeChanged(); -// } -// } - + super.subtreeChanged(); } @Override diff --git a/src/de/halirutan/mathematica/lang/psi/impl/MathematicaPsiFileImpl.java b/src/de/halirutan/mathematica/lang/psi/impl/MathematicaPsiFileImpl.java index 74c2c2ec..fed336f4 100644 --- a/src/de/halirutan/mathematica/lang/psi/impl/MathematicaPsiFileImpl.java +++ b/src/de/halirutan/mathematica/lang/psi/impl/MathematicaPsiFileImpl.java @@ -84,6 +84,7 @@ public HashSet getCachedDefinitions() { @Override public void subtreeChanged() { + super.subtreeChanged(); isCacheOutdated = true; } } diff --git a/src/de/halirutan/mathematica/lang/psi/impl/SymbolImpl.java b/src/de/halirutan/mathematica/lang/psi/impl/SymbolImpl.java index 84adb9a3..3e1b8ee2 100644 --- a/src/de/halirutan/mathematica/lang/psi/impl/SymbolImpl.java +++ b/src/de/halirutan/mathematica/lang/psi/impl/SymbolImpl.java @@ -194,6 +194,7 @@ public ResolveResult[] multiResolve(boolean incompleteCode) { @Override public void subtreeChanged() { + super.subtreeChanged(); myScope = null; }