chore: Cleanup code
This commit is contained in:
parent
9438d8052f
commit
a6e3703616
11 changed files with 55 additions and 54 deletions
|
@ -65,7 +65,9 @@ public class HighlightingUtil {
|
|||
if (editor.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
if (highlightRanges.size() == 1 && highlightRanges.get(0).start() == 0 && highlightRanges.get(0).remove() == -1) {
|
||||
if (highlightRanges.size() == 1 &&
|
||||
highlightRanges.get(0).start() == 0 &&
|
||||
highlightRanges.get(0).remove() == -1) {
|
||||
markup.removeAllHighlighters();
|
||||
}
|
||||
var documentLength = editor.getDocument().getTextLength();
|
||||
|
|
|
@ -48,8 +48,8 @@ public class AppSettingsComponent {
|
|||
.addLabeledComponent(new JBLabel("Asynchronous code folding ranges: "),
|
||||
asyncFoldingCheckBox, 1, false)
|
||||
.addSeparator()
|
||||
.addComponent(new JBLabel("Developer settings" +
|
||||
" (only usable when the IDE was launched with " +
|
||||
.addComponent(new JBLabel(
|
||||
"Developer settings (only usable when the IDE was launched with " +
|
||||
"the runIDE gradle task in ZigBrains!)"))
|
||||
.addVerticalGap(10)
|
||||
.addLabeledComponent(new JBLabel("ZLS debug log: "), debugCheckBox, 1, false)
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.intellij.lang.Language;
|
|||
|
||||
public class ZonLanguage extends Language {
|
||||
public static final ZonLanguage INSTANCE = new ZonLanguage();
|
||||
|
||||
private ZonLanguage() {
|
||||
super("Zon");
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.Set;
|
|||
public class ZonCompletionContributor extends CompletionContributor {
|
||||
private static final List<String> ZON_ROOT_KEYS = List.of("name", "version", "dependencies");
|
||||
private static final List<String> ZON_DEP_KEYS = List.of("url", "hash");
|
||||
|
||||
public ZonCompletionContributor() {
|
||||
extend(CompletionType.BASIC,
|
||||
PlatformPatterns.psiElement()
|
||||
|
@ -79,6 +80,7 @@ public class ZonCompletionContributor extends CompletionContributor {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void doAddCompletions(boolean hasDot, Set<String> current, List<String> expected, CompletionResultSet result) {
|
||||
for (var key : expected) {
|
||||
if (current.contains(key)) {
|
||||
|
|
|
@ -35,8 +35,7 @@ import java.util.List;
|
|||
public class ZonBlock extends AbstractBlock {
|
||||
private final SpacingBuilder spacingBuilder;
|
||||
|
||||
protected ZonBlock(@NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment,
|
||||
SpacingBuilder spacingBuilder) {
|
||||
protected ZonBlock(@NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, SpacingBuilder spacingBuilder) {
|
||||
super(node, wrap, alignment);
|
||||
this.spacingBuilder = spacingBuilder;
|
||||
}
|
||||
|
@ -47,8 +46,7 @@ public class ZonBlock extends AbstractBlock {
|
|||
var child = myNode.getFirstChildNode();
|
||||
while (child != null) {
|
||||
if (child.getElementType() != TokenType.WHITE_SPACE) {
|
||||
var block = new ZonBlock(child, null, null,
|
||||
spacingBuilder);
|
||||
var block = new ZonBlock(child, null, null, spacingBuilder);
|
||||
blocks.add(block);
|
||||
}
|
||||
child = child.getTreeNext();
|
||||
|
@ -66,8 +64,6 @@ public class ZonBlock extends AbstractBlock {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public @Nullable Spacing getSpacing(@Nullable Block child1, @NotNull Block child2) {
|
||||
return null;
|
||||
|
|
|
@ -29,6 +29,7 @@ public class ZonFormattingModelBuilder implements FormattingModelBuilder {
|
|||
private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
|
||||
return new SpacingBuilder(settings, ZonLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull FormattingModel createModel(@NotNull FormattingContext formattingContext) {
|
||||
final var codeStyleSettings = formattingContext.getCodeStyleSettings();
|
||||
|
|
|
@ -22,7 +22,6 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
|||
import com.intellij.openapi.options.colors.AttributesDescriptor;
|
||||
import com.intellij.openapi.options.colors.ColorDescriptor;
|
||||
import com.intellij.openapi.options.colors.ColorSettingsPage;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -31,16 +30,14 @@ import javax.swing.Icon;
|
|||
import java.util.Map;
|
||||
|
||||
public class ZonColorSettingsPage implements ColorSettingsPage {
|
||||
private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[] {
|
||||
desc("Equals", ZonSyntaxHighlighter.EQ),
|
||||
private static final AttributesDescriptor[] DESCRIPTORS =
|
||||
new AttributesDescriptor[]{desc("Equals", ZonSyntaxHighlighter.EQ),
|
||||
desc("Identifier", ZonSyntaxHighlighter.ID),
|
||||
desc("Comment", ZonSyntaxHighlighter.COMMENT),
|
||||
desc("Bad Value", ZonSyntaxHighlighter.BAD_CHAR),
|
||||
desc("String", ZonSyntaxHighlighter.STRING),
|
||||
desc("Comma", ZonSyntaxHighlighter.COMMA),
|
||||
desc("Dot", ZonSyntaxHighlighter.DOT),
|
||||
desc("Braces", ZonSyntaxHighlighter.BRACE)
|
||||
};
|
||||
desc("Comma", ZonSyntaxHighlighter.COMMA), desc("Dot", ZonSyntaxHighlighter.DOT),
|
||||
desc("Braces", ZonSyntaxHighlighter.BRACE)};
|
||||
|
||||
private static AttributesDescriptor desc(String name, TextAttributesKey key) {
|
||||
return new AttributesDescriptor(name, key);
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
public class ZonBraceMatcher implements PairedBraceMatcher {
|
||||
public static final BracePair PAIR = new BracePair(ZonTypes.LBRACE, ZonTypes.RBRACE, true);
|
||||
private static final BracePair[] PAIRS = new BracePair[]{PAIR};
|
||||
|
||||
@Override
|
||||
public BracePair @NotNull [] getPairs() {
|
||||
return PAIRS;
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class ZonParserDefinition implements ParserDefinition {
|
||||
public static final IFileElementType FILE = new IFileElementType(ZonLanguage.INSTANCE);
|
||||
|
||||
@Override
|
||||
public @NotNull Lexer createLexer(Project project) {
|
||||
return new ZonLexerAdapter();
|
||||
|
|
Loading…
Add table
Reference in a new issue