Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
27,300 | String () { return DEFAULT_EXTENSION; } | getDefaultExtension |
27,301 | Icon () { return IconManager.getInstance().getPlatformIcon(PlatformIcons.PropertiesFileType); } | getIcon |
27,302 | String (@NotNull VirtualFile file, byte @NotNull [] content) { Charset charset = EncodingRegistry.getInstance().getDefaultCharsetForPropertiesFiles(file); if (charset == null) { charset = PROPERTIES_DEFAULT_CHARSET; } if (EncodingRegistry.getInstance().isNative2Ascii(file)) { charset = Native2AsciiCharset.wrap(charset); } return charset.name(); } | getCharset |
27,303 | IElementType () { final IElementType tokenType = super.getTokenType(); if (tokenType != INVALID_CHARACTER_ESCAPE_TOKEN) return tokenType; if (myStart + 1 >= myBuffer.length()) return tokenType; final char nextChar = myBuffer.charAt(myStart + 1); if (nextChar != 'u') return VALID_STRING_ESCAPE_TOKEN; return tokenType; } | getTokenType |
27,304 | Project () { return getDefaultPropertiesFile().getProject(); } | getProject |
27,305 | List<PropertiesFile> () { return Collections.emptyList(); } | getPropertiesFiles |
27,306 | PropertiesFile () { throw new IllegalStateException(); } | getDefaultPropertiesFile |
27,307 | String () { return ""; } | getBaseName |
27,308 | VirtualFile () { throw new IllegalStateException(); } | getBaseDirectory |
27,309 | Project () { throw new IllegalStateException(); } | getProject |
27,310 | boolean () { return false; } | isValid |
27,311 | ResourceBundle () { return Holder.NULL; } | getInstance |
27,312 | Lexer () { return new PropertiesHighlightingLexer(); } | getHighlightingLexer |
27,313 | TextAttributesKey () { return myTextAttributesKey; } | getTextAttributesKey |
27,314 | PropertiesComponent (IElementType tokenType) { return elementTypeToComponent.get(tokenType); } | getByTokenType |
27,315 | PropertiesComponent (TextAttributesKey textAttributesKey) { return textAttributeKeyToComponent.get(textAttributesKey); } | getByTextAttribute |
27,316 | boolean (final ResourceBundle resourceBundle, final String propertyName) { for (PropertiesFile propertiesFile : resourceBundle.getPropertiesFiles()) { if (propertiesFile.findPropertyByKey(propertyName) != null) { return true; } } return false; } | containsProperty |
27,317 | String (final Collection<? extends PropertiesFile> files) { String commonPrefix = null; for (PropertiesFile file : files) { final String baseName = file.getVirtualFile().getNameWithoutExtension(); if (commonPrefix == null) { commonPrefix = baseName; } else { commonPrefix = StringUtil.commonPrefix(commonPrefix, baseName); if (commonPrefix.isEmpty()) { break; } } } assert commonPrefix != null; if (!commonPrefix.isEmpty() && BASE_NAME_BORDER_CHAR.contains(commonPrefix.charAt(commonPrefix.length() - 1))) { commonPrefix = commonPrefix.substring(0, commonPrefix.length() - 1); } return commonPrefix; } | getDefaultBaseName |
27,318 | String (@NotNull final PsiFile file) { return CachedValuesManager.getCachedValue(file, new CachedValueProvider<>() { @NotNull @Override public Result<String> compute() { return Result.create(computeBaseName(), file); } private String computeBaseName() { final String name = file.getName(); if (!StringUtil.containsChar(name, '_')) { return FileUtilRt.getNameWithoutExtension(name); } final Matcher matcher = LOCALE_PATTERN.matcher(name); final String baseNameWithExtension; int matchIndex = 0; while (matcher.find(matchIndex)) { final MatchResult matchResult = matcher.toMatchResult(); final String[] splitted = matchResult.group(1).split("_"); if (splitted.length > 1) { final String langCode = splitted[1]; if (!LOCALES_LANGUAGE_CODES.get().contains(langCode)) { matchIndex = matchResult.start(1) + 1; continue; } baseNameWithExtension = name.substring(0, matchResult.start(1)) + name.substring(matchResult.end(1)); return FileUtilRt.getNameWithoutExtension(baseNameWithExtension); } } baseNameWithExtension = name; return FileUtilRt.getNameWithoutExtension(baseNameWithExtension); } }); } | getDefaultBaseName |
27,319 | Result<String> () { return Result.create(computeBaseName(), file); } | compute |
27,320 | String () { final String name = file.getName(); if (!StringUtil.containsChar(name, '_')) { return FileUtilRt.getNameWithoutExtension(name); } final Matcher matcher = LOCALE_PATTERN.matcher(name); final String baseNameWithExtension; int matchIndex = 0; while (matcher.find(matchIndex)) { final MatchResult matchResult = matcher.toMatchResult(); final String[] splitted = matchResult.group(1).split("_"); if (splitted.length > 1) { final String langCode = splitted[1]; if (!LOCALES_LANGUAGE_CODES.get().contains(langCode)) { matchIndex = matchResult.start(1) + 1; continue; } baseNameWithExtension = name.substring(0, matchResult.start(1)) + name.substring(matchResult.end(1)); return FileUtilRt.getNameWithoutExtension(baseNameWithExtension); } } baseNameWithExtension = name; return FileUtilRt.getNameWithoutExtension(baseNameWithExtension); } | computeBaseName |
27,321 | Locale (@NotNull final PropertiesFile propertiesFile) { String name = propertiesFile.getName(); if (!StringUtil.containsChar(name, '_')) return DEFAULT_LOCALE; final String containingResourceBundleBaseName = propertiesFile.getResourceBundle().getBaseName(); if (!name.startsWith(containingResourceBundleBaseName)) return DEFAULT_LOCALE; return getLocale(name.substring(containingResourceBundleBaseName.length())); } | getLocale |
27,322 | Locale (String suffix) { return getLocaleAndTrimmedSuffix(suffix).getFirst(); } | getLocale |
27,323 | PropertiesFile (@NotNull PropertiesFile file, @NotNull Collection<? extends PropertiesFile> candidates) { VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return null; String name = virtualFile.getNameWithoutExtension(); String[] parts = name.split("_"); if (parts.length == 1) return null; List<String> partsList = Arrays.asList(parts); for (int i=parts.length-1; i>=1;i--) { String parentName = StringUtil.join(partsList.subList(0, i), "_") + "." + virtualFile.getExtension(); for (PropertiesFile candidate : candidates) { if (parentName.equals(candidate.getName())) return candidate; } } return null; } | getParent |
27,324 | List<IProperty> (@NotNull ResourceBundle resourceBundle, String key) { List<IProperty> result = new SmartList<>(); List<PropertiesFile> propertiesFiles = resourceBundle.getPropertiesFiles(); for (PropertiesFile propertiesFile : propertiesFiles) { result.addAll(propertiesFile.findPropertiesByKey(key)); } return result; } | findAllProperties |
27,325 | boolean (String text) { boolean result = false; for (int i = text.length()-1; i>=0; i--) { if (text.charAt(i) == '\\') { result = !result; } else { break; } } return result; } | isUnescapedBackSlashAtTheEnd |
27,326 | String (@NotNull PsiDirectory directory) { return ProjectRootManager.getInstance(directory.getProject()).getFileIndex().getPackageNameByDirectory(directory.getVirtualFile()); } | getPackageQualifiedName |
27,327 | boolean (Locale locale) { return LOCALES_LANGUAGE_CODES.get().contains(locale.getLanguage()); } | hasDefaultLanguage |
27,328 | String (@NotNull PropertiesFile propertiesFile) { final String baseName = propertiesFile.getResourceBundle().getBaseName(); final String propertiesFileName = propertiesFile.getName(); if (baseName.equals(FileUtilRt.getNameWithoutExtension(propertiesFileName))) return ""; return FileUtilRt.getNameWithoutExtension(propertiesFileName.substring(baseName.length() + 1)); } | getSuffix |
27,329 | String () { return "Properties:" + super.toString(); } | toString |
27,330 | PropertyKeyIndex () { return ourInstance; } | getInstance |
27,331 | Collection<Property> (@NotNull String key, @NotNull Project project, @NotNull GlobalSearchScope scope) { return getProperties(key, project, scope); } | get |
27,332 | Collection<Property> (@NotNull String key, @NotNull Project project, @NotNull GlobalSearchScope scope) { return StubIndex.getElements(getKey(), key, project, scope, Property.class); } | getProperties |
27,333 | String (@NotNull String text) { StringBuilder buffer = new StringBuilder(); boolean escaped = false; for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (c == ESCAPE_SYMBOL && !escaped && (i == text.length() - 1 || (text.charAt(i + 1) != 'u' && text.charAt(i + 1) != 'U'))) { escaped = true; continue; } if (escaped && (c == 'n' || c == 'r')) { buffer.append(ESCAPE_SYMBOL); } buffer.append(c); escaped = false; } return buffer.toString(); } | fromPropertyValueToValueEditor |
27,334 | String (@NotNull String value, char delimiter, @NotNull PropertyKeyValueFormat valueFormat) { if (valueFormat == PropertyKeyValueFormat.FILE) return value; StringBuilder buffer = new StringBuilder(); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (c == '\n' || c == '\r') { buffer.append(ESCAPE_SYMBOL); if (valueFormat == PropertyKeyValueFormat.MEMORY) { buffer.append(c == '\n' ? 'n' : 'r'); } else { buffer.append(c); } } else if ((i == 0 && (c == ' ' || c == '\t')) // Leading white space || (delimiter == ' ' && (c == '=' || c == ':' /* special symbol */))) { buffer.append(ESCAPE_SYMBOL); buffer.append(c); } else if (c == ESCAPE_SYMBOL) { if (i + 1 >= value.length() || !isEscapedChar(value.charAt(i + 1)) || valueFormat == PropertyKeyValueFormat.MEMORY) { buffer.append(ESCAPE_SYMBOL); } buffer.append(c); } else { buffer.append(c); } } return buffer.toString(); } | convertValueToFileFormat |
27,335 | boolean (char nextChar) { return nextChar == 'n' || nextChar == 'r' || nextChar == 'u' || nextChar == 'U'; } | isEscapedChar |
27,336 | PropertiesFile (Project project, Void p) { return createPropertiesFile(project, System.getProperties(), "system"); } | compute |
27,337 | IProperty (@NotNull Project project, @NonNls @NotNull String name, @NonNls @NotNull String value, @Nullable Character delimiter) { return createProperty(project, name, value, delimiter, PropertyKeyValueFormat.PRESENTABLE); } | createProperty |
27,338 | IProperty (@NotNull Project project, @NonNls @NotNull String name, @NonNls @NotNull String value, @Nullable Character delimiter, @NotNull PropertyKeyValueFormat format) { String text = getPropertyText(name, value, delimiter, project, format); final PropertiesFile dummyFile = createPropertiesFile(project, text); return dummyFile.getProperties().get(0); } | createProperty |
27,339 | String (@NonNls @NotNull String name, @NonNls @NotNull String value, @NonNls @Nullable Character delimiter, @Nullable Project project, @NotNull PropertyKeyValueFormat format) { if (delimiter == null) { delimiter = project == null ? '=' : PropertiesCodeStyleSettings.getInstance(project).getDelimiter(); } return (format != PropertyKeyValueFormat.FILE ? escape(name) : name) + delimiter + escapeValue(value, delimiter, format); } | getPropertyText |
27,340 | PropertiesFile (@NotNull Project project, @NonNls @NotNull String text) { @NonNls String filename = "dummy." + PropertiesFileType.INSTANCE.getDefaultExtension(); return (PropertiesFile)PsiFileFactory.getInstance(project) .createFileFromText(filename, PropertiesFileType.INSTANCE, text); } | createPropertiesFile |
27,341 | PropertiesFile (@NotNull Project project, Properties properties, String fileName) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { properties.store(stream, ""); } catch (IOException e) { throw new RuntimeException(e); } @NonNls String filename = fileName + "." + PropertiesFileType.INSTANCE.getDefaultExtension(); return (PropertiesFile)PsiFileFactory.getInstance(project) .createFileFromText(filename, PropertiesFileType.INSTANCE, stream.toString()); } | createPropertiesFile |
27,342 | String (@NotNull String name) { if (StringUtil.startsWithChar(name, '#') || StringUtil.startsWithChar(name, '!')) { name = "\\" + name; } return StringUtil.escapeChars(name, '=', ':', ' ', '\t'); } | escape |
27,343 | String (String value, char delimiter) { return escapeValue(value, delimiter, PropertyKeyValueFormat.PRESENTABLE); } | escapeValue |
27,344 | String (String value, char delimiter, PropertyKeyValueFormat format) { return PropertiesResourceBundleUtil.convertValueToFileFormat(value, delimiter, format); } | escapeValue |
27,345 | PropertiesCodeStyleSettings (final Project project) { return CodeStyleSettingsManager.getSettings(project).getCustomSettings(PropertiesCodeStyleSettings.class); } | getInstance |
27,346 | char () { return DELIMITERS[KEY_VALUE_DELIMITER_CODE]; } | getDelimiter |
27,347 | Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, PropertiesIcons.class.getClassLoader(), cacheKey, flags); } | load |
27,348 | int (String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); do result[j++] = value; while (--count > 0); } return j; } | zzUnpackcmap_top |
27,349 | int (String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); do result[j++] = value; while (--count > 0); } return j; } | zzUnpackcmap_blocks |
27,350 | int (String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); do result[j++] = value; while (--count > 0); } return j; } | zzUnpackAction |
27,351 | int (String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length() - 1; while (i < l) { int high = packed.charAt(i++) << 16; result[j++] = high | packed.charAt(i++); } return j; } | zzUnpackRowMap |
27,352 | int (String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); value--; do result[j++] = value; while (--count > 0); } return j; } | zzUnpacktrans |
27,353 | int (String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); do result[j++] = value; while (--count > 0); } return j; } | zzUnpackAttribute |
27,354 | int () { return Integer.MAX_VALUE; } | zzMaxBufferLen |
27,355 | boolean () { return true; } | zzCanGrow |
27,356 | int (int input) { int offset = input & 255; return offset == input ? ZZ_CMAP_BLOCKS[offset] : ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input >> 8] | offset]; } | zzCMap |
27,357 | int () { return zzStartRead; } | getTokenStart |
27,358 | int () { return getTokenStart() + yylength(); } | getTokenEnd |
27,359 | void (CharSequence buffer, int start, int end, int initialState) { zzBuffer = buffer; zzCurrentPos = zzMarkedPos = zzStartRead = start; zzAtEOF = false; zzAtBOL = true; zzEndRead = end; yybegin(initialState); } | reset |
27,360 | int () { return zzLexicalState; } | yystate |
27,361 | void (int newState) { zzLexicalState = newState; } | yybegin |
27,362 | CharSequence () { return zzBuffer.subSequence(zzStartRead, zzMarkedPos); } | yytext |
27,363 | char (int pos) { return zzBuffer.charAt(zzStartRead+pos); } | yycharat |
27,364 | int () { return zzMarkedPos-zzStartRead; } | yylength |
27,365 | void (int errorCode) { String message; try { message = ZZ_ERROR_MSG[errorCode]; } catch (ArrayIndexOutOfBoundsException e) { message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } throw new Error(message); } | zzScanError |
27,366 | void (int number) { if ( number > yylength() ) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos -= number; } | yypushback |
27,367 | Path (String bundleName) { Path bundleDirectory = Path.of(getCommunityHomePath() + "/plugins/textmate/testData/bundles", bundleName); if (Files.exists(bundleDirectory)) { return bundleDirectory; } return Path.of(getCommunityHomePath() + "/plugins/textmate/lib/bundles", bundleName); } | getBundleDirectory |
27,368 | TextMateBundleReader (String bundleName) { Path bundleDirectory = getBundleDirectory(bundleName); BundleType bundleType = BundleType.detectBundleType(bundleDirectory); return switch (bundleType) { case TEXTMATE -> readTextMateBundle(bundleDirectory); case SUBLIME -> readSublimeBundle(bundleDirectory); case VSCODE -> readVSCBundle(relativePath -> { try { return Files.newInputStream(bundleDirectory.resolve(relativePath)); } catch (IOException e) { throw new RuntimeException(e); } }); case UNDEFINED -> throw new RuntimeException("Unknown bundle type: " + bundleName); }; } | readBundle |
27,369 | TextMateScope (String scopeString) { TextMateScope scope = TextMateScope.EMPTY; for (String scopeName : scopeString.split(" ")) { scope = scope.add(scopeName); } return scope; } | scopeFromString |
27,370 | String () { URL url = TestUtil.class.getResource("/" + TestUtil.class.getName().replace('.', '/') + ".class"); if (url != null && url.getProtocol().equals("file")) { try { File file = new File(url.toURI().getPath()); while (file != null) { String[] children = file.list(); if (children != null && ArrayUtil.contains(".idea", children)) { if (ArrayUtil.contains("community", children)) { return file.getPath() + "/community"; } else { return file.getPath(); } } file = file.getParentFile(); } } catch (Exception e) { throw new Error(e); } } throw new IllegalStateException("Failed to find community home path"); } | getCommunityHomePath |
27,371 | void () { weigher = createWeigher(); } | setUp |
27,372 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertGreaterThan(getWeigh("source.php string", selector), 0); assertGreaterThan(getWeigh("text.html source.php", selector), 0); } | testPositiveWeigh |
27,373 | void () { String selector = "source.rust string"; assertEquals(0, getWeigh("source.r string", selector)); } | testDoNotMatchPartialPrefix |
27,374 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertEquals(0, getWeigh("string source.php", selector)); assertEquals(0, getWeigh("source.php text.html", selector)); } | testNegativeWeigh |
27,375 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertGreaterThan(getWeigh("string", selector), getWeigh("source.php", selector)); } | testSelectorInfluence |
27,376 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertGreaterThan(getWeigh("string.quoted", selector), getWeigh("source.php", selector)); } | testNestingInfluence |
27,377 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertGreaterThan(getWeigh("text source string", selector), getWeigh("source string", selector)); } | testMatchesCountInfluence |
27,378 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertEquals(0, getWeigh("text.html source.php - string", selector)); } | testPositiveExcludingSelector |
27,379 | void () { String selector = "text.html.basic source.php.embedded.html string.quoted.double.php"; assertGreaterThan(getWeigh("text.html source.php - ruby", selector), 0); } | testNegativeExcludingSelector |
27,380 | void () { String selector = "foo"; assertGreaterThan(getWeigh(selector, "foo"), 0); } | testMatch |
27,381 | void () { String selector = "foo"; assertEquals(0, getWeigh(selector, "bar")); } | testNonMatch |
27,382 | void () { String selector = "- foo"; assertEquals(0, getWeigh(selector, "foo")); } | testExcludeNonMatch |
27,383 | void () { String selector = "- foo"; assertGreaterThan(getWeigh(selector, "bar"), 0); } | testExcludeMatch |
27,384 | void () { String selector = "- - foo"; assertEquals(0, getWeigh(selector, "bar")); } | testDoubleExcludeNonMatch |
27,385 | void () { String selector = "bar foo"; assertEquals(0, getWeigh(selector, "foo")); } | testComplexSelector_1 |
27,386 | void () { String selector = "bar foo"; assertEquals(0, getWeigh(selector, "bar")); } | testComplexSelector_2 |
27,387 | void () { String selector = "bar foo"; assertGreaterThan(getWeigh(selector, "bar foo"), 0); } | testComplexSelectorMatch |
27,388 | void () { String selector = "bar - foo"; assertGreaterThan(getWeigh(selector, "bar"), 0); } | testComplexWithExcludeMatch |
27,389 | void () { String selector = "bar - foo"; assertEquals(0, getWeigh(selector, "foo bar")); } | testComplexWithExclude_1 |
27,390 | void () { String selector = "bar - foo"; assertEquals(0, getWeigh(selector, "foo")); } | testComplexWithExclude_2 |
27,391 | void () { String selector = "bar, foo"; assertGreaterThan(getWeigh(selector, "bar"), 0); } | testCoupleSelectors_1 |
27,392 | void () { String selector = "bar, foo"; assertGreaterThan(getWeigh(selector, "bar foo"), 0); } | testCoupleSelectors_2 |
27,393 | void () { String selector = "bar, foo"; assertGreaterThan(getWeigh(selector, "foo"), 0); } | testCoupleSelectors_3 |
27,394 | void () { String selector = "bar, -foo"; assertEquals(0, getWeigh(selector, "foo")); } | testCoupleSelectorsWithExclude_3 |
27,395 | void () { String selector = "(foo)"; assertGreaterThan(getWeigh(selector, "foo"), 0); } | testParens |
27,396 | void () { String selector = "(foo - bar)"; assertGreaterThan(getWeigh(selector, "foo"), 0); } | testParensWithExclude_1 |
27,397 | void () { String selector = "(foo - bar)"; assertEquals(0, getWeigh(selector, "foo bar")); } | testParensWithExclude_2 |
27,398 | void () { String selector = "foo bar - (yo man)"; assertGreaterThan(getWeigh(selector, "foo bar"), 0); } | testParensWithExclude_3 |
27,399 | void () { String selector = "foo bar - (yo man)"; assertGreaterThan(getWeigh(selector, "foo bar yo"), 0); } | testParensWithExclude_4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.