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

Camelcade / Perl5-IDEA / #525521851

22 May 2026 05:53AM UTC coverage: 76.208% (+0.01%) from 76.196%
#525521851

push

github

hurricup
Build 2026.2-EAP.6228.19

14772 of 22542 branches covered (65.53%)

Branch coverage included in aggregate %.

31144 of 37709 relevant lines covered (82.59%)

0.83 hits per line

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

0.0
/plugin/common/src/main/java/com/perl5/lang/perl/idea/highlighter/PerlColorSettingsPage.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.perl.idea.highlighter;
18

19
import com.intellij.openapi.editor.colors.TextAttributesKey;
20
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
21
import com.intellij.openapi.options.colors.AttributesDescriptor;
22
import com.intellij.openapi.options.colors.ColorDescriptor;
23
import com.intellij.openapi.options.colors.ColorSettingsPage;
24
import com.perl5.PerlBundle;
25
import com.perl5.PerlIcons;
26
import com.perl5.lang.perl.PerlLanguage;
27
import com.perl5.lang.perl.psi.utils.PerlPsiUtil;
28
import org.jetbrains.annotations.NotNull;
29
import org.jetbrains.annotations.Nullable;
30

31
import javax.swing.*;
32
import java.util.Map;
33

34
import static java.util.Map.entry;
35

36

