Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
27,600
IndentationRules () { return myIndentationRules; }
getIndentationRules
27,601
void (Preferences preferences) { fillHighlightingBraces(preferences.getHighlightingPairs()); fillSmartTypingBraces(preferences.getSmartTypingPairs()); myPreferences.add(preferences); }
addPreferences
27,602
void (@NotNull CharSequence scopeName, @NotNull Plist plist) { final Set<TextMateBracePair> highlightingPairs = PreferencesReadUtil.readPairs(plist.getPlistValue(Constants.HIGHLIGHTING_PAIRS_KEY)); Set<TextMateBracePair> rawSmartTypingPairs = PreferencesReadUtil.readPairs(plist.getPlistValue(Constants.SMART_TYPING_PAIR...
fillFromPList
27,603
void (Collection<TextMateBracePair> highlightingPairs) { if (highlightingPairs != null) { for (TextMateBracePair pair : highlightingPairs) { if (!pair.getLeft().isEmpty()) { myLeftHighlightingBraces.add(pair.getLeft().charAt(0)); } if (!pair.getRight().isEmpty()) { myRightHighlightingBraces.add(pair.getRight().charAt(p...
fillHighlightingBraces
27,604
void (Collection<TextMateAutoClosingPair> smartTypingPairs) { if (smartTypingPairs != null) { for (TextMateAutoClosingPair pair : smartTypingPairs) { if (!pair.getLeft().isEmpty()) { myLeftSmartTypingBraces.add(pair.getLeft().charAt(pair.getLeft().length() - 1)); } if (!pair.getRight().isEmpty()) { myRightSmartTypingBr...
fillSmartTypingBraces
27,605
boolean (char firstLeftBraceChar) { return myLeftHighlightingBraces.contains(firstLeftBraceChar) || (firstLeftBraceChar != ' ' && myLeftSmartTypingBraces.contains( firstLeftBraceChar)); }
isPossibleLeftHighlightingBrace
27,606
boolean (char lastRightBraceChar) { return myRightHighlightingBraces.contains(lastRightBraceChar) || (lastRightBraceChar != ' ' && myRightSmartTypingBraces.contains( lastRightBraceChar)); }
isPossibleRightHighlightingBrace
27,607
boolean (char lastLeftBraceChar) { return myLeftSmartTypingBraces.contains(lastLeftBraceChar); }
isPossibleLeftSmartTypingBrace
27,608
boolean (char lastRightBraceChar) { return myRightSmartTypingBraces.contains(lastRightBraceChar); }
isPossibleRightSmartTypingBrace
27,609
List<Preferences> (@NotNull TextMateScope scope) { return new TextMateScopeComparator<>(scope, Preferences::getScopeSelector).sortAndFilter(myPreferences); }
getPreferences
27,610
void () { myPreferences.clear(); myLeftHighlightingBraces.clear(); myRightHighlightingBraces.clear(); fillHighlightingBraces(Constants.DEFAULT_HIGHLIGHTING_BRACE_PAIRS); myLeftSmartTypingBraces.clear(); myRightSmartTypingBraces.clear(); fillSmartTypingBraces(Constants.DEFAULT_SMART_TYPING_BRACE_PAIRS); }
clear
27,611
String () { return foreground; }
getForeground
27,612
String () { return background; }
getBackground
27,613
FontStyle () { return fontStyle; }
getFontStyle
27,614
TextMateTextAttributes (@NotNull Plist settingsPlist) { boolean empty = true; String foreground = null; String background = null; FontStyle fontStyle = FontStyle.PLAIN; for (Map.Entry<String, PListValue> entry : settingsPlist.entries()) { final String propertyName = entry.getKey(); final String value = entry.getValue()...
fromPlist
27,615
void (@NotNull TextMateSnippet snippet) { mySnippets.computeIfAbsent(snippet.getKey(), (key) -> Collections.synchronizedList(new ArrayList<>())).add(snippet); }
register
27,616
Collection<TextMateSnippet> (@NotNull String key, @Nullable TextMateScope scope) { if (scope == null) { return Collections.emptyList(); } Collection<TextMateSnippet> snippets = mySnippets.get(key); if (snippets == null) { return Collections.emptyList(); } return new TextMateScopeComparator<>(scope, TextMateSnippet::get...
findSnippet
27,617
Collection<TextMateSnippet> (@Nullable TextMateScope scopeSelector) { if (scopeSelector == null) { return Collections.emptyList(); } return new TextMateScopeComparator<>(scopeSelector, TextMateSnippet::getScopeSelector) .sortAndFilter(mySnippets.values().stream().flatMap((values) -> values.stream())); }
getAvailableSnippets
27,618
void () { mySnippets.clear(); }
clear
27,619
Collection<File> () { loadExtensions(); //noinspection SSBasedInspection return grammarToExtensions.keySet().stream().map((path) -> new File(bundleFile, path)).collect(Collectors.toList()); }
getGrammarFiles
27,620
Collection<String> (@NotNull File file, @NotNull Plist plist) { HashSet<String> result = new HashSet<>(super.getExtensions(file, plist)); loadExtensions(); result.addAll(grammarToExtensions.getOrDefault(FileUtilRt.toSystemIndependentName( Objects.requireNonNull(FileUtilRt.getRelativePath(bundleFile, file))), emptyList(...
getExtensions
27,621
Collection<File> () { loadExtensions(); //noinspection SSBasedInspection return snippetPaths.stream().map((path) -> new File(bundleFile, path)).collect(Collectors.toList()); }
getSnippetFiles
27,622
void () { if (!grammarToExtensions.isEmpty()) return; File packageJson = new File(bundleFile, "package.json"); try { Object json = JsonPlistReader.createJsonReader().readValue(new FileReader(packageJson, StandardCharsets.UTF_8), Object.class); if (json instanceof Map) { Object contributes = ((Map<?, ?>)json).get("contr...
loadExtensions
27,623
Collection<File> () { loadExtensions(); //noinspection SSBasedInspection return configToScopes.keySet().stream().map(config -> new File(bundleFile, config)).collect(Collectors.toList()); }
getPreferenceFiles
27,624
PListValue (Map json, String key) { Object brackets = json.get(key); if (!(brackets instanceof ArrayList)) { return null; } List<PListValue> pairs = new ArrayList<>(); for (Object bracket : (ArrayList)brackets) { if (bracket instanceof ArrayList && ((ArrayList<?>)bracket).size() == 2) { pairs.add(array(string(((ArrayLi...
loadBrackets
27,625
List<PListValue> (Map json) { List<PListValue> variables = new ArrayList<>(); Object comments = json.get("comments"); if (comments instanceof Map) { Object line = ((Map<?, ?>)comments).get("lineComment"); boolean hasLine = line instanceof String; if (hasLine) { variables.add(variable(COMMENT_START_VARIABLE, ((String)li...
loadComments
27,626
Plist (Map json) { Plist patterns = new Plist(); Object rules = json.get("indentationRules"); if (rules instanceof Map) { loadIndentationPattern(patterns, rules, INCREASE_INDENT_PATTERN, "increaseIndentPattern"); loadIndentationPattern(patterns, rules, DECREASE_INDENT_PATTERN, "decreaseIndentPattern"); loadIndentationP...
loadIndentationRules
27,627
void (Plist patterns, Object rules, String name, String key) { Object value = ((Map<?, ?>)rules).get(key); if (value instanceof String) { patterns.setEntry(name, string((String)value)); } }
loadIndentationPattern
27,628
PListValue (String name, String value) { Plist variable = new Plist(); variable.setEntry(NAME_KEY, string(name)); variable.setEntry(VALUE_KEY, string(value)); return dict(variable); }
variable
27,629
String () { return myName; }
getName
27,630
Collection<File> () { switch (myType) { case TEXTMATE -> { return getFilesInBundle("Syntaxes", SYNTAX_FILES_FILTER); } case SUBLIME -> { return getFilesInBundle("", SYNTAX_FILES_FILTER); } } throw new IllegalArgumentException("Only textmate and sublime bundles are supported. Use TextMateBundleReader instead."); }
getGrammarFiles
27,631
Collection<File> () { switch (myType) { case TEXTMATE -> { return getFilesInBundle("Preferences", PREFERENCE_FILES_FILTER); } case SUBLIME -> { return getFilesInBundle("", PREFERENCE_FILES_FILTER); } } throw new IllegalArgumentException("Only textmate and sublime bundles are supported. Use TextMateBundleReader instead....
getPreferenceFiles
27,632
Collection<File> () { switch (myType) { case TEXTMATE -> { return getFilesInBundle("Snippets", new BundleFilesFilter(Constants.TEXTMATE_SNIPPET_EXTENSION, "plist")); } case SUBLIME -> { return emptyList(); } } throw new IllegalArgumentException("Only textmate and sublime bundles are supported. Use TextMateBundleReader ...
getSnippetFiles
27,633
Collection<File> (@NotNull String path, @Nullable FileFilter filter) { File[] files = null; try { files = new File(bundleFile, path).listFiles(filter); } catch (SecurityException ignore) { } return files != null && files.length > 0 ? Set.of(files) : Collections.emptySet(); }
getFilesInBundle
27,634
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Bundle bundle = (Bundle)o; return FileUtilRt.filesEqual(bundleFile, bundle.bundleFile); }
equals
27,635
int () { return FileUtilRt.pathHashCode(bundleFile.getPath()); }
hashCode
27,636
String () { return "Bundle{name='" + myName + "', path='" + bundleFile + "', type=" + myType + '}'; }
toString
27,637
Collection<String> (@NotNull File file, @NotNull Plist plist) { return plist.getPlistValue(Constants.FILE_TYPES_KEY, emptyList()).getStringArray(); }
getExtensions
27,638
boolean (@NotNull File path) { return myExtensions.contains(FileUtilRt.getExtension(path.getName()).toLowerCase(Locale.US)); }
accept
27,639
Object () { return myValue; }
getValue
27,640
PlistValueType () { return myType; }
getType
27,641
Plist () { return myType == PlistValueType.DICT ? (Plist)myValue : Plist.EMPTY_PLIST; }
getPlist
27,642
List<PListValue> () { return myType == PlistValueType.ARRAY ? (List<PListValue>)myValue : Collections.emptyList(); }
getArray
27,643
List<String> () { List<PListValue> array = getArray(); List<String> result = new ArrayList<>(array.size()); for (PListValue value : array) { result.add(value.getString()); } return result; }
getStringArray
27,644
String () { return myType == PlistValueType.STRING ? (String)myValue : myValue.toString(); }
getString
27,645
PListValue (Object value, PlistValueType type) { if (value == null) { return new NullablePListValue(type); } return new PListValue(value, type); }
value
27,646
PListValue (String value) { return value(value, PlistValueType.STRING); }
string
27,647
PListValue (Boolean value) { return value(value, PlistValueType.BOOLEAN); }
bool
27,648
PListValue (Long value) { return value(value, PlistValueType.INTEGER); }
integer
27,649
PListValue (Double value) { return value(value, PlistValueType.REAL); }
real
27,650
PListValue (Date value) { return value(value, PlistValueType.DATE); }
date
27,651
PListValue (List<PListValue> value) { return value(value, PlistValueType.ARRAY); }
array
27,652
PListValue (PListValue... value) { return value(Arrays.asList(value), PlistValueType.ARRAY); }
array
27,653
PListValue (Plist value) { return value(value, PlistValueType.DICT); }
dict
27,654
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PListValue value = (PListValue)o; if (myType != value.myType) return false; if (!Objects.equals(myValue, value.myValue)) return false; return true; }
equals
27,655
int () { int result = myValue != null ? myValue.hashCode() : 0; result = 31 * result + myType.hashCode(); return result; }
hashCode
27,656
String () { return "PListValue{" + "myValue=" + myValue + ", myType=" + myType + '}'; }
toString
27,657
Plist () { return Plist.EMPTY_PLIST; }
getPlist
27,658
List<PListValue> () { return Collections.emptyList(); }
getArray
27,659
List<String> () { return Collections.emptyList(); }
getStringArray
27,660
String () { return null; }
getString
27,661
PListValue (@NotNull Map<String, Object> map) { Plist dict = new Plist(); for (Map.Entry<String, Object> entry : map.entrySet()) { PListValue value = readValue(entry.getValue()); if (value != null) { dict.setEntry(entry.getKey(), value); } } return value(dict, PlistValueType.DICT); }
readDict
27,662
PListValue (Object value) { if (value instanceof Map) { //noinspection unchecked return readDict((Map<String, Object>)value); } else if (value instanceof ArrayList) { return readArray((ArrayList<?>)value); } else { return readBasicValue(value); } }
readValue
27,663
PListValue (ArrayList<?> list) { List<Object> result = new ArrayList<>(); for (Object o : list) { PListValue value = readValue(o); if (value != null) { result.add(value); } } return value(result, PlistValueType.ARRAY); }
readArray
27,664
PListValue (Object value) { if (value instanceof String) { return value(value, PlistValueType.STRING); } else if (value instanceof Boolean) { return value(value, PlistValueType.BOOLEAN); } else if (value instanceof Integer) { return value(Long.valueOf((Integer)value), PlistValueType.INTEGER); } else if (value instanceo...
readBasicValue
27,665
ObjectMapper () { JsonFactory factory = JsonFactory.builder() .enable(JsonReadFeature.ALLOW_JAVA_COMMENTS) .enable(JsonReadFeature.ALLOW_TRAILING_COMMA) .enable(JsonReadFeature.ALLOW_SINGLE_QUOTES) .enable(JsonReadFeature.ALLOW_UNQUOTED_FIELD_NAMES) .build(); return new ObjectMapper(factory).configure(DeserializationFe...
createJsonReader
27,666
SimpleDateFormat () { return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); }
dateFormatter
27,667
Plist (Map<String, PListValue> map) { return new Plist(unmodifiableMap(map)); }
fromMap
27,668
void (@NotNull String key, @Nullable PListValue value) { if (value == null) { myMap.remove(key); } else { myMap.put(key, value); } }
setEntry
27,669
PListValue (@NotNull String key) { return getPlistValue(key, null); }
getPlistValue
27,670
PListValue (@NotNull String key, @Nullable Object defValue) { PListValue result = myMap.get(key); if (result != null) { return result; } if (defValue != null) { return new PListValue(defValue, PlistValueType.fromObject(defValue)); } return null; }
getPlistValue
27,671
boolean (@NotNull String key) { return myMap.containsKey(key); }
contains
27,672
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Plist plist = (Plist)o; if (!myMap.equals(plist.myMap)) return false; return true; }
equals
27,673
int () { return myMap.hashCode(); }
hashCode
27,674
PlistValueType (Object o) { if (o instanceof String) { return STRING; } if (o instanceof Long) { return INTEGER; } if (o instanceof Plist) { return DICT; } if (o instanceof List) { return ARRAY; } if (o instanceof Double) { return REAL; } if (o instanceof Boolean) { return BOOLEAN; } if (o instanceof Date) { return DAT...
fromObject
27,675
MatchData (@Nullable Region matchedRegion) { if (matchedRegion != null) { int[] offsets = new int[matchedRegion.getNumRegs() * 2]; for (int i = 0; i < matchedRegion.getNumRegs(); i++) { int startIndex = i * 2; offsets[startIndex] = Math.max(matchedRegion.getBeg(i), 0); offsets[startIndex + 1] = Math.max(matchedRegion.g...
fromRegion
27,676
int () { return offsets.length / 2; }
count
27,677
TextMateRange () { return byteOffset(0); }
byteOffset
27,678
TextMateRange (int group) { int endIndex = group * 2 + 1; return new TextMateRange(offsets[endIndex - 1], offsets[endIndex]); }
byteOffset
27,679
TextMateRange (CharSequence s, byte[] stringBytes) { return charRange(s, stringBytes, 0); }
charRange
27,680
TextMateRange (CharSequence s, byte[] stringBytes, int group) { TextMateRange range = codePointRange(stringBytes, group); return new TextMateRange(Character.offsetByCodePoints(s, 0, range.start), Character.offsetByCodePoints(s, 0, range.end)); }
charRange
27,681
TextMateRange (byte[] stringBytes) { return codePointRange(stringBytes, 0); }
codePointRange
27,682
TextMateRange (byte[] stringBytes, int group) { return RegexUtil.codePointsRangeByByteRange(stringBytes, byteOffset(group)); }
codePointRange
27,683
boolean () { return matched; }
matched
27,684
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MatchData matchData = (MatchData)o; if (matched != matchData.matched) return false; if (!Arrays.equals(offsets, matchData.offsets)) return false; return true; }
equals
27,685
int () { return 31 * (matched ? 1 : 0) + Arrays.hashCode(offsets); }
hashCode
27,686
String () { return "{ matched=" + matched + ", offsets=" + Arrays.toString(offsets) + '}'; }
toString
27,687
int (byte[] stringBytes, int byteOffset) { if (byteOffset <= 0) { return 0; } return NonStrictUTF8Encoding.INSTANCE.strLength(stringBytes, 0, byteOffset); }
codePointOffsetByByteOffset
27,688
int (@NotNull CharSequence charSequence, int charOffset) { if (charOffset <= 0) { return 0; } int result = 0; int i = 0; while (i < charOffset) { result += UTF8Encoding.INSTANCE.codeToMbcLength(charSequence.charAt(i)); i++; } return result; }
byteOffsetByCharOffset
27,689
TextMateRange (byte[] bytes, @NotNull TextMateRange byteRange) { int startOffset = codePointOffsetByByteOffset(bytes, byteRange.start); int endOffset = codePointOffsetByByteOffset(bytes, byteRange.end); return new TextMateRange(startOffset, endOffset); }
codePointsRangeByByteRange
27,690
int () { return Arrays.hashCode(bytes); }
hashCode
27,691
boolean (Object obj) { return obj instanceof StringWithId && Arrays.equals(bytes, ((StringWithId)obj).bytes); }
equals
27,692
MatchData (StringWithId string, @Nullable Runnable checkCancelledCallback) { return match(string, 0, 0, true, checkCancelledCallback); }
match
27,693
MatchData (@NotNull StringWithId string, int byteOffset, int gosOffset, boolean matchBeginOfString, @Nullable Runnable checkCancelledCallback) { gosOffset = gosOffset != byteOffset ? Integer.MAX_VALUE : byteOffset; int options = matchBeginOfString ? Option.NONE : Option.NOTBOS; LastMatch lastResult = matchResult.get();...
match
27,694
void (MatchData match, StringWithId string) { if (match.matched() && match.byteOffset().end > string.bytes.length) { throw new IllegalStateException( "Match data out of bounds: " + match.byteOffset().start + " > " + string.bytes.length + "\n" + new String(string.bytes, StandardCharsets.UTF_8)); } }
checkMatched
27,695
Searcher (byte[] stringBytes) { return new Searcher(stringBytes, myRegex.matcher(stringBytes, 0, stringBytes.length)); }
searcher
27,696
RegexFacade (@NotNull String regexString) { return REGEX_CACHE.get(regexString, RegexFacade::new); }
regex
27,697
boolean () { return start == end; }
isEmpty
27,698
int () { return end - start; }
getLength
27,699
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TextMateRange range = (TextMateRange)o; return start == range.start && end == range.end; }
equals