Skip to content

Commit 992b6a4

Browse files
committed
Merge branch '1.1.5'
2 parents 0dc6736 + 6eb266a commit 992b6a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+237
-136
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# GLSL Plugin Changelog
22

3+
## [1.1.5]
4+
### Fixed
5+
- Iteration variable was resolved outside the iteration loop
6+
- Fixed Dynamic type check
7+
- Fixed broken swizzling for the stpq group
8+
- Added compatibility profile uniforms
9+
- Fixed nested builtin struct namespace pollution
10+
### Added
11+
- File structure view
12+
- Improved highlighting for light themes.
13+
314
## [1.1.4]
415
- Updated version
516

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ patchPluginXml {
7777
changeNotes = changelog.get(version.toString()).toHTML()
7878
pluginDescription = descriptionHtml
7979
sinceBuild = '223'
80-
untilBuild = '243.*'
8180
}
8281

8382
changelog {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pluginVersion=1.1.4
1+
pluginVersion=1.1.5
22
kotlin.code.style=official

src/main/kotlin/glsl/plugin/features/GlslBraceMatcher.kt renamed to src/main/kotlin/glsl/plugin/editor/GlslBraceMatcher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package glsl.plugin.features
1+
package glsl.plugin.editor
22

33
import com.intellij.codeInsight.highlighting.PairedBraceMatcherAdapter
44
import com.intellij.lang.BracePair

src/main/kotlin/glsl/plugin/features/GlslCommenter.kt renamed to src/main/kotlin/glsl/plugin/editor/GlslCommenter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package glsl.plugin.features
1+
package glsl.plugin.editor
22

33
import com.intellij.lang.Commenter
44

src/main/kotlin/glsl/plugin/features/GlslDocumentationProvider.kt renamed to src/main/kotlin/glsl/plugin/editor/GlslDocumentationProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package glsl.plugin.features
1+
package glsl.plugin.editor
22

33
import com.intellij.lang.documentation.DocumentationProvider
44
import com.intellij.openapi.editor.Editor

src/main/kotlin/glsl/plugin/features/GlslMultiHostInjector.kt renamed to src/main/kotlin/glsl/plugin/editor/GlslMultiHostInjector.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package glsl.plugin.features
1+
package glsl.plugin.editor
22

33
import com.intellij.codeInsight.template.TemplateActionContext
44
import com.intellij.codeInsight.template.TemplateContextType

src/main/kotlin/glsl/plugin/features/GlslNewShaderFile.kt renamed to src/main/kotlin/glsl/plugin/editor/GlslNewShaderFile.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package glsl.plugin.features
1+
package glsl.plugin.editor
22

33
import com.intellij.ide.actions.CreateFileFromTemplateAction
44
import com.intellij.ide.actions.CreateFileFromTemplateDialog

src/main/kotlin/glsl/plugin/features/GlslQuoteHandler.kt renamed to src/main/kotlin/glsl/plugin/editor/GlslQuoteHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package glsl.plugin.features
1+
package glsl.plugin.editor
22

33
import com.intellij.codeInsight.editorActions.SimpleTokenSetQuoteHandler
44
import com.intellij.psi.TokenType
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package glsl.plugin.editor
2+
3+
import com.intellij.icons.AllIcons
4+
import com.intellij.ide.projectView.PresentationData
5+
import com.intellij.ide.structureView.*
6+
import com.intellij.ide.util.treeView.smartTree.SortableTreeElement
7+
import com.intellij.ide.util.treeView.smartTree.Sorter
8+
import com.intellij.ide.util.treeView.smartTree.TreeElement
9+
import com.intellij.lang.PsiStructureViewFactory
10+
import com.intellij.navigation.ItemPresentation
11+
import com.intellij.openapi.editor.Editor
12+
import com.intellij.openapi.editor.HighlighterColors
13+
import com.intellij.psi.NavigatablePsiElement
14+
import com.intellij.psi.PsiFile
15+
import com.intellij.psi.util.PsiTreeUtil
16+
import glsl.plugin.language.GlslFile
17+
import glsl.psi.impl.GlslFunctionDefinitionImpl
18+
import glsl.psi.interfaces.GlslExternalDeclaration
19+
import glsl.psi.interfaces.GlslFunctionDefinition
20+
21+
22+
class GlslStructureViewFactory : PsiStructureViewFactory {
23+
override fun getStructureViewBuilder(psiFile: PsiFile): StructureViewBuilder {
24+
return object : TreeBasedStructureViewBuilder() {
25+
override fun createStructureViewModel(editor: Editor?): StructureViewModel {
26+
return GlslStructureViewModel(editor, psiFile)
27+
}
28+
}
29+
}
30+
}
31+
32+
class GlslStructureViewModel(editor: Editor?, psiFile: PsiFile) :
33+
StructureViewModelBase(psiFile, editor, GlslStructureViewElement(psiFile)), StructureViewModel.ElementInfoProvider {
34+
35+
override fun getSorters(): Array<Sorter> {
36+
return arrayOf(Sorter.ALPHA_SORTER)
37+
}
38+
39+
override fun getSuitableClasses(): Array<Class<GlslExternalDeclaration>> {
40+
return arrayOf(GlslExternalDeclaration::class.java)
41+
}
42+
43+
override fun isAlwaysShowsPlus(element: StructureViewTreeElement?): Boolean {
44+
return false
45+
}
46+
47+
override fun isAlwaysLeaf(element: StructureViewTreeElement?): Boolean {
48+
return element?.value is GlslExternalDeclaration
49+
}
50+
}
51+
52+
53+
class GlslStructureViewElement(private val element: NavigatablePsiElement) : StructureViewTreeElement, SortableTreeElement {
54+
55+
override fun getValue(): Any {
56+
return element
57+
}
58+
59+
override fun getPresentation(): ItemPresentation {
60+
if (element is GlslFunctionDefinition) {
61+
return PresentationData(element.functionDeclarator.text + ")", "", AllIcons.Nodes.Function, HighlighterColors.NO_HIGHLIGHTING)
62+
} else if (element is GlslFile) {
63+
return element.presentation ?: PresentationData()
64+
}
65+
return PresentationData()
66+
}
67+
68+
override fun getChildren(): Array<TreeElement> {
69+
if (element !is GlslFile) return emptyArray()
70+
val externalDeclarations = PsiTreeUtil.getChildrenOfType(element, GlslExternalDeclaration::class.java) ?: return emptyArray()
71+
val funcs = mutableListOf<TreeElement>()
72+
for (externalDeclaration in externalDeclarations) {
73+
if (externalDeclaration.functionDefinition == null) continue
74+
funcs.add(GlslStructureViewElement(externalDeclaration.functionDefinition!! as GlslFunctionDefinitionImpl))
75+
}
76+
return funcs.toTypedArray()
77+
}
78+
79+
override fun getAlphaSortKey(): String {
80+
return element.name ?: ""
81+
}
82+
83+
override fun navigate(requestFocus: Boolean) {
84+
element.navigate(requestFocus)
85+
}
86+
87+
override fun canNavigate(): Boolean {
88+
return element.canNavigate()
89+
}
90+
override fun canNavigateToSource(): Boolean {
91+
return element.canNavigateToSource()
92+
}
93+
}

0 commit comments

Comments
 (0)