Skip to content

Commit 9c41ed9

Browse files
committed
Merged FileIndex
1 parent e1188dc commit 9c41ed9

20 files changed

Lines changed: 159 additions & 104 deletions

resources/META-INF/plugin.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,43 +55,43 @@
5555
<annotator language="Mathematica"
5656
implementationClass="de.halirutan.mathematica.codeinsight.highlighting.MathematicaHighlightingAnnotator"/>
5757
<lang.braceMatcher language="Mathematica"
58-
implementationClass="de.halirutan.mathematica.codeinsight.highlighting.MathematicaBraceMatcher"/>
58+
implementationClass="de.halirutan.mathematica.codeinsight.highlighting.MathematicaBraceMatcher"/>
5959

60+
<lang.refactoringSupport language="Mathematica"
61+
implementationClass="de.halirutan.mathematica.refactoring.MathematicaRefactoringSupport"/>
62+
<lang.namesValidator language="Mathematica" implementationClass="de.halirutan.mathematica.refactoring.MathematicaNamesValidator"/>
63+
<!--<lang.foldingBuilder language="Mathematica"-->
64+
<!--implementationClass="de.halirutan.mathematica.codeinsight.folding.MathematicaExpressionFoldingBuilder"/>-->
6065
<!-- Smart editing features -->
6166
<!--<quoteHandler fileType="Mathematica"-->
62-
<!--className="de.halirutan.mathematica.codeinsight.completion.MathematicaQuoteHandler"/>-->
67+
<!--className="de.halirutan.mathematica.codeinsight.completion.MathematicaQuoteHandler"/>-->
6368
<!--<completion.contributor language="Mathematica"-->
64-
<!--implementationClass="de.halirutan.mathematica.codeinsight.completion.MathematicaCompletionContributor"/>-->
69+
<!--implementationClass="de.halirutan.mathematica.codeinsight.completion.MathematicaCompletionContributor"/>-->
6570

6671
<!--<lang.smartEnterProcessor language="Mathematica"-->
67-
<!--implementationClass="de.halirutan.mathematica.codeinsight.editoractions.smartenter.MathematicaSmartEnter"/>-->
72+
<!--implementationClass="de.halirutan.mathematica.codeinsight.editoractions.smartenter.MathematicaSmartEnter"/>-->
6873
<!--<lookup.charFilter implementation="de.halirutan.mathematica.codeinsight.completion.MathematicaCharFilter"/>-->
6974

7075
<!--<lang.commenter language="Mathematica"-->
71-
<!--implementationClass="de.halirutan.mathematica.codeinsight.editoractions.MathematicaCommenter"/>-->
76+
<!--implementationClass="de.halirutan.mathematica.codeinsight.editoractions.MathematicaCommenter"/>-->
7277

7378
<!--<lang.surroundDescriptor language="Mathematica"-->
74-
<!--implementationClass="de.halirutan.mathematica.codeinsight.surround.MathematicaSurroundDescriptor"/>-->
79+
<!--implementationClass="de.halirutan.mathematica.codeinsight.surround.MathematicaSurroundDescriptor"/>-->
7580
<!--<codeInsight.surroundWithRangeAdjuster-->
76-
<!--implementation="de.halirutan.mathematica.codeinsight.surround.MathematicaSurroundWithRangeAdjuster"/>-->
81+
<!--implementation="de.halirutan.mathematica.codeinsight.surround.MathematicaSurroundWithRangeAdjuster"/>-->
7782
<!--<liveTemplateContext-->
78-
<!--implementation="de.halirutan.mathematica.codeinsight.livetemplates.MathematicaTemplateContextType"/>-->
83+
<!--implementation="de.halirutan.mathematica.codeinsight.livetemplates.MathematicaTemplateContextType"/>-->
7984
<!--<defaultLiveTemplatesProvider-->
80-
<!--implementation="de.halirutan.mathematica.codeinsight.livetemplates.MathematicaDefaultLiveTemplateProvider"/>-->
85+
<!--implementation="de.halirutan.mathematica.codeinsight.livetemplates.MathematicaDefaultLiveTemplateProvider"/>-->
8186

8287
<!--<extendWordSelectionHandler-->
83-
<!--implementation="de.halirutan.mathematica.codeinsight.editoractions.wordselection.MathematicaFunctionSelectioner"/>-->
88+
<!--implementation="de.halirutan.mathematica.codeinsight.editoractions.wordselection.MathematicaFunctionSelectioner"/>-->
8489
<!--<extendWordSelectionHandler-->
85-
<!--implementation="de.halirutan.mathematica.codeinsight.editoractions.wordselection.MathematicaListSelectioner"/>-->
90+
<!--implementation="de.halirutan.mathematica.codeinsight.editoractions.wordselection.MathematicaListSelectioner"/>-->
8691

8792
<!--&lt;!&ndash;<basicWordSelectionFilter&ndash;&gt;-->
8893
<!--&lt;!&ndash;implementation="de.halirutan.mathematica.codeinsight.editoractions.wordselection.BasicExpressionSelectionFilter"/>&ndash;&gt;-->
8994

90-
<!--<lang.refactoringSupport language="Mathematica"-->
91-
<!--implementationClass="de.halirutan.mathematica.refactoring.MathematicaRefactoringSupport"/>-->
92-
<!--<lang.namesValidator language="Mathematica" implementationClass="de.halirutan.mathematica.refactoring.MathematicaNamesValidator"/>-->
93-
<!--<lang.foldingBuilder language="Mathematica"-->
94-
<!--implementationClass="de.halirutan.mathematica.codeinsight.folding.MathematicaExpressionFoldingBuilder"/>-->
9595

9696
<!--<applicationService-->
9797
<!--serviceInterface="de.halirutan.mathematica.codeinsight.folding.MathematicaCodeFoldingSettingsImpl"-->

src/de/halirutan/mathematica/codeinsight/completion/ImportedContextVisitor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
import com.intellij.psi.PsiElement;
2525
import com.intellij.psi.PsiFile;
26-
import de.halirutan.mathematica.parsing.psi.MathematicaVisitor;
27-
import de.halirutan.mathematica.parsing.psi.api.CompoundExpression;
28-
import de.halirutan.mathematica.parsing.psi.api.FunctionCall;
29-
import de.halirutan.mathematica.parsing.psi.api.string.MString;
26+
import de.halirutan.mathematica.lang.psi.MathematicaVisitor;
27+
import de.halirutan.mathematica.lang.psi.api.CompoundExpression;
28+
import de.halirutan.mathematica.lang.psi.api.FunctionCall;
29+
import de.halirutan.mathematica.lang.psi.api.string.MString;
3030

3131
import java.util.HashSet;
3232

