Projects >> IDLua >>eee6630c96acf2a4376308cd5865155e508cdc28

Chunk
Conflicting content
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaIdentifier;
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaParameter;
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaReferenceExpression;
<<<<<<< HEAD
=======
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaDeclarationStatement;
>>>>>>> af762cc1f79aef9873c6e203f70fc7dee536c830
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaReturnStatement;
import com.sylvanaar.idea.Lua.lang.psi.visitor.LuaElementVisitor;
import org.jetbrains.annotations.NotNull;
Solution content
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaIdentifier;
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaParameter;
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaReferenceExpression;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaDeclaration;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaReturnStatement;
import com.sylvanaar.idea.Lua.lang.psi.visitor.LuaElementVisitor;

import org.jetbrains.annotations.NotNull;
File
LuaAnnotator.java
Developer's decision
Manual
Kind of conflict
Import
Chunk
Conflicting content
        if (e instanceof LuaParameter) {
            final Annotation a = myHolder.createInfoAnnotation(ref, null);
            a.setTextAttributes(LuaHighlightingData.PARAMETER);
<<<<<<< HEAD
        } else if (e instanceof LuaIdentifier) {
=======
        } else if (e instanceof LuaIdentifier || e instanceof LuaDeclarationStatement) {
>>>>>>> af762cc1f79aef9873c6e203f70fc7dee536c830
                LuaIdentifier id = (LuaIdentifier) e;
                TextAttributesKey attributesKey = null;
Solution content
        if (e instanceof LuaParameter) {
            final Annotation a = myHolder.createInfoAnnotation(ref, null);
            a.setTextAttributes(LuaHighlightingData.PARAMETER);
        } else if (e instanceof LuaIdentifier ||
                e instanceof LuaDeclarationStatement) {
            LuaIdentifier id = (LuaIdentifier) e;
            TextAttributesKey attributesKey = null;

            if (id.isGlobal()) {
                attributesKey = LuaHighlightingData.GLOBAL_VAR;
            } else if (id.isLocal() && !id.getText().equals("...")) {
                attributesKey = LuaHighlightingData.LOCAL_VAR;
            }

            if (attributesKey != null) {
                final Annotation annotation = myHolder.createInfoAnnotation(ref,
                        null);
                annotation.setTextAttributes(attributesKey);
            }
        }

        if (e == null) {
            LuaIdentifier id = (ref.getNameElement() != null)
                ? (LuaIdentifier) ref.getNameElement().getPsi() : null;
            TextAttributesKey attributesKey = null;

            if ((id != null) && id.isGlobal()) {
                attributesKey = LuaHighlightingData.GLOBAL_VAR;
            }

            if (attributesKey != null) {
                final Annotation annotation = myHolder.createInfoAnnotation(ref,
                        null);
                annotation.setTextAttributes(attributesKey);
            }
        }
    }

    public void visitDeclarationExpression(LuaDeclarationExpression dec) {
        if (!(dec.getContext() instanceof LuaParameter)) {
            final Annotation a = myHolder.createInfoAnnotation(dec, null);
            a.setTextAttributes(LuaHighlightingData.LOCAL_VAR);
        }
    }

    public void visitParameter(LuaParameter id) {
        final Annotation a = myHolder.createInfoAnnotation(id, null);
        a.setTextAttributes(LuaHighlightingData.PARAMETER);
    }

    public void visitIdentifier(LuaIdentifier id) {
        //        TextAttributesKey attributesKey = null;
        //
        //        if (id.isGlobal()) {
        //            attributesKey = LuaHighlightingData.GLOBAL_VAR;
        //        } else if (id.isLocal() && !id.getText().equals("...")) {
        //            attributesKey = LuaHighlightingData.LOCAL_VAR;
        //        }
        //
        //
        //        if (attributesKey != null) {
        //            final Annotation annotation = myHolder.createInfoAnnotation(id, null);
        //            annotation.setTextAttributes(attributesKey);
        //        }
    }
}
File
LuaAnnotator.java
Developer's decision
Manual
Kind of conflict
If statement
Chunk
Conflicting content
import com.sylvanaar.idea.Lua.LuaFileType;
import com.sylvanaar.idea.Lua.lang.psi.LuaPsiElementFactory;
import com.sylvanaar.idea.Lua.lang.psi.LuaPsiFile;
<<<<<<< HEAD
import com.sylvanaar.idea.Lua.lang.psi.expressions.*;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaAssignmentStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaLocalDefinitionStatement;
=======
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaExpression;
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaExpressionList;
import com.sylvanaar.idea.Lua.lang.psi.impl.expressions.LuaReferenceExpressionImpl;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaDeclarationStatement;
>>>>>>> af762cc1f79aef9873c6e203f70fc7dee536c830
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaReturnStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaStatementElement;
Solution content
import com.sylvanaar.idea.Lua.LuaFileType;
import com.sylvanaar.idea.Lua.lang.psi.LuaPsiElementFactory;
import com.sylvanaar.idea.Lua.lang.psi.LuaPsiFile;
import com.sylvanaar.idea.Lua.lang.psi.expressions.*;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaAssignmentStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaLocalDefinitionStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaReturnStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaStatementElement;
File
LuaPsiElementFactoryImpl.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
    public LuaDeclarationExpression createLocalNameIdentifierDecl(String name) {
        LuaPsiFile file = createDummyFile("local " + name);

<<<<<<< HEAD
        final LuaLocalDefinitionStatement expressionStatement = (LuaLocalDefinitionStatement)file.getFirstChild();
        final LuaDeclarationExpression declaration= expressionStatement.getDeclarations()[0];
=======
   final LuaDeclarationStatement expressionStatement = (LuaDeclarationStatement)file.getFirstChild();
   final LuaReferenceExpressionImpl refExpression = (LuaReferenceExpressionImpl)expressionStatement.getFirstChild();
>>>>>>> af762cc1f79aef9873c6e203f70fc7dee536c830

        return declaration;
    }
Solution content
    public LuaDeclarationExpression createLocalNameIdentifierDecl(String name) {
        LuaPsiFile file = createDummyFile("local " + name);

        final LuaLocalDefinitionStatement expressionStatement = (LuaLocalDefinitionStatement) file.getFirstChild();
        final LuaDeclarationExpression declaration = expressionStatement.getDeclarations()[0];

        return declaration;
    }
File
LuaPsiElementFactoryImpl.java
Developer's decision
Version 1
Kind of conflict
Array access
Cast expression
Variable