Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
69,200
void (@NotNull String dict, ProgressIndicator progressIndicator) { progressIndicator.setText(SpellCheckerBundle.message("dictionary.generator.processing.title", dict)); generateDictionary(myProject, myDict2FolderMap.get(dict), myDictOutputFolder + "/" + dict + ".dic", progressIndicator); }
generate
69,201
void (final Project project, final Collection<VirtualFile> folderPaths, final String outFile, final ProgressIndicator progressIndicator) { final HashSet<String> seenNames = new HashSet<>(); // Collect stuff ApplicationManager.getApplication().runReadAction(() -> { for (VirtualFile folder : folderPaths) { progressIndica...
generateDictionary
69,202
void (final HashSet<String> seenNames, final PsiManager manager, final VirtualFile folder) { VfsUtilCore.visitChildrenRecursively(folder, new VirtualFileVisitor<Void>() { @Override public boolean visitFile(@NotNull VirtualFile file) { ProgressIndicatorProvider.checkCanceled(); if (myExcludedFolders.contains(file)) { re...
processFolder
69,203
boolean (@NotNull VirtualFile file) { ProgressIndicatorProvider.checkCanceled(); if (myExcludedFolders.contains(file)) { return false; } if (!file.isDirectory()) { final PsiFile psiFile = manager.findFile(file); if (psiFile != null) { processFile(psiFile, seenNames); } } return true; }
visitFile
69,204
void (@NotNull final PsiElement element, @NotNull final HashSet<String> seenNames) { final int endOffset = element.getTextRange().getEndOffset(); // collect leafs (spell checker inspection works with leafs) final List<PsiElement> leafs = new ArrayList<>(); if (element.getChildren().length == 0) { // if no children - it...
process
69,205
void (@NotNull final PsiElement leafElement, @NotNull final HashSet<String> seenNames) { final Language language = leafElement.getLanguage(); SpellCheckingInspection.tokenize(leafElement, language, new TokenConsumer() { @Override public void consumeToken(PsiElement element, final String text, boolean useRename, int off...
processLeafsNames
69,206
void (PsiElement element, final String text, boolean useRename, int offset, TextRange rangeToCheck, Splitter splitter) { splitter.split(text, rangeToCheck, textRange -> { final String word = textRange.substring(text); addSeenWord(seenNames, word, language); }); }
consumeToken
69,207
void (HashSet<String> seenNames, String word, Language language) { final String lowerWord = StringUtil.toLowerCase(word); if (globalSeenNames.contains(lowerWord)) { return; } final NamesValidator namesValidator = LanguageNamesValidation.INSTANCE.forLanguage(language); if (namesValidator.isKeyword(word, myProject)) { re...
addSeenWord
69,208
String (@Nullable String word) { if (word == null) return null; word = word.trim(); if (word.length() < 3) { return null; } return StringUtil.toLowerCase(word); }
transform
69,209
Set<String> (@Nullable Collection<String> words) { if (words == null || words.isEmpty()) { return null; } Set<String> result = new HashSet<>(); for (String word : words) { String transformed = transform(word); if (transformed != null) { result.add(transformed); } } return result; }
transform
69,210
String () { return word; }
getWord
69,211
int () { return metrics; }
getMetrics
69,212
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Suggestion result = (Suggestion)o; if (metrics != result.metrics) return false; if (word != null ? !word.equals(result.word) : result.word != null) return false; return true; }
equals
69,213
int () { int result = word != null ? word.hashCode() : 0; result = 31 * result + metrics; return result; }
hashCode
69,214
int (@NotNull Suggestion o) { int c = Integer.compare(getMetrics(), o.getMetrics()); return c != 0 ? c : StringUtil.compare(word, o.word, true); }
compareTo
69,215
String () { return word + " : " + metrics; }
toString
69,216
EditorCustomization () { return ENABLED.getValue(); }
getEnabledCustomization
69,217
EditorCustomization () { return DISABLED.getValue(); }
getDisabledCustomization
69,218
Set<String> () { return SpellCheckingEditorCustomization.getSpellCheckingToolNames(); }
getSpellCheckingToolNames
69,219
boolean () { // It's assumed that default spell checking inspection settings are just fine for processing all types of data. // Please perform corresponding settings tuning if that assumption is broken in the future. Class<LocalInspectionTool>[] inspectionClasses = (Class<LocalInspectionTool>[])new Class<?>[]{SpellChec...
init
69,220
void (@NotNull EditorEx editor) { boolean apply = isEnabled(); if (!READY) { return; } Project project = editor.getProject(); if (project == null) { return; } PsiFile file = ReadAction.compute(() -> PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument())); if (file == null) { return; } Function<? super...
customize
69,221
boolean (@NotNull PsiFile file) { Function<? super InspectionProfile, ? extends InspectionProfileWrapper> strategy = InspectionProfileWrapper.getCustomInspectionProfileWrapper(file); return strategy instanceof MyInspectionProfileStrategy && !((MyInspectionProfileStrategy)strategy).myUseSpellCheck; }
isSpellCheckingDisabled
69,222
Set<String> () { return Collections.unmodifiableSet(SPELL_CHECK_TOOLS.keySet()); }
getSpellCheckingToolNames
69,223
InspectionProfileWrapper (@NotNull InspectionProfile profile) { if (!READY) { return new InspectionProfileWrapper((InspectionProfileImpl)profile); } MyInspectionProfileWrapper wrapper = myWrappers.get(profile); return wrapper == null ? ConcurrencyUtil.cacheOrGet(myWrappers, profile, new MyInspectionProfileWrapper(profi...
apply
69,224
void (boolean useSpellCheck) { myUseSpellCheck = useSpellCheck; }
setUseSpellCheck
69,225
boolean (HighlightDisplayKey key, PsiElement element) { return SPELL_CHECK_TOOLS.containsKey(key.toString()) ? myUseSpellCheck : super.isToolEnabled(key, element); }
isToolEnabled
69,226
void (@NotNull PsiNameIdentifierOwner element, @NotNull TokenConsumer consumer) { PsiElement identifier = element.getNameIdentifier(); if (identifier == null) { return; } PsiElement parent = element; final TextRange range = identifier.getTextRange(); if (range.isEmpty()) return; int offset = range.getStartOffset() - pa...
tokenize
69,227
void (@NotNull PsiElement element, @NotNull TokenConsumer consumer) { CustomFileTypeLexer lexer = new CustomFileTypeLexer(mySyntaxTable); String text = element.getText(); lexer.start(text); while (true) { IElementType tokenType = lexer.getTokenType(); if (tokenType == null) { break; } if (!isKeyword(tokenType)) { consu...
tokenize
69,228
boolean (IElementType tokenType) { return tokenType == CustomHighlighterTokenType.KEYWORD_1 || tokenType == CustomHighlighterTokenType.KEYWORD_2 || tokenType == CustomHighlighterTokenType.KEYWORD_3 || tokenType == CustomHighlighterTokenType.KEYWORD_4; }
isKeyword
69,229
void (@NotNull PsiComment element, @NotNull TokenConsumer consumer) { // doccomment chameleon expands as PsiComment inside PsiComment, avoid duplication if (element.getParent() instanceof PsiComment) return; consumer.consumeToken(element, CommentSplitter.getInstance()); }
tokenize
69,230
String () { return text; }
getText
69,231
T () { return element; }
getElement
69,232
boolean () { return useRename; }
isUseRename
69,233
int () { return offset; }
getOffset
69,234
TextRange () { if (range == null) { range = new TextRange(0, (text != null ? text.length() : 0)); } return range; }
getRange
69,235
void (Consumer<TextRange> consumer) { if (splitter == null || text == null) { return; } splitter.split(text, getRange(), consumer); }
processAreas
69,236
void (PsiElement element, Splitter splitter) { consumeToken(element, false, splitter); }
consumeToken
69,237
void (PsiElement element, boolean useRename, Splitter splitter) { if (element instanceof PsiLanguageInjectionHost && !(element instanceof PsiComment)) { // remove quotes from text analysis TextRange range = ElementManipulators.getValueTextRange(element); if (!range.isEmpty()) { String text = ElementManipulators.getValu...
consumeToken
69,238
String () { return "TokenizerBase(splitter=" + mySplitter + ")"; }
toString
69,239
void (@NotNull T element, @NotNull TokenConsumer consumer) { if (element instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element)) { return; } consumer.consumeToken(element, mySplitter); }
tokenize
69,240
void (PsiElement element, TokenConsumer consumer, StringBuilder unescapedText, int[] offsets, int startOffset) { if (element != null) element.putUserData(ESCAPE_OFFSETS, offsets); final String text = unescapedText.toString(); consumer.consumeToken(element, text, false, startOffset, TextRange.allOf(text), PlainTextSplit...
processTextWithOffsets
69,241
TextRange (PsiElement element, int offset, TextRange range) { final int[] offsets = element.getUserData(ESCAPE_OFFSETS); if (offsets != null) { int start = offsets[range.getStartOffset()]; int end = offsets[range.getEndOffset()]; return new TextRange(offset + start, offset + end); } return super.getHighlightingRange(el...
getHighlightingRange
69,242
TextRange (PsiElement element, int offset, TextRange textRange) { return TextRange.from(offset + textRange.getStartOffset(), textRange.getLength()); }
getHighlightingRange
69,243
void (@NotNull PsiElement element, @NotNull TokenConsumer consumer) { }
tokenize
69,244
String () { return "EMPTY_TOKENIZER"; }
toString
69,245
Tokenizer (PsiElement element) { if (element instanceof PsiWhiteSpace) { return EMPTY_TOKENIZER; } if (isInjectedLanguageFragment(element)) { return EMPTY_TOKENIZER; } if (element instanceof PsiNameIdentifierOwner) return PsiIdentifierOwnerTokenizer.INSTANCE; if (element instanceof PsiComment) { if (SuppressionUtil.isS...
getTokenizer
69,246
boolean (@Nullable PsiElement element) { return element instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element); }
isInjectedLanguageFragment
69,247
LocalQuickFix[] (PsiElement element, @NotNull TextRange textRange, boolean useRename, String typo) { return getDefaultRegularFixes(useRename, typo, element, textRange); }
getRegularFixes
69,248
LocalQuickFix[] (boolean useRename, String typo, @Nullable PsiElement element, @NotNull TextRange range) { ArrayList<LocalQuickFix> result = new ArrayList<>(); if (useRename) { result.add(new RenameTo(typo)); } else if (element != null) { result.addAll(new ChangeTo(typo, element, range).getAllAsFixes()); } if (element ...
getDefaultRegularFixes
69,249
SpellCheckerQuickFix[] () { return BATCH_FIXES; }
getDefaultBatchFixes
69,250
boolean (@NotNull PsiElement element) { return true; }
isMyContext
69,251
PlainTextSplitter () { return INSTANCE; }
getInstance
69,252
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (StringUtil.isEmpty(text)) { return; } final Splitter ws = getTextSplitter(); int from = range.getStartOffset(); int till; try { Matcher matcher; final String substring = range.substring(text).replace('\b', '\n').replace('\f', '\n...
split
69,253
Splitter () { return TextSplitter.getInstance(); }
getTextSplitter
69,254
boolean (String text, String hashPrefix, int expectedHashSize) { return text.length() == expectedHashSize + hashPrefix.length() && text.startsWith(hashPrefix); }
isHashPrefixed
69,255
SpellcheckingStrategy (@NotNull PsiElement element, @NotNull Language language) { for (SpellcheckingStrategy strategy : LanguageSpellchecking.INSTANCE.allForLanguage(language)) { if (strategy.isMyContext(element)) { return strategy; } } return null; }
getSpellcheckingStrategy
69,256
boolean (@NotNull PsiElement element) { final Language language = element.getLanguage(); SpellcheckingStrategy strategy = getSpellcheckingStrategy(element, language); if (strategy instanceof SuppressibleSpellcheckingStrategy) { return ((SuppressibleSpellcheckingStrategy)strategy).isSuppressedFor(element, getShortName()...
isSuppressedFor
69,257
String () { return SPELL_CHECKING_INSPECTION_TOOL_NAME; }
getShortName
69,258
PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { if (!Registry.is("spellchecker.inspection.enabled", true)) { return PsiElementVisitor.EMPTY_VISITOR; } final SpellCheckerManager manager = SpellCheckerManager.getInstance(holder.getProject()); return new PsiElementVisitor() { @Override...
buildVisitor
69,259
void (@NotNull final PsiElement element) { if (holder.getResultCount() > 1000) return; final ASTNode node = element.getNode(); if (node == null) { return; } // Extract parser definition from element final Language language = element.getLanguage(); final IElementType elementType = node.getElementType(); final ParserDefi...
visitElement
69,260
void (@NotNull final PsiElement element, @NotNull final Language language, TokenConsumer consumer) { SpellcheckingStrategy factoryByLanguage = getSpellcheckingStrategy(element, language); if (factoryByLanguage == null) { return; } Tokenizer tokenizer = factoryByLanguage.getTokenizer(element); //noinspection unchecked t...
tokenize
69,261
void (PsiElement element, @NotNull TextRange textRange, @NotNull ProblemsHolder holder) { SpellCheckerQuickFix[] fixes = SpellcheckingStrategy.getDefaultBatchFixes(); ProblemDescriptor problemDescriptor = createProblemDescriptor(element, textRange, fixes, false); holder.registerProblem(problemDescriptor); }
addBatchDescriptor
69,262
void (PsiElement element, @NotNull TextRange textRange, @NotNull ProblemsHolder holder, boolean useRename, String wordWithTypo) { SpellcheckingStrategy strategy = getSpellcheckingStrategy(element, element.getLanguage()); LocalQuickFix[] fixes = strategy != null ? strategy.getRegularFixes(element, textRange, useRename, ...
addRegularDescriptor
69,263
ProblemDescriptor (PsiElement element, TextRange textRange, LocalQuickFix[] fixes, boolean onTheFly) { final String description = SpellCheckerBundle.message("typo.in.word.ref"); return new ProblemDescriptorBase(element, element, description, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false, textRange, onTheF...
createProblemDescriptor
69,264
OptPane () { return pane( checkbox("processCode", SpellCheckerBundle.message("process.code")), checkbox("processLiterals", SpellCheckerBundle.message("process.literals")), checkbox("processComments", SpellCheckerBundle.message("process.comments")) ); }
getOptionsPane
69,265
void (final PsiElement element, final String text, final boolean useRename, final int offset, TextRange rangeToCheck, Splitter splitter) { myElement = element; myText = text; myUseRename = useRename; myOffset = offset; splitter.split(text, rangeToCheck, this); }
consumeToken
69,266
void (TextRange range) { // Tokenization of large texts can produce a lot of tokens, but we are inside RA ProgressManager.checkCanceled(); String word = range.substring(myText); if (!myHolder.isOnTheFly() && myAlreadyChecked.contains(word)) { return; } boolean keyword = myNamesValidator.isKeyword(word, myElement.getPro...
consume
69,267
PropertiesSplitter () { return INSTANCE; }
getInstance
69,268
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (text == null || StringUtil.isEmpty(text)) { return; } final IdentifierSplitter splitter = IdentifierSplitter.getInstance(); try { Matcher matcher = WORD.matcher(newBombedCharSequence(text, range)); while (matcher.find()) { if (ma...
split
69,269
CommentSplitter () { return INSTANCE; }
getInstance
69,270
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (text == null || StringUtil.isEmpty(text)) { return; } List<TextRange> toCheck = excludeByPattern(text, range, HTML, 2); final Splitter ps = PlainTextSplitter.getInstance(); for (TextRange r : toCheck) { ps.split(text, r, consumer...
split
69,271
TextSplitter () { return INSTANCE; }
getInstance
69,272
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (text == null || StringUtil.isEmpty(text)) { return; } doSplit(text, range, consumer); }
split
69,273
void (@NotNull String text, @NotNull TextRange range, Consumer<TextRange> consumer) { final WordSplitter ws = WordSplitter.getInstance(); try { Matcher matcher = getExtendedWordAndSpecial().matcher(newBombedCharSequence(text)); matcher.region(range.getStartOffset(), range.getEndOffset()); while (matcher.find()) { TextR...
doSplit
69,274
Pattern () { return EXTENDED_WORD_AND_SPECIAL; }
getExtendedWordAndSpecial
69,275
IdentifierSplitter () { return INSTANCE; }
getInstance
69,276
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (text == null || range.getLength() < 1 || range.getStartOffset() < 0) { return; } List<TextRange> extracted = excludeByPattern(text, range, WORD_IN_QUOTES, 1); for (TextRange textRange : extracted) { List<TextRange> words = splitB...
split
69,277
List<TextRange> (@NotNull String text, @NotNull TextRange range) { //System.out.println("text = " + text + " range = " + range); List<TextRange> result = new ArrayList<>(); int i = range.getStartOffset(); int s = -1; int prevType = Character.MATH_SYMBOL; while (i < range.getEndOffset()) { final char ch = text.charAt(i)...
splitByCase
69,278
void (String text, List<TextRange> result, int i, int s) { if (i - s > 3) { final TextRange textRange = new TextRange(s, i); //System.out.println("textRange = " + textRange + " = "+ textRange.substring(text)); result.add(textRange); } }
add
69,279
WordSplitter () { return INSTANCE; }
getInstance
69,280
void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (text == null || range.getLength() <= 1) { return; } try { Matcher specialMatcher = SPECIAL.matcher(newBombedCharSequence(text)); specialMatcher.region(range.getStartOffset(), range.getEndOffset()); if (specialMatcher.find()) { Te...
split
69,281
void (@NotNull Consumer<? super TextRange> consumer, boolean ignore, @Nullable TextRange found) { if (found == null || ignore) { return; } boolean tooShort = (found.getEndOffset() - found.getStartOffset()) <= MIN_RANGE_LENGTH; if (tooShort) { return; } consumer.consume(found); }
addWord
69,282
boolean (@NotNull String text, @NotNull List<? extends TextRange> words) { for (TextRange word : words) { CharacterIterator it = new StringCharacterIterator(text, word.getStartOffset(), word.getEndOffset(), word.getStartOffset()); for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) { if (!Character.is...
isAllWordsAreUpperCased
69,283
boolean (@NotNull List<? extends TextRange> words) { for (TextRange word : words) { if (word.getLength() < MIN_RANGE_LENGTH) { return true; } } return false; }
containsShortWord
69,284
TextRange (@NotNull TextRange range, @NotNull Matcher matcher) { return subRange(range, matcher.start(), matcher.end()); }
matcherRange
69,285
TextRange (@NotNull TextRange range, @NotNull Matcher matcher, int group) { return subRange(range, matcher.start(group), matcher.end(group)); }
matcherRange
69,286
TextRange (@NotNull TextRange range, int start, int end) { return TextRange.from(range.getStartOffset() + start, end - start); }
subRange
69,287
boolean (int from, int till) { int l = till - from; return l <= MIN_RANGE_LENGTH; }
badSize
69,288
List<TextRange> (String text, TextRange range, @NotNull Pattern toExclude, int groupToInclude) { List<TextRange> toCheck = new SmartList<>(); int from = range.getStartOffset(); int till; boolean addLast = true; try { Matcher matcher = toExclude.matcher(newBombedCharSequence(text, range)); while (matcher.find()) { check...
excludeByPattern
69,289
CharSequence (String text, TextRange range) { return newBombedCharSequence(range.substring(text)); }
newBombedCharSequence
69,290
CharSequence (final String substring) { final long myTime = System.currentTimeMillis() + 500; return new StringUtil.BombedCharSequence(substring) { @Override protected void checkCanceled() { //todo[anna] if (ApplicationManager.getApplication().isHeadlessEnvironment()) return; long l = System.currentTimeMillis(); if (l ...
newBombedCharSequence
69,291
void () { //todo[anna] if (ApplicationManager.getApplication().isHeadlessEnvironment()) return; long l = System.currentTimeMillis(); if (l >= myTime) { throw new ProcessCanceledException(); } }
checkCanceled
69,292
void () { if (ApplicationManager.getApplication() != null) { ProgressIndicatorProvider.checkCanceled(); } }
checkCancelled
69,293
List<String> (Project project) { if (!processed) { suggestions = SpellCheckerManager.getInstance(project).getSuggestions(typo); processed = true; } return suggestions; }
getSuggestions
69,294
void (boolean active) { this.active = active; }
setActive
69,295
boolean () { return !active; }
shouldCheckOthers
69,296
SuggestedNameInfo (@NotNull PsiElement element, PsiElement nameSuggestionContext, @NotNull Set<String> result) { if (!active || nameSuggestionContext == null) { return null; } String initial = getText(nameSuggestionContext); if (initial == null) { return null; } String normalized = normalize(initial); Project project =...
getSuggestedNames
69,297
String (@NotNull String text) { //Some languages may ask engine for suggestions with `"` included in word, //e.g. JavaScript -- "typpo" -- quotes would not be trimmed. We trim them here. return StringUtil.unquoteString(text); }
normalize
69,298
Collection<String> (@NotNull String initial, @NotNull Collection<String> suggestions) { if (!StringUtil.isQuotedString(initial)) { return suggestions; } char quote = initial.charAt(0); StringBuilder tmp = new StringBuilder(); ArrayList<String> result = new ArrayList<>(suggestions.size()); for (String suggestion : sugge...
denormalize
69,299
String () { return myWord != null ? SpellCheckerBundle.message("add.0.to.dictionary", myWord) : SpellCheckerBundle.message("add.to.dictionary"); }
getName