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

Camelcade / Perl5-IDEA / #525521563

01 Jun 2025 02:15PM UTC coverage: 82.332% (+0.04%) from 82.289%
#525521563

push

github

hurricup
Bounded wildcards

2 of 2 new or added lines in 2 files covered. (100.0%)

69 existing lines in 17 files now uncovered.

30882 of 37509 relevant lines covered (82.33%)

0.82 hits per line

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

90.0
/plugin/core/src/main/java/com/perl5/lang/pod/idea/structureView/PodStructureViewElement.java
1
/*
2
 * Copyright 2015-2025 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.pod.idea.structureView;
18

19
import com.intellij.ide.structureView.StructureViewTreeElement;
20
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
21
import com.intellij.navigation.ItemPresentation;
22
import com.intellij.psi.PsiElement;
23
import com.intellij.psi.PsiFile;
24
import com.perl5.PerlBundle;
25
import com.perl5.PerlIcons;
26
import com.perl5.lang.pod.parser.psi.PodFile;
27
import com.perl5.lang.pod.parser.psi.PodSection;
28
import com.perl5.lang.pod.parser.psi.PodStructureElement;
29
import com.perl5.lang.pod.parser.psi.mixin.PodSectionOver;
30
import com.perl5.lang.pod.psi.PsiCutSection;
31
import com.perl5.lang.pod.psi.PsiPodSection;
32
import org.jetbrains.annotations.NotNull;
33
import org.jetbrains.annotations.Nullable;
34

35
import javax.swing.*;
36
import java.util.ArrayList;
37
import java.util.Collection;
38
import java.util.Collections;
39
import java.util.List;
40

41
public class PodStructureViewElement extends PsiTreeElementBase<PsiElement> {
42

43
  public PodStructureViewElement(PsiElement element) {
44
    super(element);
1✔
45
  }
1✔
46

47
  @Override
48
  public @Nullable String getPresentableText() {
49
    PsiElement element = getElement();
1✔
50
    return switch (element) {
1✔
51
      case PodFile ignored -> PerlBundle.message("pod.structure.view.file.title");
1✔
52
      case ItemPresentation presentation -> presentation.getPresentableText();
1✔
UNCOV
53
      case null, default -> null;
×
54
    };
55
  }
56

57
  @Override
58
  public @Nullable String getLocationString() {
59
    return null;
1✔
60
  }
61

62
  @Override
63
  public @Nullable Icon getIcon(boolean unused) {
64
    PsiElement element = getElement();
1✔
65
    if (element == null) {
1✔
UNCOV
66
      return null;
×
67
    }
68
    return element instanceof PsiFile ? PerlIcons.POD_FILE : element.getIcon(0);
1✔
69
  }
70

71
  @Override
72
  public @NotNull Collection<StructureViewTreeElement> getChildrenBase() {
73
    PsiElement psiElement = getElement();
1✔
74
    if (psiElement == null) {
1✔
UNCOV
75
      return Collections.emptyList();
×
76
    }
77
    List<StructureViewTreeElement> result = new ArrayList<>();
1✔
78

79
    PsiElement container = null;
1✔
80
    if (psiElement instanceof PodSection podSection) {
1✔
81
      container = podSection.getContentBlock();
1✔
82
    }
83

84
    if (container == null) {
1✔
85
      container = psiElement;
1✔
86
    }
87

88

89
    for (PsiElement element : container.getChildren()) {
1✔
90
      if (element instanceof PodStructureElement) {
1✔
91
        if (!(element instanceof PsiCutSection || element instanceof PsiPodSection)) {
1✔
92
          result.add(new PodStructureViewElement(element));
1✔
93
        }
94
      }
95
    }
96

97
    if (result.size() == 1 && result.getFirst().getValue() instanceof PodSectionOver) {
1✔
98
      // expanding over
99
      StructureViewTreeElement childElement = result.getFirst();
1✔
100
      if (childElement instanceof PodStructureViewElement structureViewElement) {
1✔
101
        return structureViewElement.getChildrenBase();
1✔
102
      }
103
    }
104

105
    return result;
1✔
106
  }
107
}
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