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 : newInjections) { injectionInfos.add(new InjInfo(newInjection, this, false)); } } | 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) { boolean startsWith = false; boolean endsWith = false; boolean ignoreCase = false; // this assumes the regex is syntactically correct if (branch.startsWith("(?i)")) { ignoreCase = true; branch = StringUtil.toLowerCase(branch.substring(2)); } if (branch.endsWith(".*")) { startsWith = true; branch = branch.substring(0, branch.length() - 2); } if (branch.startsWith(".*")) { endsWith = true; branch = branch.substring(2); } final boolean m = analyseBranch(branch); if (!m) { try { return new Cache(new Pattern(target)); } catch (Exception e) { return new Any(target, false); } } final StringMatcher matcher; if (startsWith && endsWith) { matcher = new Contains(branch); } else if (startsWith) { matcher = new StartsWith(branch); } else if (endsWith) { matcher = new EndsWith(branch); } else { matcher = new Equals(branch); } matchers.add(ignoreCase ? new IgnoreCase(matcher) : matcher); } return matchers.size() == 1 ? matchers.iterator().next() : MatcherSet.create(matchers); } | 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 null; } final RegExpBranch[] branches = pattern.getBranches(); final Set<String> values = new HashSet<>(); for (RegExpBranch branch : branches) { if (analyzeBranch(branch)) { values.add(branch.getUnescapedText()); } } return values; } | 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 sequences return false; } } return true; } | 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() == 1 && "\"\"".equals(element.getText())) { String message = ProblemsHolder.unresolvedReferenceMessage(reference); myHolder.registerProblem(element, message, ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, TextRange.create(0, 2)); } else { myHolder.registerProblem(reference); } } } } super.visitElement(element); } | 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(element).first; } @Override public boolean acceptsHints(@NotNull PsiElement element, PsiReferenceService.@NotNull Hints hints) { if (hints == PsiReferenceService.Hints.HIGHLIGHTED_REFERENCES) { return false; } return super.acceptsHints(element, hints); } }); } | 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() == element) { references.addAll(Arrays.asList(injector.getReferences(element, context, place.getRangeInsideHost()))); } } } | 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.getInstance(); FileType fileType = fileTypeManager.getFileTypeByExtension(languageId); if (fileType instanceof LanguageFileType) { return ((LanguageFileType)fileType).getLanguage(); } LightVirtualFile virtualFileNamedAsLanguageId = new LightVirtualFile(languageId); LightVirtualFile virtualFileWithLanguageIdAsExtension = new LightVirtualFile("textmate." + languageId); for (FileType registeredFileType : fileTypeManager.getRegisteredFileTypes()) { if (registeredFileType instanceof FileTypeIdentifiableByVirtualFile && registeredFileType instanceof LanguageFileType && (((FileTypeIdentifiableByVirtualFile)registeredFileType).isMyFileType(virtualFileNamedAsLanguageId) || ((FileTypeIdentifiableByVirtualFile)registeredFileType).isMyFileType(virtualFileWithLanguageIdAsExtension))) { return ((LanguageFileType)registeredFileType).getLanguage(); } } return null; } | 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.getInjectedLanguageId(), injection.getPrefix(), injection.getSuffix(), false); List<TextRange> ranges = injection.getInjectedArea(host); List<InjectionInfo> list = new ArrayList<>(ranges.size()); for (TextRange range : ranges) { list.add(new InjectionInfo(host, injectedLanguage, range)); } registerInjection(language, host.getContainingFile(), list, registrar); if (support != null) { registerSupport(support, true, host, language); } return !ranges.isEmpty(); } | 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, trinity.second, trinity.third)), registrar); } | 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? if (language == null/* && (pair.second.getLength() > 0*/) { return; } ParserDefinition parser = LanguageParserDefinitions.INSTANCE.forLanguage(language); ReferenceInjector injector = ReferenceInjector.findById(language.getID()); if (parser == null && injector != null) { for (InjectionInfo trinity : list) { String prefix = trinity.language().getPrefix(); String suffix = trinity.language().getSuffix(); PsiLanguageInjectionHost host = trinity.host(); TextRange textRange = trinity.range(); InjectedLanguageUtil.injectReference(registrar, language, prefix, suffix, host, textRange); return; } return; } boolean injectionStarted = false; for (InjectionInfo t : list) { PsiLanguageInjectionHost host = t.host(); if (host.getContainingFile() != containingFile || !host.isValidHost()) continue; TextRange textRange = t.range(); InjectedLanguage injectedLanguage = t.language(); if (!injectionStarted) { // TextMate language requires file extension if (!StringUtil.equalsIgnoreCase(language.getID(), t.language().getID())) { registrar.startInjecting(language, StringUtil.toLowerCase(t.language().getID())); } else { registrar.startInjecting(language); } injectionStarted = true; } registrar.addPlace(injectedLanguage.getPrefix(), injectedLanguage.getSuffix(), host, textRange); } if (injectionStarted) { registrar.doneInjecting(); } } | 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 (useMatches) { sb.append("matches(\"").append(text).append("\")"); } else if (parts.length > 1) { sb.append("oneOf("); boolean first = true; for (String part : parts) { if (first) first = false; else sb.append(", "); sb.append("\"").append(part).append("\""); } sb.append(")"); } else { sb.append("equalTo(\"").append(text).append("\")"); } sb.append(suffix); return sb; } | 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 URL(s); } catch (MalformedURLException e) { return true; } } return false; } | 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, LanguageInjectionSupport.SETTINGS_EDITOR, support); } } | 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; PsiComment psiComment = pair.first; CommentInjectionData injectionData = pair.second; TextRange r0 = psiComment.getTextRange(); // calculate topmost siblings & heights PsiElement commonParent = PsiTreeUtil.findCommonParent(psiComment, target); if (commonParent == null) return null; PsiElement topmostElement = target; PsiElement parent = target; while (parent != null && (treeElementsIncludeComment ? parent : parent.getParent()) != commonParent) { topmostElement = parent; parent = parent.getParent(); } // make sure comment is close enough and ... int off1 = r0.getEndOffset(); int off2 = topmostElement.getTextRange().getStartOffset(); if (off2 - off1 > 120) { return null; } if (off2 - off1 > 2) { // ... there's no non-empty valid host in between comment and topmostElement Supplier<PsiElement> producer = prevWalker(topmostElement, commonParent); PsiElement e; while ( (e = producer.get()) != null && e != psiComment) { if (e instanceof PsiLanguageInjectionHost && ((PsiLanguageInjectionHost)e).isValidHost() && !StringUtil.isEmptyOrSpaces(e.getText())) { return null; } } } if (causeRef != null) { causeRef.set(psiComment); } return injectionData; } | 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()); injection.setSuffix(data.getSuffix()); injection.setInjectedLanguageId(data.getInjectedLanguageId()); injection.setDisplayName(data.getDisplayName()); return injection; } | 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); } else { PsiElement parent = e.getParent(); return e = parent == scope || parent instanceof PsiFile ? null : parent; } } }; } | 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(LanguageInjectionSupport.SETTINGS_EDITOR); return support != null; } | 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 (host == null) return; final LanguageInjectionSupport support = psiFile.getUserData(LanguageInjectionSupport.SETTINGS_EDITOR); if (support == null) return; try { if (!support.editInjectionInPlace(host)) { ShowSettingsUtil.getInstance().editConfigurable(project, new InjectionsSettingsUI(project)); } } finally { FileContentUtil.reparseFiles(project, Collections.emptyList(), true); } } | 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.useDefaultInjector(host)) continue; for (BaseInjection injection : Configuration.getProjectInstance(context.getProject()).getInjections(support.getId())) { if (!injection.acceptsPsiElement(host)) continue; return injection; } } return null; } | 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(); ourLanguageCache.put(languageID, language); String lowerCase = languageID.toLowerCase(Locale.ROOT); if (!lowerCase.equals(languageID)) { ourLanguageCache.put(lowerCase, language); } } } } while (Language.getRegisteredLanguages().size() != registeredLanguages.size()); ourLanguageCount = registeredLanguages.size(); } | 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.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT) != null; } | 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() instanceof PsiLanguageInjectionHost host) { for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { if (support.isApplicableTo(host) && support.removeInjectionInPlace(host)) { PsiManager.getInstance(project).dropPsiCaches(); return; } } } PsiElement element = reference.getElement(); LanguageInjectionSupport support = element.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); if (support != null) { if (support.removeInjection(element)) { PsiManager.getInstance(project).dropPsiCaches(); } } return; } final PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(project).getInjectionHost(psiFile); if (host == null) return; final LanguageInjectionSupport support = psiFile.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); if (support == null) return; try { if (!support.removeInjectionInPlace(host)) { defaultFunctionalityWorked(host); } } finally { FileContentUtil.reparseFiles(project, Collections.emptyList(), true); } } | 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.first.getLanguage(); lang != null; lang = lang.getBaseLanguage()) { languages.add(lang.getID()); } } // todo there is a problem: host i.e. literal expression is confused with "target" i.e. parameter // todo therefore this part doesn't work for java return Configuration.getProjectInstance(host.getProject()).setHostInjectionEnabled(host, languages, false); } | 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 list; } | 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 = InjectedLanguageManager.getInstance(project).getInjectedPsiFiles(host); if (injectedPsi == null || injectedPsi.isEmpty()) { return !InjectedReferencesContributor.isInjected(file.findReferenceAt(editor.getCaretModel().getOffset())); } return false; } | 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 new IntentionPreviewInfo.Html(IntelliLangBundle.message("intelliLang.inject.language.action.preview", text)); } | 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 (fileLanguageHost != null && fileLanguageHost.isValidHost()) { return fileLanguageHost; } FileViewProvider vp = file.getViewProvider(); for (Language language : vp.getLanguages()) { PsiLanguageInjectionHost host = PsiTreeUtil.getParentOfType(vp.findElementAt(offset, language), PsiLanguageInjectionHost.class, false); if (host != null && host.isValidHost()) { return host; } } return null; } | 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.putUserData(FIX_KEY, null); Language language = injectable.toLanguage(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { if (support.isApplicableTo(host) && support.addInjectionInPlace(language, host)) { return; } } if (TemporaryPlacesRegistry.getInstance(project).getLanguageInjectionSupport().addInjectionInPlace(language, host)) { Processor<? super PsiLanguageInjectionHost> fixer = host.getUserData(FIX_KEY); String text = IntelliLangBundle.message("intelliLang.temporary.injected", StringUtil.escapeXmlEntities(language.getDisplayName())); if (fixer != null) { SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(host); String fixText = text + "<br>" + ((fixer instanceof MyFixAction) ? ((MyFixAction)fixer).getText() : IntelliLangBundle.message("intelliLang.suggest.insert.annotation")) + " " + KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS)); fixPresenter.showFix(editor, host.getTextRange(), pointer, fixText, host1 -> { List<Pair<PsiElement, TextRange>> files = InjectedLanguageManager.getInstance(project).getInjectedPsiFiles(host1); if (files != null) { for (Pair<PsiElement, TextRange> pair: files) { PsiFile psiFile = (PsiFile)pair.first; LanguageInjectionSupport languageInjectionSupport = psiFile.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); if (languageInjectionSupport != null) { languageInjectionSupport.removeInjectionInPlace(host1); } } } else { LanguageInjectionSupport support = host1.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); if (support != null) { if (support.removeInjection(host)) { host1.getManager().dropPsiCaches(); } } } return fixer.process(host1); }); } else { HintManager.getInstance().showInformationHint(editor, text); } } } finally { if (injectable.getLanguage() != null) { // no need for reference injection FileContentUtil.reparseFiles(project, Collections.emptyList(), true); } else { PsiManager.getInstance(project).dropPsiCaches(); } } } | invokeImpl |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.