-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add very basic support for flow attributes, closes #137
Took 1 hour 7 minutes
- Loading branch information
Jan Polák
committed
Apr 5, 2022
1 parent
9215f93
commit 5f39859
Showing
9 changed files
with
97 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/glslplugin/annotation/impl/FlowAttributeHighlightAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package glslplugin.annotation.impl; | ||
|
||
import com.intellij.lang.annotation.AnnotationHolder; | ||
import com.intellij.lang.annotation.HighlightSeverity; | ||
import glslplugin.GLSLHighlighter; | ||
import glslplugin.annotation.Annotator; | ||
import glslplugin.lang.elements.declarations.GLSLDeclarator; | ||
import glslplugin.lang.elements.declarations.GLSLQualifier; | ||
import glslplugin.lang.elements.expressions.GLSLIdentifierExpression; | ||
import glslplugin.lang.elements.preprocessor.GLSLFlowAttribute; | ||
import glslplugin.lang.elements.types.GLSLQualifiedType; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* Highlight-only annotation for variable references which are uniforms or varyings. | ||
* Highlighting style is the same as normal variables by default, so for this to be visible, new style must be selected manually. | ||
*/ | ||
public class FlowAttributeHighlightAnnotation extends Annotator<GLSLFlowAttribute> { | ||
|
||
@Override | ||
public void annotate(GLSLFlowAttribute expr, AnnotationHolder holder) { | ||
holder.newSilentAnnotation(HighlightSeverity.INFORMATION).textAttributes(GLSLHighlighter.GLSL_PREPROCESSOR_DIRECTIVE[0]).create(); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Class<GLSLFlowAttribute> getElementType() { | ||
return GLSLFlowAttribute.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/glslplugin/lang/elements/preprocessor/GLSLFlowAttribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package glslplugin.lang.elements.preprocessor; | ||
|
||
import com.intellij.lang.ASTNode; | ||
import glslplugin.lang.elements.GLSLElementImpl; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
* See https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GL_EXT_control_flow_attributes.txt | ||
*/ | ||
public class GLSLFlowAttribute extends GLSLElementImpl { | ||
|
||
public GLSLFlowAttribute(@NotNull ASTNode astNode) { | ||
super(astNode); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters