Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
23,700
InjInfo (final BaseInjection injection) { final InjInfo info = new InjInfo(injection, this, false); injectionInfos.add(info); return info; }
addInjection
23,701
boolean () { final List<BaseInjection> copy = new ArrayList<>(getInjectionList(injectionInfos)); sortInjections(copy); return !originalInjections.equals(copy); }
isModified
23,702
void (final List<? extends BaseInjection> originalInjections, final List<? extends BaseInjection> newInjections) { for (Iterator<InjInfo> it = injectionInfos.iterator(); it.hasNext(); ) { final InjInfo info = it.next(); if (originalInjections.contains(info.injection)) it.remove(); } for (BaseInjection newInjection : ne...
replace
23,703
int (@Nullable BaseInjection object) { return object == null ? null : object.hashCode(); }
hashCode
23,704
boolean (@Nullable BaseInjection o1, @Nullable BaseInjection o2) { return o1 == o2 || (o1 != null && o2 != null && o1.sameLanguageParameters(o2) && Arrays.equals(o1.getInjectionPlaces(), o2.getInjectionPlaces())); }
equals
23,705
record (BaseInjection injection, CfgInfo cfgInfo, boolean bundled) { @Override public boolean equals(Object obj) { return this == obj; } @Override public int hashCode() { return System.identityHashCode(this); } }
InjInfo
23,706
boolean (Object obj) { return this == obj; }
equals
23,707
int () { return System.identityHashCode(this); }
hashCode
23,708
List<InjInfo> (final CfgInfo[] infos) { return ContainerUtil.concat(infos, cfgInfo -> cfgInfo.injectionInfos); }
getInjInfoList
23,709
List<BaseInjection> (final List<InjInfo> list) { return new AbstractList<>() { @Override public BaseInjection get(final int index) { return list.get(index).injection; } @Override public int size() { return list.size(); } }; }
getInjectionList
23,710
BaseInjection (final int index) { return list.get(index).injection; }
get
23,711
int () { return list.size(); }
size
23,712
String () { return myTarget; }
getPattern
23,713
boolean (@NotNull String what) { return myTarget.matcher(StringPattern.newBombedCharSequence(what)).matches(); }
matches
23,714
String () { return myTarget.pattern(); }
getPattern
23,715
boolean (@NotNull String what) { return myTarget.equals(what); }
matches
23,716
boolean (@NotNull String what) { return what.startsWith(myTarget); }
matches
23,717
String () { return super.getPattern() + ".*"; }
getPattern
23,718
boolean (@NotNull String what) { return what.endsWith(myTarget); }
matches
23,719
String () { return ".*" + super.getPattern(); }
getPattern
23,720
boolean (@NotNull String what) { return what.contains(myTarget); }
matches
23,721
String () { return ".*" + super.getPattern() + ".*"; }
getPattern
23,722
boolean (@NotNull String what) { return myMatches; }
matches
23,723
boolean (@NotNull String what) { return myTarget.matches(StringUtil.toLowerCase(what)); }
matches
23,724
String () { return "(?i)" + myTarget.getPattern(); }
getPattern
23,725
String () { return myTarget.getPattern(); }
getPattern
23,726
StringMatcher (Set<StringMatcher> matchers) { final MatcherSet m = new MatcherSet(matchers); return matchers.size() > 3 ? new Cache(m) : m; }
create
23,727
boolean (@NotNull String what) { for (StringMatcher matcher : myTarget) { if (matcher.matches(what)) { return true; } } return false; }
matches
23,728
String () { return myPattern; }
getPattern
23,729
StringMatcher (String target) { if (target.length() == 0) return ANY; if (target.equals(".*")) return ANY_PATTERN; if (target.equals(NONE.getPattern())) return NONE; final List<String> branches = StringUtil.split(target,"|"); final Set<StringMatcher> matchers = new LinkedHashSet<>(); for (String branch : branches) { bo...
create
23,730
boolean (String target) { for (int i = 0; i < target.length(); i++) { final char c = target.charAt(i); if (c != '_' && c != '-' && !Character.isLetterOrDigit(c)) { return false; } } return true; }
analyseBranch
23,731
int () { return myTarget.hashCode(); }
hashCode
23,732
boolean (Object obj) { if (obj == null) return false; if (obj.getClass() != getClass()) return false; return ((StringMatcher<?>)obj).myTarget.equals(myTarget); }
equals
23,733
Set<String> (Project project, @NotNull String regExp) { final PsiFileFactory factory = PsiFileFactory.getInstance(project); final PsiFile file = factory.createFileFromText("dummy.regexp", RegExpFileType.INSTANCE, regExp); final RegExpPattern pattern = (RegExpPattern)file.getFirstChild(); if (pattern == null) { return n...
getEnumValues
23,734
boolean (RegExpBranch branch) { final RegExpAtom[] atoms = branch.getAtoms(); for (RegExpAtom atom : atoms) { if (!(atom instanceof RegExpChar) || ((RegExpChar)atom).getValue() == -1) { return false; } else if (((RegExpChar)atom).getType() != RegExpChar.Type.CHAR) { // this could probably allow more, such as escape seq...
analyzeBranch
23,735
String () { return "file-reference"; }
getId
23,736
String () { return IntelliLangBundle.message("reference.injection.display.name.file.reference"); }
getDisplayName
23,737
PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new InjectedReferencesVisitor(holder); }
buildVisitor
23,738
void (@NotNull PsiElement element) { PsiReference[] injected = InjectedReferencesContributor.getInjectedReferences(element); if (injected != null) { for (PsiReference reference : injected) { if (reference.resolve() == null) { TextRange range = reference.getRangeInElement(); if (range.isEmpty() && range.getStartOffset()...
visitElement
23,739
boolean (@Nullable PsiReference reference) { if (reference == null) return false; return getInjectedReferences(reference.getElement()) != null; }
isInjected
23,740
void (@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PlatformPatterns.psiElement(), new PsiReferenceProvider() { @Override public PsiReference @NotNull [] getReferencesByElement(@NotNull final PsiElement element, @NotNull final ProcessingContext context) { return getInjectionInfo(elemen...
registerReferenceProviders
23,741
boolean (@NotNull PsiElement element, PsiReferenceService.@NotNull Hints hints) { if (hints == PsiReferenceService.Hints.HIGHLIGHTED_REFERENCES) { return false; } return super.acceptsHints(element, hints); }
acceptsHints
23,742
void (@NotNull ReferenceInjector injector, @NotNull List<? extends PsiLanguageInjectionHost.Shred> places) { injected.set(Boolean.TRUE); element.putUserData(LanguageInjectionSupport.INJECTOR_SUPPORT, registry.getLanguageInjectionSupport()); for (PsiLanguageInjectionHost.Shred place : places) { if (place.getHost() == el...
visitInjectedReference
23,743
Language (@NotNull BaseInjection injection) { return getLanguageByString(injection.getInjectedLanguageId()); }
getLanguage
23,744
Language (@NotNull String languageId) { Language language = InjectedLanguage.findLanguageById(languageId); if (language != null) return language; ReferenceInjector injector = ReferenceInjector.findById(languageId); if (injector != null) return injector.toLanguage(); FileTypeManager fileTypeManager = FileTypeManager.get...
getLanguageByString
23,745
boolean (@NotNull PsiLanguageInjectionHost host, @NotNull BaseInjection injection, @Nullable LanguageInjectionSupport support, @NotNull MultiHostRegistrar registrar) { Language language = getLanguage(injection); if (language == null) return false; InjectedLanguage injectedLanguage = InjectedLanguage.create(injection.ge...
registerInjectionSimple
23,746
record (@NotNull PsiLanguageInjectionHost host, @NotNull InjectedLanguage language, @NotNull TextRange range) { }
InjectionInfo
23,747
void (@Nullable Language language, @NotNull List<? extends Trinity<PsiLanguageInjectionHost, InjectedLanguage, TextRange>> list, @NotNull PsiFile containingFile, @NotNull MultiHostRegistrar registrar) { registerInjection(language, containingFile, ContainerUtil.map(list, trinity -> new InjectionInfo(trinity.first, trini...
registerInjection
23,748
void (@Nullable Language language, @NotNull PsiFile containingFile, @NotNull List<InjectionInfo> list, @NotNull MultiHostRegistrar registrar) { // if language isn't injected when length == 0, subsequent edits will not cause the language to be injected as well. // Maybe IDEA core is caching a bit too aggressively here? ...
registerInjection
23,749
Collection<String> () { return ContainerUtil.map(LanguageInjectionSupport.EP_NAME.getExtensionList(), LanguageInjectionSupport::getId); }
getActiveInjectionSupportIds
23,750
Collection<LanguageInjectionSupport> () { return LanguageInjectionSupport.EP_NAME.getExtensionList(); }
getActiveInjectionSupports
23,751
LanguageInjectionSupport (@NotNull String id) { if (TemporaryPlacesRegistry.SUPPORT_ID.equals(id)) return new TemporaryLanguageInjectionSupport(); for (LanguageInjectionSupport support : LanguageInjectionSupport.EP_NAME.getExtensionList()) { if (id.equals(support.getId())) return support; } return null; }
findInjectionSupport
23,752
LanguageInjectionSupport (@NotNull String id) { LanguageInjectionSupport result = findInjectionSupport(id); if (result == null) { throw new IllegalStateException(id + " injector not found"); } return result; }
findNotNullInjectionSupport
23,753
StringBuilder (@NotNull StringBuilder sb, @NotNull String prefix, @NotNull String text, @NotNull String suffix) { sb.append(prefix).append("string()."); final String[] parts = text.split("[,|\\s]+"); boolean useMatches = false; for (String part : parts) { if (isRegexp(part)) { useMatches = true; break; } } if (useMatch...
appendStringPattern
23,754
boolean (@NotNull String s) { boolean hasReChars = false; for (int i = 0, len = s.length(); i < len; i++) { final char c = s.charAt(i); if (c == ' ' || c == '_' || c == '-' || Character.isLetterOrDigit(c)) continue; hasReChars = true; break; } if (hasReChars) { try { //noinspection ResultOfObjectAllocationIgnored new U...
isRegexp
23,755
void (@NotNull LanguageInjectionSupport support, boolean settingsAvailable, @NotNull PsiElement element, @NotNull Language language) { putInjectedFileUserData(element, language, LanguageInjectionSupport.INJECTOR_SUPPORT, support); if (settingsAvailable) { putInjectedFileUserData(element, language, LanguageInjectionSupp...
registerSupport
23,756
Configuration (@NotNull Project project) { return Configuration.getInstance(); }
getEditableInstance
23,757
boolean (@NotNull BaseInjection injection) { if (injection.isEnabled()) return false; if (StringUtil.isNotEmpty(injection.getPrefix()) || StringUtil.isNotEmpty(injection.getSuffix())) return false; if (StringUtil.isNotEmpty(injection.getValuePattern())) return false; return true; }
canBeRemoved
23,758
CommentInjectionData (@NotNull PsiElement context, @Nullable Ref<? super PsiElement> causeRef) { return findCommentInjectionData(context, true, causeRef); }
findCommentInjectionData
23,759
CommentInjectionData (@NotNull PsiElement context, boolean treeElementsIncludeComment, @Nullable Ref<? super PsiElement> causeRef) { PsiElement target = CompletionUtil.getOriginalOrSelf(context); Pair.NonNull<PsiComment, CommentInjectionData> pair = findClosestCommentInjectionData(target); if (pair == null) return null...
findCommentInjectionData
23,760
BaseInjection (@NotNull PsiElement context, @NotNull String supportId, @Nullable Ref<? super PsiElement> causeRef) { CommentInjectionData data = findCommentInjectionData(context, causeRef); if (data == null) return null; BaseInjection injection = new BaseInjection(supportId); injection.setPrefix(data.getPrefix()); inje...
findCommentInjection
23,761
Supplier<PsiElement> (@NotNull PsiElement element, @NotNull PsiElement scope) { return new Supplier<>() { PsiElement e = element; @Nullable @Override public PsiElement get() { if (e == null || e == scope) return null; PsiElement prev = e.getPrevSibling(); if (prev != null) { return e = PsiTreeUtil.getDeepestLast(prev);...
prevWalker
23,762
PsiElement () { if (e == null || e == scope) return null; PsiElement prev = e.getPrevSibling(); if (prev != null) { return e = PsiTreeUtil.getDeepestLast(prev); } else { PsiElement parent = e.getParent(); return e = parent == scope || parent instanceof PsiFile ? null : parent; } }
get
23,763
String () { return ObjectUtils.notNull(myMap.get("prefix"), ""); }
getPrefix
23,764
String () { return ObjectUtils.notNull(myMap.get("suffix"), ""); }
getSuffix
23,765
String () { return ObjectUtils.notNull(myMap.get("language"), ""); }
getInjectedLanguageId
23,766
String () { return myDisplayName; }
getDisplayName
23,767
String () { return IntelliLangBundle.message("intention.name.language.injection.settings"); }
getText
23,768
String () { return IntelliLangBundle.message("intention.family.name.edit.injection.settings"); }
getFamilyName
23,769
boolean (@NotNull Project project, Editor editor, PsiFile file) { final int offset = editor.getCaretModel().getOffset(); final PsiFile psiFile = InjectedLanguageUtil.findInjectedPsiNoCommit(file, offset); if (psiFile == null) return false; final LanguageInjectionSupport support = psiFile.getUserData(LanguageInjectionSu...
isAvailable
23,770
void (@NotNull Project project, Editor editor, PsiFile file) { final PsiFile psiFile = InjectedLanguageUtil.findInjectedPsiNoCommit(file, editor.getCaretModel().getOffset()); if (psiFile == null) return; final PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(project).getInjectionHost(psiFile); if (ho...
invokeImpl
23,771
boolean () { return false; }
startInWriteAction
23,772
Injection (@NotNull PsiElement context) { if (!(context instanceof PsiLanguageInjectionHost host) || !((PsiLanguageInjectionHost)context).isValidHost()) return null; for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { if (!support.isApplicableTo(host)) continue; if (!support.useDefault...
getInjection
23,773
String () { return myID; }
getID
23,774
Language () { return findLanguageById(myID); }
getLanguage
23,775
String () { return myPrefix; }
getPrefix
23,776
String () { return mySuffix; }
getSuffix
23,777
boolean () { return myDynamic; }
isDynamic
23,778
Language (@Nullable String langID) { if (langID == null || langID.isEmpty()) { return null; } synchronized (InjectedLanguage.class) { if (ourLanguageCache == null || ourLanguageCount != Language.getRegisteredLanguages().size()) { initLanguageCache(); } return ourLanguageCache.get(langID); } }
findLanguageById
23,779
void () { ourLanguageCache = ContainerUtil.createWeakValueMap(); Collection<Language> registeredLanguages; do { registeredLanguages = new ArrayList<>(Language.getRegisteredLanguages()); for (Language language : registeredLanguages) { if (LanguageUtil.isInjectableLanguage(language)) { String languageID = language.getID(...
initLanguageCache
23,780
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final InjectedLanguage that = (InjectedLanguage)o; return myID.equals(that.myID); }
equals
23,781
int () { return myID.hashCode(); }
hashCode
23,782
InjectedLanguage (String id) { return create(id, "", "", false); }
create
23,783
InjectedLanguage (@Nullable String id, String prefix, String suffix, boolean isDynamic) { return id == null ? null : new InjectedLanguage(id, prefix == null ? "" : prefix, suffix == null ? "" : suffix, isDynamic); }
create
23,784
String () { return IntelliLangBundle.message("intelliLang.uninject.language.action.text"); }
getText
23,785
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { return new IntentionPreviewInfo.Html(IntelliLangBundle.message("intelliLang.uninject.language.action.preview")); }
generatePreview
23,786
String () { return getText(); }
getFamilyName
23,787
boolean (@NotNull Project project, Editor editor, PsiFile file) { final int offset = editor.getCaretModel().getOffset(); PsiElement element = InjectedLanguageUtil.findInjectedPsiNoCommit(file, offset); if (element == null) { return InjectedReferencesContributor.isInjected(file.findReferenceAt(offset)); } return element...
isAvailable
23,788
void (Project project, Editor editor, PsiFile file) { int offset = editor.getCaretModel().getOffset(); final PsiFile psiFile = InjectedLanguageUtil.findInjectedPsiNoCommit(file, offset); if (psiFile == null) { PsiReference reference = file.findReferenceAt(offset); if (reference == null) return; if (reference.getElement...
invokeImpl
23,789
boolean (final PsiLanguageInjectionHost host) { Set<String> languages = new HashSet<>(); List<Pair<PsiElement, TextRange>> files = InjectedLanguageManager.getInstance(host.getProject()).getInjectedPsiFiles(host); if (files == null) return false; for (Pair<PsiElement, TextRange> pair : files) { for (Language lang = pair...
defaultFunctionalityWorked
23,790
boolean () { return false; }
startInWriteAction
23,791
boolean () { return handler.process(pointer.getElement()); }
execute
23,792
List<Injectable> () { Language[] languages = InjectedLanguage.getAvailableLanguages(); List<Injectable> list = new ArrayList<>(); for (Language language : languages) { list.add(Injectable.fromLanguage(language)); } list.addAll(ReferenceInjector.EXTENSION_POINT_NAME.getExtensionList()); Collections.sort(list); return li...
getAllInjectables
23,793
String () { return IntelliLangBundle.message("intelliLang.inject.language.action.text"); }
getText
23,794
String () { return getText(); }
getFamilyName
23,795
boolean (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiLanguageInjectionHost host = findInjectionHost(editor, file); if (host == null) return false; if (!InjectionUtils.isInjectLanguageActionEnabled(host)) return false; List<Pair<PsiElement, TextRange>> injectedPsi = InjectedLanguageMana...
isAvailable
23,796
IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiLanguageInjectionHost host = findInjectionHost(editor, file); if (host == null) return IntentionPreviewInfo.EMPTY; String text = StringUtil.shortenTextWithEllipsis(ElementManipulators.getValueText(host), 40, 10); return ...
generatePreview
23,797
PsiLanguageInjectionHost (@NotNull Editor editor, @NotNull PsiFile file) { if (editor instanceof EditorWindow) return null; int offset = editor.getCaretModel().getOffset(); PsiLanguageInjectionHost fileLanguageHost = PsiTreeUtil.getParentOfType(file.findElementAt(offset), PsiLanguageInjectionHost.class, false); if (fil...
findInjectionHost
23,798
void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull Injectable injectable) { invokeImpl(project, editor, file, injectable, DEFAULT_FIX_PRESENTER); }
invokeImpl
23,799
void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull Injectable injectable, @NotNull FixPresenter fixPresenter) { PsiLanguageInjectionHost host = findInjectionHost(editor, file); if (host == null) return; if (defaultFunctionalityWorked(host, injectable.getId())) return; try { host.put...
invokeImpl