PY-61639 Extracted PyHighlightingAnnotator

GitOrigin-RevId: 432bcb87b77fa55f1ccb26000d91ae021cebcc6b
This commit is contained in:
Petr
2024-03-21 14:56:16 +01:00
committed by intellij-monorepo-bot
parent d396a19918
commit 4602d09655
15 changed files with 145 additions and 66 deletions

View File

@@ -15,5 +15,12 @@
<typedHandler implementation="com.jetbrains.python.codeInsight.PyKeywordTypedHandler" id="pyCommaAfterKwd"/>
<typedHandler implementation="com.jetbrains.python.editor.PythonSpaceHandler"/>
<backspaceHandlerDelegate implementation="com.jetbrains.python.codeInsight.editorActions.PyTripleQuoteBackspaceDelegate"/>
<annotator language="Python" implementationClass="com.jetbrains.python.validation.PyCompositeAnnotator"/>
</extensions>
<extensions defaultExtensionNs="Pythonid">
<pyAnnotator implementation="com.jetbrains.python.validation.PyHighlightingAnnotator"/>
</extensions>
<extensionPoints>
<extensionPoint qualifiedName="Pythonid.pyAnnotator" interface="com.jetbrains.python.validation.PyAnnotatorBase" dynamic="true"/>
</extensionPoints>
</idea-plugin>

View File

@@ -0,0 +1,16 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.validation;
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.Annotator;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
public final class PyCompositeAnnotator implements Annotator {
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
PyAnnotatorBase[] annotators = ExtensionPointName.<PyAnnotatorBase>create("Pythonid.pyAnnotator").getExtensions();
PyAnnotatorBase.runAnnotators(element, holder, annotators);
}
}