public class DylanLineMarkerProvider implements LineMarkerProvider { protected final DaemonCodeAnalyzerSettings myDaemonSettings; protected final EditorColorsManager myColorsManager; public DylanLineMarkerProvider(DaemonCodeAnalyzerSettings daemonSettings, EditorColorsManager colorsManager) { myDaemonSettings = daemonSettings; myColorsManager = colorsManager; } @Override @Nullable public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) { if (myDaemonSettings.SHOW_METHOD_SEPARATORS) { if (element instanceof DylanDefinition) { LineMarkerInfo info = new LineMarkerInfo<PsiElement>(element, element.getTextRange(), null, Pass.UPDATE_ALL, FunctionUtil.<Object, String>nullConstant(), null, GutterIconRenderer.Alignment.RIGHT); EditorColorsScheme scheme = myColorsManager.getGlobalScheme(); info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR); info.separatorPlacement = SeparatorPlacement.BOTTOM; return info; } } return null; } @Override public void collectSlowLineMarkers(@NotNull List<PsiElement> elements, @NotNull Collection<LineMarkerInfo> result) { } }
public class DylanParserDefinition implements ParserDefinition { public static final IFileElementType FILE = new IFileElementType(DylanLanguage.INSTANCE); @NotNull @Override public Lexer createLexer(Project project) { return new DylanFlexLexer(); } @NotNull public TokenSet getWhitespaceTokens() { return WHITE_SPACES; } @NotNull public TokenSet getCommentTokens() { return COMMENTS; } @NotNull public TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } @NotNull public PsiParser createParser(final Project project) { return new DylanParser(); } @Override public IFileElementType getFileNodeType() { return FILE; } public PsiFile createFile(FileViewProvider viewProvider) { return new DylanFile(viewProvider); } public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { return SpaceRequirements.MAY; } @NotNull public PsiElement createElement(ASTNode node) { return DylanTypes.Factory.createElement(node); } }
时间: 2024-10-05 22:42:39