• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521819

12 Apr 2026 11:03AM UTC coverage: 76.189% (+0.1%) from 76.061%
#525521819

push

github

hurricup
[qodana] Suppressed a warning on the api method

14764 of 22542 branches covered (65.5%)

Branch coverage included in aggregate %.

31091 of 37644 relevant lines covered (82.59%)

0.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.79
/plugin/common/src/main/java/com/perl5/lang/perl/psi/PerlFileViewProvider.java
1
/*
2
 * Copyright 2015-2026 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.perl.psi;
18

19
import com.intellij.lang.Language;
20
import com.intellij.lang.LanguageParserDefinitions;
21
import com.intellij.lang.ParserDefinition;
22
import com.intellij.openapi.vfs.VirtualFile;
23
import com.intellij.psi.MultiplePsiFilesPerDocumentFileViewProvider;
24
import com.intellij.psi.PsiFile;
25
import com.intellij.psi.PsiManager;
26
import com.intellij.psi.impl.source.PsiFileImpl;
27
import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider;
28
import com.intellij.psi.tree.IElementType;
29
import com.perl5.lang.perl.PerlLanguage;
30
import com.perl5.lang.pod.PodLanguage;
31
import org.jetbrains.annotations.NotNull;
32
import org.jetbrains.annotations.Nullable;
33

34
import java.util.Set;
35

36
import static com.perl5.lang.perl.lexer.PerlElementTypes.POD_BLOCK;
37

38

39
public class PerlFileViewProvider extends MultiplePsiFilesPerDocumentFileViewProvider
40
  implements TemplateLanguageFileViewProvider {
41
  private static final Set<Language> myLanguages = Set.of(
1✔
42
    PerlLanguage.INSTANCE,
43
    PodLanguage.INSTANCE
44
  );
45

46
  public PerlFileViewProvider(PsiManager manager, VirtualFile virtualFile, boolean eventSystemEnabled) {
47
    super(manager, virtualFile, eventSystemEnabled);
1✔
48
  }
1✔
49

50
  @Override
51
  protected @Nullable PsiFile createFile(@NotNull Language lang) {
52
    if (lang != PerlLanguage.INSTANCE && lang != PodLanguage.INSTANCE) {
1!
53
      return null;
×
54
    }
55

56
    final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
1✔
57
    if (parserDefinition != null) {
1!
58

59
      final PsiFileImpl psiFile = (PsiFileImpl)parserDefinition.createFile(this);
1✔
60

61
      if (lang == PodLanguage.INSTANCE) {
1✔
62
        psiFile.setContentElementType(POD_BLOCK);
1✔
63
      }
64

65
      return psiFile;
1✔
66
    }
67

68
    return null;
×
69
  }
70

71
  @Override
72
  public @NotNull Set<Language> getLanguages() {
73
    return myLanguages;
1!
74
  }
75

76
  @Override
77
  public IElementType getContentElementType(@NotNull Language language) {
78
    return language == PodLanguage.INSTANCE ? POD_BLOCK : null;
1✔
79
  }
80

81
  @Override
82
  public @NotNull Language getBaseLanguage() {
83
    return PerlLanguage.INSTANCE;
1!
84
  }
85

86
  @Override
87
  protected @NotNull MultiplePsiFilesPerDocumentFileViewProvider cloneInner(@NotNull VirtualFile fileCopy) {
88
    return new PerlFileViewProvider(getManager(), fileCopy, false);
1✔
89
  }
90

91
  @Override
92
  public @NotNull Language getTemplateDataLanguage() {
93
    return PodLanguage.INSTANCE;
1!
94
  }
95
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc