Skip to content

Commit

Permalink
Fix injection of not injectable statements (#292)
Browse files Browse the repository at this point in the history
- Fix injection of not injectable statements
- Fix CodeQl versioning
---------

Signed-off-by: Filip Vitkovský <filip.vitkovsky@pantheon.tech>
  • Loading branch information
Filip-Vitkovsky committed May 11, 2023
1 parent b9dcc9a commit 6f60d28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -60,4 +60,4 @@ jobs:
run: gradle build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v2
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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))
Expand Down

0 comments on commit 6f60d28

Please sign in to comment.