src/de/halirutan/mathematica/codeinsight/completion/LocalDefinitionCompletionProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import de.halirutan.mathematica.lang.psi.api.assignment.TagSetDelayed;
3434
import de.halirutan.mathematica.lang.psi.api.rules.RuleDelayed;
3535
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct;
36-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
3736
import de.halirutan.mathematica.lang.psi.util.MathematicaPatternVisitor;
3837
import de.halirutan.mathematica.lang.psi.util.MathematicaPsiUtilities;
3938
import org.jetbrains.annotations.NotNull;
@@ -69,7 +68,7 @@ public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state)
6968
final FunctionCall functionCall = (FunctionCall) element;
7069
if (functionCall.isScopingConstruct()) {
7170
List<Symbol> vars = Lists.newArrayList();
72-
final ConstructType scopingConstruct = functionCall.getScopingConstruct();
71+
final LocalizationConstruct.MScope scopingConstruct = functionCall.getScopingConstruct();
7372

7473
if (LocalizationConstruct.isFunctionLike(scopingConstruct)) {
7574
vars = MathematicaPsiUtilities.getLocalFunctionVariables(functionCall);

src/de/halirutan/mathematica/codeinsight/folding/MathematicaExpressionFoldingBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import de.halirutan.mathematica.lang.psi.api.FunctionCall;
3939
import de.halirutan.mathematica.lang.psi.util.Comments;
4040
import de.halirutan.mathematica.lang.psi.util.Comments.CommentStyle;
41-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
41+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.MScope;
4242
import org.jetbrains.annotations.NotNull;
4343
import org.jetbrains.annotations.Nullable;
4444

@@ -120,7 +120,7 @@ private void collectRegionsRecursively(@NotNull final ASTNode node,
120120
final PsiElement psi = node.getPsi();
121121
if (psi instanceof FunctionCall) {
122122
final FunctionCall functionCall = (FunctionCall) psi;
123-
if (functionCall.getScopingConstruct() != ConstructType.NULL) {
123+
if (functionCall.getScopingConstruct() != MScope.NULL) {
124124
descriptors.add(new NamedFoldingDescriptor(
125125
node,
126126
node.getTextRange(),

src/de/halirutan/mathematica/codeinsight/highlighting/MathematicaHighlightingAnnotator.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
package de.halirutan.mathematica.codeinsight.highlighting;
2323

24+
import com.intellij.codeInspection.ProblemHighlightType;
2425
import com.intellij.lang.ASTNode;
2526
import com.intellij.lang.annotation.Annotation;
2627
import com.intellij.lang.annotation.AnnotationHolder;
@@ -40,7 +41,8 @@
4041
import de.halirutan.mathematica.lang.psi.api.function.Function;
4142
import de.halirutan.mathematica.lang.psi.api.slots.Slot;
4243
import de.halirutan.mathematica.lang.psi.api.slots.SlotExpression;
43-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
44+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct;
45+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.MScope;
4446
import de.halirutan.mathematica.lang.resolve.SymbolResolveResult;
4547
import org.jetbrains.annotations.NotNull;
4648

@@ -61,6 +63,7 @@ public class MathematicaHighlightingAnnotator extends MathematicaVisitor impleme
6163
private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
6264
final Annotation annotation = holder.createInfoAnnotation(element, null);
6365
annotation.setTextAttributes(key);
66+
annotation.setHighlightType(ProblemHighlightType.ERROR);
6467
annotation.setNeedsUpdateOnTyping(false);
6568
}
6669

@@ -86,9 +89,13 @@ public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolde
8689
public void visitSymbol(final Symbol symbol) {
8790
final SymbolResolveResult symbolResolveResult = symbol.advancedResolve();
8891
if (symbolResolveResult != null) {
89-
final ConstructType scope = symbolResolveResult.getLocalization();
92+
final MScope scope = symbolResolveResult.getLocalization();
9093
switch (scope) {
94+
case FILE:
95+
setHighlighting(symbol, myHolder, MathematicaSyntaxHighlighterColors.IDENTIFIER);
96+
break;
9197
case NULL:
98+
setHighlighting(symbol, myHolder, MathematicaSyntaxHighlighterColors.BAD_CHARACTER);
9299
break;
93100
case BUILT_IN:
94101
setHighlighting(symbol, myHolder, MathematicaSyntaxHighlighterColors.BUILTIN_FUNCTION);

src/de/halirutan/mathematica/codeinsight/highlighting/MathematicaReferenceAnnotator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
import de.halirutan.mathematica.lang.psi.api.MessageName;
3939
import de.halirutan.mathematica.lang.psi.api.Symbol;
4040
import de.halirutan.mathematica.lang.psi.api.function.Function;
41+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct;
4142
import de.halirutan.mathematica.lang.resolve.LocalDefinitionResolveProcessor;
42-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
4343
import org.jetbrains.annotations.NotNull;
4444

4545
import java.util.Set;
@@ -88,7 +88,7 @@ public void visitSymbol(final Symbol symbol) {
8888
LocalDefinitionResolveProcessor processor = new LocalDefinitionResolveProcessor(symbol);
8989
PsiTreeUtil.treeWalkUp(processor, symbol, symbol.getContainingFile(), ResolveState.initial());
9090

91-
final ConstructType scope = processor.getMyLocalization();
91+
final LocalizationConstruct.MScope scope = processor.getMyLocalization();
9292
switch (scope) {
9393
case NULL:
9494
break;

src/de/halirutan/mathematica/index/packageexport/PackageClassifier.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
import com.intellij.psi.PsiElement;
2525
import com.intellij.psi.PsiFile;
2626
import de.halirutan.mathematica.index.PackageUtil;
27-
import de.halirutan.mathematica.parsing.psi.MathematicaVisitor;
28-
import de.halirutan.mathematica.parsing.psi.api.CompoundExpression;
29-
import de.halirutan.mathematica.parsing.psi.api.FunctionCall;
30-
import de.halirutan.mathematica.parsing.psi.api.Symbol;
31-
import de.halirutan.mathematica.parsing.psi.api.assignment.Set;
32-
import de.halirutan.mathematica.parsing.psi.api.assignment.SetDelayed;
33-
import de.halirutan.mathematica.parsing.psi.impl.assignment.SetDefinitionSymbolVisitor;
34-
import de.halirutan.mathematica.parsing.psi.util.MathematicaPsiUtilities;
27+
import de.halirutan.mathematica.lang.psi.MathematicaVisitor;
28+
import de.halirutan.mathematica.lang.psi.api.CompoundExpression;
29+
import de.halirutan.mathematica.lang.psi.api.FunctionCall;
30+
import de.halirutan.mathematica.lang.psi.api.Symbol;
31+
import de.halirutan.mathematica.lang.psi.api.assignment.Set;
32+
import de.halirutan.mathematica.lang.psi.api.assignment.SetDelayed;
33+
import de.halirutan.mathematica.lang.psi.impl.assignment.SetDefinitionSymbolVisitor;
34+
import de.halirutan.mathematica.lang.psi.util.MathematicaPsiUtilities;
3535

3636
import java.util.Collection;
3737
import java.util.HashMap;

src/de/halirutan/mathematica/intentions/localization/FindLocalisationProcessor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import com.intellij.psi.ResolveState;
2727
import com.intellij.psi.scope.PsiScopeProcessor;
2828
import de.halirutan.mathematica.lang.psi.api.FunctionCall;
29-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
29+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct;
3030
import org.jetbrains.annotations.NotNull;
3131
import org.jetbrains.annotations.Nullable;
3232

@@ -41,10 +41,10 @@ class FindLocalisationProcessor implements PsiScopeProcessor {
4141
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
4242
if (element instanceof FunctionCall) {
4343
if (((FunctionCall) element).isScopingConstruct()) {
44-
ConstructType scopingConstruct = ((FunctionCall) element).getScopingConstruct();
45-
if (scopingConstruct.equals(ConstructType.BLOCK) ||
46-
scopingConstruct.equals(ConstructType.MODULE) ||
47-
scopingConstruct.equals(ConstructType.WITH)) {
44+
LocalizationConstruct.MScope scopingConstruct = ((FunctionCall) element).getScopingConstruct();
45+
if (scopingConstruct.equals(LocalizationConstruct.MScope.BLOCK) ||
46+
scopingConstruct.equals(LocalizationConstruct.MScope.MODULE) ||
47+
scopingConstruct.equals(LocalizationConstruct.MScope.WITH)) {
4848
myLocalisationElement = (FunctionCall) element;
4949
return false;
5050
}

src/de/halirutan/mathematica/intentions/localization/MoveVariableToLocalisation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import de.halirutan.mathematica.lang.psi.api.FunctionCall;
3434
import de.halirutan.mathematica.lang.psi.api.Symbol;
3535
import de.halirutan.mathematica.lang.psi.api.lists.List;
36-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
36+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct;
3737
import de.halirutan.mathematica.lang.psi.util.MathematicaPsiElementFactory;
3838
import org.jetbrains.annotations.Nls;
3939
import org.jetbrains.annotations.NotNull;
@@ -80,8 +80,8 @@ public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file
8080
if (reference != null) {
8181
PsiElement resolve = reference.resolve();
8282
if (resolve instanceof Symbol) {
83-
ConstructType elementConstruct = ((Symbol) resolve).getLocalizationConstruct();
84-
if (elementConstruct != ConstructType.NULL) {
83+
LocalizationConstruct.MScope elementConstruct = ((Symbol) resolve).getLocalizationConstruct();
84+
if (elementConstruct != LocalizationConstruct.MScope.NULL) {
8585
return false;
8686
}
8787
}

src/de/halirutan/mathematica/lang/psi/api/FunctionCall.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
package de.halirutan.mathematica.lang.psi.api;
2323

2424
import com.intellij.psi.PsiElement;
25-
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.ConstructType;
25+
import de.halirutan.mathematica.lang.psi.util.LocalizationConstruct.MScope;
2626
import org.jetbrains.annotations.NotNull;
2727
import org.jetbrains.annotations.Nullable;
2828

@@ -66,9 +66,9 @@ public interface FunctionCall extends PsiElement {
6666
/**
6767
* Returns the type of scoping construct, if the function call is e.g. <code >Module[..]</code>
6868
*
69-
* @return The scoping construct or ConstructType.NULL if it is no scoping construct.
69+
* @return The scoping construct or MScope.NULL if it is no scoping construct.
7070
*/
71-
public ConstructType getScopingConstruct();
71+
public MScope getScopingConstruct();
7272

7373

7474
/**

0 commit comments

Comments
 (0)