本文整理汇总了Java中com.intellij.lang.LanguageAnnotators类的典型用法代码示例。如果您正苦于以下问题:Java LanguageAnnotators类的具体用法?Java LanguageAnnotators怎么用?Java LanguageAnnotators使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LanguageAnnotators类属于com.intellij.lang包,在下文中一共展示了LanguageAnnotators类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInfoTestAttributes
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
public void testInfoTestAttributes() throws Exception {
LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<Annotator>();
extension.language="TEXT";
extension.implementationClass = TestAnnotator.class.getName();
PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, getTestRootDisposable());
myFixture.configureByText(PlainTextFileType.INSTANCE, "foo");
EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()){{initFonts();}};
scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN));
((EditorEx)myFixture.getEditor()).setColorsScheme(scheme);
myFixture.doHighlighting();
MarkupModel model = DocumentMarkupModel.forDocument(myFixture.getEditor().getDocument(), getProject(), false);
RangeHighlighter[] highlighters = model.getAllHighlighters();
assertEquals(1, highlighters.length);
TextAttributes attributes = highlighters[0].getTextAttributes();
assertNotNull(attributes);
assertNull(attributes.getBackgroundColor());
assertNull(attributes.getForegroundColor());
}
示例2: doTest
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
private void doTest(String... additionalPaths) throws Exception {
final String[] paths = ArrayUtil.append(additionalPaths, getTestName(false) + ".hx");
myFixture.configureByFiles(ArrayUtil.reverseArray(paths));
final HaxeTypeAnnotator annotator = new HaxeTypeAnnotator();
try {
LanguageAnnotators.INSTANCE.addExplicitExtension(HaxeLanguage.INSTANCE, annotator);
myFixture.enableInspections(getAnnotatorBasedInspection());
try {
myFixture.testHighlighting(true, true, true, myFixture.getFile().getVirtualFile());
}
finally {
LanguageAnnotators.INSTANCE.removeExplicitExtension(HaxeLanguage.INSTANCE, annotator);
}
} finally {
LanguageAnnotators.INSTANCE.removeExplicitExtension(HaxeLanguage.INSTANCE, annotator);
}
}
示例3: registerAnnotatorWithAllLanguages
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
private void registerAnnotatorWithAllLanguages()
{
for( Language lang: Language.getRegisteredLanguages() )
{
LanguageAnnotators.INSTANCE.addExplicitExtension( lang, new ManifoldPsiClassAnnotator() );
}
}
示例4: setUp
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
final LocalInspectionTool[] tools = configureLocalInspectionTools();
CodeInsightTestFixtureImpl.configureInspections(tools, getProject(), Collections.<String>emptyList(),
getTestRootDisposable());
DaemonCodeAnalyzerImpl daemonCodeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject());
daemonCodeAnalyzer.prepareForTest();
final StartupManagerImpl startupManager = (StartupManagerImpl)StartupManagerEx.getInstanceEx(getProject());
startupManager.runStartupActivities();
startupManager.startCacheUpdate();
startupManager.runPostStartupActivities();
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(false);
if (isPerformanceTest()) {
IntentionManager.getInstance().getAvailableIntentionActions(); // hack to avoid slowdowns in PyExtensionFactory
PathManagerEx.getTestDataPath(); // to cache stuff
ReferenceProvidersRegistry.getInstance(); // pre-load tons of classes
InjectedLanguageManager.getInstance(getProject()); // zillion of Dom Sem classes
LanguageAnnotators.INSTANCE.allForLanguage(JavaLanguage.INSTANCE); // pile of annotator classes loads
LanguageAnnotators.INSTANCE.allForLanguage(StdLanguages.XML);
ProblemHighlightFilter.EP_NAME.getExtensions();
Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
Extensions.getExtensions(XmlSchemaProvider.EP_NAME);
Extensions.getExtensions(XmlFileNSInfoProvider.EP_NAME);
Extensions.getExtensions(ExternalAnnotatorsFilter.EXTENSION_POINT_NAME);
Extensions.getExtensions(IndexPatternBuilder.EP_NAME);
}
}
示例5: setUp
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
Disposer.register(my, BlockExtensions.create(Extensions.getRootArea().getExtensionPoint(LanguageAnnotators.EP_NAME)));
Disposer.register(my, BlockExtensions.create(Extensions.getRootArea().getExtensionPoint(LineMarkerProviders.EP_NAME)));
Disposer.register(my, BlockExtensions.create(Extensions.getArea(getProject()).getExtensionPoint(JavaConcatenationInjectorManager.CONCATENATION_INJECTOR_EP_NAME)));
Disposer.register(my, BlockExtensions.create(Extensions.getArea(getProject()).getExtensionPoint(MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME)));
IntentionManager.getInstance().getAvailableIntentionActions(); // hack to avoid slowdowns in PyExtensionFactory
PathManagerEx.getTestDataPath(); // to cache stuff
}
示例6: testAnnotator
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
public void testAnnotator() throws Exception {
Annotator annotator = new MyAnnotator();
Language javaLanguage = StdFileTypes.JAVA.getLanguage();
LanguageAnnotators.INSTANCE.addExplicitExtension(javaLanguage, annotator);
enableInspectionTool(new DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection());
try {
doAllTests();
}
finally {
LanguageAnnotators.INSTANCE.removeExplicitExtension(javaLanguage, annotator);
}
}
示例7: ApplicationEnvironment
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
appEnvironment.registerFileType(PropertiesFileType.INSTANCE, "properties");
appEnvironment.addExplicitExtension(SyntaxHighlighterFactory.LANGUAGE_FACTORY, PropertiesLanguage.INSTANCE,
new PropertiesSyntaxHighlighterFactory());
appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesParserDefinition());
appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlPropertiesIndex());
appEnvironment.addExtension(StubIndexExtension.EP_NAME, new PropertyKeyIndex());
appEnvironment.registerApplicationService(PropertiesQuickFixFactory.class, new EmptyPropertiesQuickFixFactory());
appEnvironment.registerApplicationService(PropertiesRefactoringSettings.class, new PropertiesRefactoringSettings());
appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesAnnotator());
appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFindUsagesProvider());
appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesASTFactory());
appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFoldingBuilder());
appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyImpl.class, new PropertyManipulator());
appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyKeyImpl.class, new PropertyKeyManipulator());
appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyValueImpl.class, new PropertyValueManipulator());
final StubElementTypeHolderEP stubElementTypeHolderBean = new StubElementTypeHolderEP();
stubElementTypeHolderBean.holderClass = PropertiesElementTypes.class.getName();
appEnvironment.addExtension(StubElementTypeHolderEP.EP_NAME, stubElementTypeHolderBean);
appEnvironment.addExplicitExtension(LanguageCommenters.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesCommenter());
appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesIdIndexer());
appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesTodoIndexer());
appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME, new XmlPropertiesIconProvider());
}
示例8: getAnnotationsAtCaret
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
@NotNull
private AnnotationHolderImpl getAnnotationsAtCaret(String filename, String content) {
PsiFile psiFile = myFixture.configureByText(filename, content);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
AnnotationHolderImpl annotations = new AnnotationHolderImpl(new AnnotationSession(psiFile));
for (Annotator annotator : LanguageAnnotators.INSTANCE.allForLanguage(psiFile.getLanguage())) {
annotator.annotate(psiElement, annotations);
}
return annotations;
}
开发者ID:Haehnchen,项目名称:idea-php-shopware-plugin,代码行数:14,代码来源:ShopwareLightCodeInsightFixtureTestCase.java
示例9: doTestNoFix
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
private void doTestNoFix(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings, String... additionalFiles) throws Exception {
myFixture.configureByFiles(ArrayUtil.mergeArrays(new String[]{getTestName(false) + ".hx"}, additionalFiles));
final HaxeTypeAnnotator annotator = new HaxeTypeAnnotator();
LanguageAnnotators.INSTANCE.addExplicitExtension(HaxeLanguage.INSTANCE, annotator);
myFixture.enableInspections(getAnnotatorBasedInspection());
myFixture.testHighlighting(true, false, true);
}
示例10: doTestNoFix
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
private void doTestNoFix(boolean checkWarnings, boolean checkInfos, boolean checkWeakWarnings) throws Exception {
boolean old = HaxeSemanticAnnotatorConfig.ENABLE_EXPERIMENTAL_BODY_CHECK;
HaxeSemanticAnnotatorConfig.ENABLE_EXPERIMENTAL_BODY_CHECK = true;
myFixture.configureByFiles(getTestName(false) + ".hx");
final HaxeTypeAnnotator annotator = new HaxeTypeAnnotator();
LanguageAnnotators.INSTANCE.addExplicitExtension(HaxeLanguage.INSTANCE, annotator);
myFixture.enableInspections(getAnnotatorBasedInspection());
myFixture.testHighlighting(true, false, false);
HaxeSemanticAnnotatorConfig.ENABLE_EXPERIMENTAL_BODY_CHECK = old;
}
示例11: doTest
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
private void doTest(String... additionalPaths) throws Exception {
final String[] paths = ArrayUtil.append(additionalPaths, getTestName(false) + ".hx");
myFixture.configureByFiles(ArrayUtil.reverseArray(paths));
final HaxeTypeAnnotator annotator = new HaxeTypeAnnotator();
LanguageAnnotators.INSTANCE.addExplicitExtension(HaxeLanguage.INSTANCE, annotator);
myFixture.enableInspections(new DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection());
try {
myFixture.testHighlighting(true, true, true, myFixture.getFile().getVirtualFile());
}
finally {
LanguageAnnotators.INSTANCE.removeExplicitExtension(HaxeLanguage.INSTANCE, annotator);
}
}
示例12: setUp
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
Disposer.register(my, BlockExtensions.create(Extensions.getRootArea().getExtensionPoint(LanguageAnnotators.EP_NAME)));
Disposer.register(my, BlockExtensions.create(Extensions.getRootArea().getExtensionPoint(LineMarkerProviders.EP_NAME)));
Disposer.register(my, BlockExtensions.create(Extensions.getArea(getProject()).getExtensionPoint(JavaConcatenationInjectorManager.CONCATENATION_INJECTOR_EP_NAME)));
Disposer.register(my, BlockExtensions.create(Extensions.getArea(getProject()).getExtensionPoint(MultiHostInjector.EP_NAME)));
IntentionManager.getInstance().getAvailableIntentionActions(); // hack to avoid slowdowns in PyExtensionFactory
}
示例13: testAnnotator
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
public void testAnnotator() throws Exception {
Annotator annotator = new MyAnnotator();
Language javaLanguage = JavaFileType.INSTANCE.getLanguage();
LanguageAnnotators.INSTANCE.addExplicitExtension(javaLanguage, annotator);
enableInspectionTool(new DefaultHighlightVisitorBasedInspection.AnnotatorBasedInspection());
try {
doAllTests();
}
finally {
LanguageAnnotators.INSTANCE.removeExplicitExtension(javaLanguage, annotator);
}
}
示例14: initialValue
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
@NotNull
@Override
public Collection<Annotator> initialValue(@NotNull String languageId) {
Language language = Language.findLanguageByID(languageId);
return language == null ? ContainerUtil.<Annotator>emptyList() : LanguageAnnotators.INSTANCE.allForLanguage(language);
}
示例15: initialValue
import com.intellij.lang.LanguageAnnotators; //导入依赖的package包/类
@NotNull
@Override
public Collection<Annotator> initialValue(@NotNull Language key) {
return LanguageAnnotators.INSTANCE.allForLanguage(key);
}