37
public class PerlColorSettingsPage implements ColorSettingsPage {
×
38

39
  @Override
40
  public @Nullable Icon getIcon() {
41
    return PerlIcons.PERL_LANGUAGE_ICON;
×
42
  }
43

44
  @Override
45
  public @NotNull SyntaxHighlighter getHighlighter() {
46
    return new PerlSyntaxHighlighter(null);
×
47
  }
48

49

50
  @Override
51
  public @NotNull String getDemoText() {
52
    return """
×
53
      #!/usr/bin/perl
54
      <kw>use</kw> <pragma>strict</pragma>;
55
      <kw>use</kw> <package_core>Scalar::Util</package_core>;
56
      <kw>use</kw> v5.10;
57
      <kw>package</kw> <package_def>Foo::Bar</package_def>;
58
      <kw>use</kw> <pragma>constant</pragma> <const>CONSTANT</const> => 42;
59
      <kw>print</kw> <const>CONSTANT</const>;
60
      <block>BEGIN</block> { <kw>use</kw> <package>Mojo::Base</package> <q>-strict</q>; };
61
      <kw>sub</kw> <autoload>AUTOLOAD</autoload>{}
62
      <autoload>autoloaded_sub_call</autoload>();
63
      /this[-\\s[:^alpha:]a-z-]is\\sa[^\\s]te\\\\sst/;
64
      <ann>#@method</ann>
65
      <kw>sub</kw> <sub_declaration>sub_declaration</sub_declaration>: <sub_attr>method</sub_attr>;
66
      <ann>#@deprecated</ann>
67
      <kw>sub</kw> <sub_definition>sub_definition</sub_definition>(<sub_proto>$$$</sub_proto>){}
68
      <glob>*sub_declaration</glob> = \\&<sub>sub_definition</sub>;
69
      <package>LWP::UserAgent</package>-><sub>new</sub>();
70
      <package_core>Scalar::Util::</package_core><xsub>blessed</xsub>();
71
      <kw>my</kw> <scalar>$scalar</scalar>: <sub_attr>someattr</sub_attr> = <qx>`Executable string`</qx>; # line comment
72
      <scalar>$scalar</scalar> =~ /<rx>is there something</rx>/;
73
      <scalar>$scalar</scalar> = <scalar_builtin>${^WARNING_BITS}</scalar_builtin>;
74
      <scalar>$scalar</scalar> = <glob_builtin>*STDERR</glob_builtin>;
75
      <sub_builtin>open</sub_builtin> <handle>OTHERHANDLE</handle>, <q>'somefile'</q>;
76
      <kw>my</kw> <array>@array</array> = (<array_builtin>@ARGV</array_builtin>, 42, <array>@{</array><scalar>$scalar</scalar><array>}</array>, <array>@</array><scalar>$scalar</scalar>, <hash>%</hash><scalar>$scalar</scalar>, <angle><</angle><handle_builtin>STDIN</handle_builtin><angle>></angle>, <angle><</angle><handle>OHTERHANDLE</handle><angle>></angle>);
77
      <kw>my</kw> <hash>%hash</hash> = ( <hash_builtin>%INC</hash_builtin>, <q>bareword_string</q> => <hash>%{</hash><array>@array</array>[0]<hash>}</hash>);
78
      <label>START</label>: <kw>print</kw> <q>'Single quoted string'</q>;
79
      <kw>say</kw> <qq>"Double quoted string"</qq>;
80
      <kw>say</kw> __LINE__;
81
      say "Something \\Qhere\\E \\uthere \\N{LATIN CAPITAL LETTER A} \\N{U+0028}";
82
      my $sum = 42 + 0x42 + 0b1010101 + 042;<kw>say</kw> <<<q>'MOJO'</q>;
83
          <em>%=</em> <kw>print</kw> <qq>"Mojo perl code"</qq>
84
          <em><%</em> <kw>print</kw> <qq>"Some more Mojo code"</qq>; <em>%></em>
85
      <q>MOJO</q>
86

87
      """;
88
  }
89

90
  @Override
91
  public @Nullable Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
92
    return Map.ofEntries(
×
93
      entry("package", PerlSyntaxHighlighter.PERL_PACKAGE),
×
94
      entry("package_core", PerlSyntaxHighlighter.PERL_PACKAGE_CORE),
×
95
      entry("pragma", PerlSyntaxHighlighter.PERL_PACKAGE_PRAGMA),
×
96
      entry("package_def", PerlSyntaxHighlighter.PERL_PACKAGE_DEFINITION),
×
97
      entry("angle", PerlSyntaxHighlighter.PERL_ANGLE),
×
98
      entry("scalar", PerlSyntaxHighlighter.PERL_SCALAR),
×
99
      entry("scalar_builtin", PerlSyntaxHighlighter.PERL_SCALAR_BUILTIN),
×
100
      entry("array", PerlSyntaxHighlighter.PERL_ARRAY),
×
101
      entry("array_builtin", PerlSyntaxHighlighter.PERL_ARRAY_BUILTIN),
×
102
      entry("hash", PerlSyntaxHighlighter.PERL_HASH),
×
103
      entry("hash_builtin", PerlSyntaxHighlighter.PERL_HASH_BUILTIN),
×
104
      entry("glob", PerlSyntaxHighlighter.PERL_GLOB),
×
105
      entry("glob_builtin", PerlSyntaxHighlighter.PERL_GLOB_BUILTIN),
×
106
      entry("handle", PerlSyntaxHighlighter.PERL_HANDLE),
×
107
      entry("handle_builtin", PerlSyntaxHighlighter.PERL_HANDLE_BUILTIN),
×
108
      entry("autoload", PerlSyntaxHighlighter.PERL_AUTOLOAD),
×
109
      entry(PerlPsiUtil.QUOTE_Q, PerlSyntaxHighlighter.PERL_SQ_STRING),
×
110
      entry(PerlPsiUtil.QUOTE_QX, PerlSyntaxHighlighter.PERL_DX_STRING),
×
111
      entry(PerlPsiUtil.QUOTE_QQ, PerlSyntaxHighlighter.PERL_DQ_STRING),
×
112
      entry("rx", PerlSyntaxHighlighter.PERL_REGEX_TOKEN),
×
113
      entry("block", PerlSyntaxHighlighter.PERL_BLOCK_NAME),
×
114
      entry("const", PerlSyntaxHighlighter.PERL_CONSTANT),
×
115
      entry("em", PerlSyntaxHighlighter.EMBED_MARKER_KEY),
×
116
      entry("kw", PerlSyntaxHighlighter.PERL_KEYWORD),
×
117
      entry("label", PerlSyntaxHighlighter.PERL_LABEL),
×
118
      entry("sub", PerlSyntaxHighlighter.PERL_SUB),
×
119
      entry("sub_builtin", PerlSyntaxHighlighter.PERL_SUB_BUILTIN),
×
120
      entry("xsub", PerlSyntaxHighlighter.PERL_XSUB),
×
121
      entry("sub_attr", PerlSyntaxHighlighter.PERL_SUB_ATTRIBUTE),
×
122
      entry("sub_proto", PerlSyntaxHighlighter.PERL_SUB_PROTOTYPE_TOKEN),
×
123
      entry("sub_declaration", PerlSyntaxHighlighter.PERL_SUB_DECLARATION),
×
124
      entry("sub_definition", PerlSyntaxHighlighter.PERL_SUB_DEFINITION),
×
125
      entry("ann", PerlSyntaxHighlighter.PERL_ANNOTATION)
×
126
    );
127
  }
128

129
  @Override
