use of com.perl5.lang.perl.idea.intellilang.PerlInjectionMarkersService in project Perl5-IDEA by Camelcade.
the class PerlStringCompletionUtil method fillWithInjectableMarkers.
public static void fillWithInjectableMarkers(@NotNull PerlCompletionProcessor completionProcessor) {
// injectable markers
PerlInjectionMarkersService injectionService = PerlInjectionMarkersService.getInstance(completionProcessor.getProject());
for (String marker : injectionService.getSupportedMarkers()) {
if (!completionProcessor.matches(marker)) {
continue;
}
Language language = injectionService.getLanguageByMarker(marker);
if (language == null) {
continue;
}
LookupElementBuilder newItem = LookupElementBuilder.create(marker).withTypeText("inject with " + language.getDisplayName(), true);
if (language.getAssociatedFileType() != null) {
newItem = newItem.withIcon(language.getAssociatedFileType().getIcon());
}
if (!completionProcessor.process(newItem)) {
return;
}
}
}
use of com.perl5.lang.perl.idea.intellilang.PerlInjectionMarkersService in project Perl5-IDEA by Camelcade.
the class PerlInjectionMarkersTest method doFileTest.
private void doFileTest() {
PerlInjectionMarkersService markersService = PerlInjectionMarkersService.getInstance(getProject());
initWithFileSmartWithoutErrors();
assertNotInjected();
markersService.setCustomMarkersMap(ContainerUtil.newHashMap(Pair.create(TEST_MARKER, HTMLLanguage.INSTANCE.getID())));
FileContentUtil.reparseOpenedFiles();
initWithFileSmartWithoutErrors();
assertInjected();
}
use of com.perl5.lang.perl.idea.intellilang.PerlInjectionMarkersService in project Perl5-IDEA by Camelcade.
the class PerlInjectionMarkersTest method testCustomMarkerAddition.
@Test
public void testCustomMarkerAddition() {
PerlInjectionMarkersService markersService = PerlInjectionMarkersService.getInstance(getProject());
assertNull(markersService.getLanguageByMarker(TEST_MARKER));
markersService.setCustomMarkersMap(ContainerUtil.newHashMap(Pair.create(TEST_MARKER, HTMLLanguage.INSTANCE.getID())));
assertEquals(HTMLLanguage.INSTANCE, markersService.getLanguageByMarker(TEST_MARKER));
}
use of com.perl5.lang.perl.idea.intellilang.PerlInjectionMarkersService in project Perl5-IDEA by Camelcade.
the class PerlInjectionMarkersTest method testMarkerOverride.
@Test
public void testMarkerOverride() {
PerlInjectionMarkersService markersService = PerlInjectionMarkersService.getInstance(getProject());
assertEquals(PerlLanguage.INSTANCE, markersService.getLanguageByMarker(PERL5_MARKER));
markersService.setCustomMarkersMap(ContainerUtil.newHashMap(Pair.create(PERL5_MARKER, HTMLLanguage.INSTANCE.getID())));
assertEquals(HTMLLanguage.INSTANCE, markersService.getLanguageByMarker(PERL5_MARKER));
markersService.setCustomMarkersMap(Collections.emptyMap());
assertEquals(PerlLanguage.INSTANCE, markersService.getLanguageByMarker(PERL5_MARKER));
}
use of com.perl5.lang.perl.idea.intellilang.PerlInjectionMarkersService in project Perl5-IDEA by Camelcade.
the class PerlInjectionMarkersTest method testMarkerCompletion.
@Test
public void testMarkerCompletion() {
PerlInjectionMarkersService markersService = PerlInjectionMarkersService.getInstance(getProject());
markersService.setCustomMarkersMap(ContainerUtil.newHashMap(Pair.create(TEST_MARKER, HTMLLanguage.INSTANCE.getID())));
doTestCompletion();
}
Aggregations