diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 01526095..80350ee0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -60,4 +60,4 @@ jobs: run: gradle build - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v2 diff --git a/intelij-plugin/src/main/java/tech/pantheon/yanginator/plugin/injection/RegExpToYangInjector.java b/intelij-plugin/src/main/java/tech/pantheon/yanginator/plugin/injection/RegExpToYangInjector.java index c2ef1454..b3f73183 100644 --- a/intelij-plugin/src/main/java/tech/pantheon/yanginator/plugin/injection/RegExpToYangInjector.java +++ b/intelij-plugin/src/main/java/tech/pantheon/yanginator/plugin/injection/RegExpToYangInjector.java @@ -17,6 +17,7 @@ import com.intellij.psi.PsiLanguageInjectionHost; import com.intellij.psi.impl.source.resolve.reference.impl.providers.XsdRegExpParserDefinition; import org.jetbrains.annotations.NotNull; +import tech.pantheon.yanginator.plugin.psi.YangIndentableQuotedString; import tech.pantheon.yanginator.plugin.psi.YangPatternBody; import tech.pantheon.yanginator.plugin.psi.YangQuotedString; @@ -26,7 +27,7 @@ public class RegExpToYangInjector implements MultiHostInjector { @Override public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) { if (context instanceof YangQuotedString && - context.getParent() != null && + context.getParent() instanceof YangIndentableQuotedString && context.getParent().getParent() instanceof YangPatternBody) { registrar.startInjecting(XsdRegExpParserDefinition.LANGUAGE) .addPlace(null, null, (PsiLanguageInjectionHost) context, new TextRange(context.getStartOffsetInParent() + 1, context.getStartOffsetInParent() + context.getTextLength() - 1))