diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index bd782cca0be24408bee59173e71ffc4f7f3cbf5b..4eb617259155a0b72f47c8102aa3a13b9cf22b6a 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -261,9 +261,12 @@ void GLSLTextEditor::updateDocumentNow()
 {
     m_updateDocumentTimer->stop();
 
-    const int variant = Lexer::Variant_GLSL_Qt | // ### hardcoded
-                        Lexer::Variant_VertexShader |
-                        Lexer::Variant_FragmentShader;
+    int variant = Lexer::Variant_GLSL_Qt; // ### hardcoded
+
+    if (isVertexShader())
+        variant |= Lexer::Variant_VertexShader;
+    if (isFragmentShader())
+        variant |= Lexer::Variant_FragmentShader;
     const QString contents = toPlainText(); // get the code from the editor
     const QByteArray preprocessedCode = contents.toLatin1(); // ### use the QtCreator C++ preprocessor.
 
@@ -276,9 +279,9 @@ void GLSLTextEditor::updateDocumentNow()
     Semantic sem;
     Scope *globalScope = engine.newNamespace();
     sem.translationUnit(plugin->shaderInit()->ast, globalScope, plugin->shaderInit()->engine);
-    if (isVertexShader())
+    if (variant & Lexer::Variant_VertexShader)
         sem.translationUnit(plugin->vertexShaderInit()->ast, globalScope, plugin->vertexShaderInit()->engine);
-    if (isFragmentShader())
+    if (variant & Lexer::Variant_FragmentShader)
         sem.translationUnit(plugin->fragmentShaderInit()->ast, globalScope, plugin->fragmentShaderInit()->engine);
     sem.translationUnit(ast, globalScope, &engine);