130
  public AttributesDescriptor @NotNull [] getAttributeDescriptors() {
131
    return new AttributesDescriptor[]{
×
132
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.version"), PerlSyntaxHighlighter.PERL_VERSION),
×
133
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.number"), PerlSyntaxHighlighter.PERL_NUMBER),
×
134
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.number.binary"), PerlSyntaxHighlighter.PERL_NUMBER_BIN),
×
135
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.number.octal"), PerlSyntaxHighlighter.PERL_NUMBER_OCT),
×
136
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.number.hexadecimal"), PerlSyntaxHighlighter.PERL_NUMBER_HEX),
×
137

138
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.line.comment"), PerlSyntaxHighlighter.PERL_COMMENT),
×
139

140
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.embedding.marker"), PerlSyntaxHighlighter.EMBED_MARKER_KEY),
×
141

142
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.label"), PerlSyntaxHighlighter.PERL_LABEL),
×
143
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.block.name"), PerlSyntaxHighlighter.PERL_BLOCK_NAME),
×
144
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.special.token"), PerlSyntaxHighlighter.PERL_TAG),
×
145

146
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.operator"), PerlSyntaxHighlighter.PERL_OPERATOR),
×
147
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.keyword"), PerlSyntaxHighlighter.PERL_KEYWORD),
×
148
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.dereference"), PerlSyntaxHighlighter.PERL_DEREFERENCE),
×
149

150
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.annotation"), PerlSyntaxHighlighter.PERL_ANNOTATION),
×
151

152
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub"), PerlSyntaxHighlighter.PERL_SUB),
×
153
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.built.in"), PerlSyntaxHighlighter.PERL_SUB_BUILTIN),
×
154
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.xs"), PerlSyntaxHighlighter.PERL_XSUB),
×
155
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.autoloaded"), PerlSyntaxHighlighter.PERL_AUTOLOAD),
×
156
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.constant"), PerlSyntaxHighlighter.PERL_CONSTANT),
×
157
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.definition"), PerlSyntaxHighlighter.PERL_SUB_DEFINITION),
×
158
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.declaration"), PerlSyntaxHighlighter.PERL_SUB_DECLARATION),
×
159
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.attribute"), PerlSyntaxHighlighter.PERL_SUB_ATTRIBUTE),
×
160
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.sub.prototype"), PerlSyntaxHighlighter.PERL_SUB_PROTOTYPE_TOKEN),
×
161

162
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.package"), PerlSyntaxHighlighter.PERL_PACKAGE),
×
163
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.package.pragma"), PerlSyntaxHighlighter.PERL_PACKAGE_PRAGMA),
×
164
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.package.core"), PerlSyntaxHighlighter.PERL_PACKAGE_CORE),
×
165
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.package.definition"),
×
166
                               PerlSyntaxHighlighter.PERL_PACKAGE_DEFINITION),
167

168
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.variable.scalar"), PerlSyntaxHighlighter.PERL_SCALAR),
×
169
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.variable.scalar.built.in"),
×
170
                               PerlSyntaxHighlighter.PERL_SCALAR_BUILTIN),
171
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.variable.array"), PerlSyntaxHighlighter.PERL_ARRAY),
×
172
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.variable.array.built.in"),
×
173
                               PerlSyntaxHighlighter.PERL_ARRAY_BUILTIN),
174
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.variable.hash"), PerlSyntaxHighlighter.PERL_HASH),
×
175
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.variable.hash.built.in"), PerlSyntaxHighlighter.PERL_HASH_BUILTIN),
×
176

177
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.typeglob"), PerlSyntaxHighlighter.PERL_GLOB),
×
178
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.typeglob.built.in"), PerlSyntaxHighlighter.PERL_GLOB_BUILTIN),
×
179
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.typeglob.file.handle"), PerlSyntaxHighlighter.PERL_HANDLE),
×
180
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.typeglob.file.handle.built.in"),
×
181
                               PerlSyntaxHighlighter.PERL_HANDLE_BUILTIN),
182

183
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.string.single.quoted"), PerlSyntaxHighlighter.PERL_SQ_STRING),
×
184
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.string.double.quoted"), PerlSyntaxHighlighter.PERL_DQ_STRING),
×
185
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.string.backticked"), PerlSyntaxHighlighter.PERL_DX_STRING),
×
186
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.string.control.chars"), PerlSyntaxHighlighter.PERL_STRING_SPECIAL),
×
187
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.string.character.name"),
×
188
                               PerlSyntaxHighlighter.PERL_STRING_CHAR_NAME),
189

190
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.regex.quote"), PerlSyntaxHighlighter.PERL_REGEX_QUOTE),
×
191
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.regex.element"), PerlSyntaxHighlighter.PERL_REGEX_TOKEN),
×
192

193
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.comma"), PerlSyntaxHighlighter.PERL_COMMA),
×
194
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.semicolon"), PerlSyntaxHighlighter.PERL_SEMICOLON),
×
195
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.braces"), PerlSyntaxHighlighter.PERL_BRACE),
×
196
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.parentheses"), PerlSyntaxHighlighter.PERL_PAREN),
×
197
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.brackets"), PerlSyntaxHighlighter.PERL_BRACK),
×
198
      new AttributesDescriptor(PerlBundle.message("attribute.descriptor.angles"), PerlSyntaxHighlighter.PERL_ANGLE)
×
199
    };
200
  }
201

202
  @Override
203
  public ColorDescriptor @NotNull [] getColorDescriptors() {
204
    return ColorDescriptor.EMPTY_ARRAY;
×
205
  }
206

207
  @Override
208
  public @NotNull String getDisplayName() {
209
    return PerlLanguage.NAME;
×
210
  }
211
}
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