Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
267,400
void (@NotNull @NlsContexts.NotificationTitle String title, @NotNull @NlsContexts.NotificationContent String message) { if (myStateRef.compareAndSet(FormattingRequestState.RUNNING, FormattingRequestState.COMPLETED)) { myTaskSemaphore.release(); FormattingNotificationService.getInstance(myContext.getProject()).reportErr...
onError
267,401
void (@NotNull @NlsContexts.NotificationTitle String title, @NotNull @NlsContexts.NotificationContent String message, int offset) { if (myStateRef.compareAndSet(FormattingRequestState.RUNNING, FormattingRequestState.COMPLETED)) { myTaskSemaphore.release(); FormattingNotificationService.getInstance(myContext.getProject(...
onError
267,402
AnAction[] (@NotNull FormattingContext context) { return AnAction.EMPTY_ARRAY; }
getTimeoutActions
267,403
void (@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(false); indicator.setFraction(0.0); runAsyncFormat(myRequest, indicator); indicator.setFraction(1.0); }
run
267,404
void () { myRequest.cancel(); }
onCancel
267,405
FormattingNotificationService (@NotNull Project project) { if (ApplicationManager.getApplication().isHeadlessEnvironment()) { return HeadlessNotificationService.INSTANCE; } else { return project.getService(FormattingNotificationService.class); } }
getInstance
267,406
PsiElement (@NotNull PsiElement element, boolean canChangeWhiteSpaceOnly) { return formatElement(element, element.getTextRange(), canChangeWhiteSpaceOnly); }
formatElement
267,407
PsiElement (@NotNull PsiElement element, @NotNull TextRange range, boolean canChangeWhiteSpaceOnly) { PsiFile file = element.getContainingFile(); FormattingContext formattingContext = FormattingContext.create(file, range, CodeStyle.getSettings(file), FormattingMode.REFORMAT); PsiDocumentManager documentManager = PsiDoc...
formatElement
267,408
void (@NotNull PsiFile file, FormattingRangesInfo rangesInfo, boolean canChangeWhiteSpaceOnly, boolean quickFormat) { TextRange boundRange = ObjectUtils.notNull(rangesInfo.getBoundRange(), file.getTextRange()); FormattingContext formattingContext = FormattingContext.create(file, boundRange, CodeStyle.getSettings(file),...
formatRanges
267,409
void (@NotNull PsiFile file, @NotNull Document document) { file.putUserData(DOCUMENT_KEY, document); }
setDocument
267,410
Set<ImportOptimizer> (@NotNull PsiFile file) { return Collections.emptySet(); }
getImportOptimizers
267,411
void (@NotNull String groupId, @NotNull String title, @NotNull String message) { System.err.println(title + ": " + message); }
reportError
267,412
void (@NotNull String groupId, @NotNull String title, @NotNull String message, @NotNull FormattingContext context, int offset) { reportError(groupId, title, message); }
reportErrorAndNavigate
267,413
FormattingModelBuilder (@NotNull PsiElement context) { return forContext(context.getLanguage(), context); }
forContext
267,414
FormattingModelBuilder (@NotNull Language language, @NotNull PsiElement context) { for (LanguageFormattingRestriction each : LanguageFormattingRestriction.EP_NAME.getExtensionList()) { if (!each.isFormatterAllowed(context)) return null; } FormattingModelBuilder builder = findCustomFormattingModelBuilder(language, conte...
forContext
267,415
FormattingModelBuilder (@NotNull Language language, @NotNull PsiElement context) { for (FormattingModelBuilder builder : allForLanguage(language)) { if (builder instanceof CustomFormattingModelBuilder custom) { if (custom.isEngagedToFormat(context)) return builder; } } return null; }
findCustomFormattingModelBuilder
267,416
boolean (@NotNull PsiElement context) { return ContainerUtil.and(LanguageFormattingRestriction.EP_NAME.getExtensionList(), each -> each.isAutoFormatAllowed(context)); }
isAutoFormatAllowed
267,417
DefaultCodeStyleSettingsFacade (@NotNull Language language) { myLanguage = language; return this; }
withLanguage
267,418
CommonCodeStyleSettings () { return mySettings.getCommonSettings(myLanguage); }
getCommonSettings
267,419
int () { return getIndentOptions().TAB_SIZE; }
getTabSize
267,420
int () { return getIndentOptions().INDENT_SIZE; }
getIndentSize
267,421
boolean () { return getCommonSettings().SPACE_BEFORE_COMMA; }
isSpaceBeforeComma
267,422
boolean () { return getCommonSettings().SPACE_AFTER_COMMA; }
isSpaceAfterComma
267,423
boolean () { return getCommonSettings().SPACE_AROUND_ASSIGNMENT_OPERATORS; }
isSpaceAroundAssignmentOperators
267,424
CodeStyleSettings () { //noinspection deprecation return CodeStyleSettingsManager.getInstance().getCurrentSettings(); }
getDefaultSettings
267,425
CodeStyleSettings (@NotNull Project project) { //noinspection deprecation return CodeStyleSettingsManager.getInstance(project).getCurrentSettings(); }
getSettings
267,426
CodeStyleSettings (@Nullable Project project) { return project != null ? getSettings(project) : getDefaultSettings(); }
getProjectOrDefaultSettings
267,427
CodeStyleSettings (@NotNull Project project, @NotNull VirtualFile file) { @SuppressWarnings("TestOnlyProblems") CodeStyleSettings tempSettings = CodeStyleSettingsManager.getInstance(project).getTemporarySettings(); if (tempSettings != null) { return tempSettings; } CodeStyleSettings cachedSettings = CodeStyleCachingSer...
getSettings
267,428
CodeStyleSettings (@NotNull PsiFile file) { final Project project = file.getProject(); CodeStyleSettingsManager settingsManager = CodeStyleSettingsManager.getInstance(project); CodeStyleSettings localSettings = settingsManager.getLocalSettings(); if (localSettings != null) { return localSettings; } @SuppressWarnings("T...
getSettings
267,429
PsiFile (@NotNull PsiFile file) { if (hasLocalVirtualFile(file)) return file; PsiFile originalFile = file.getUserData(PsiFileFactory.ORIGINAL_FILE); if (originalFile != null) { return getSettingsPsi(originalFile); } return null; }
getSettingsPsi
267,430
boolean (@NotNull PsiFile file) { VirtualFile virtualFile = file.getVirtualFile(); return virtualFile != null && virtualFile.isInLocalFileSystem(); }
hasLocalVirtualFile
267,431
CodeStyleSettings (@NotNull Project project, @NotNull Document document) { PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document); return file != null ? getSettings(file) : getSettings(project); }
getSettings
267,432
CodeStyleSettings (@NotNull Editor editor) { Project project = editor.getProject(); VirtualFile file = editor.getVirtualFile(); if (file != null && project != null) { return getSettings(project, file); } return getDefaultSettings(); }
getSettings
267,433
CommonCodeStyleSettings (@NotNull Editor editor) { Project project = editor.getProject(); if (project != null) { PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (file != null) { return getLanguageSettings(file); } } return null; }
getLanguageSettings
267,434
CommonCodeStyleSettings (@NotNull PsiFile file) { CodeStyleSettings rootSettings = getSettings(file); return rootSettings.getCommonSettings(file.getLanguage()); }
getLanguageSettings
267,435
CommonCodeStyleSettings (@NotNull PsiFile file, @NotNull Language language) { CodeStyleSettings rootSettings = getSettings(file); return rootSettings.getCommonSettings(language); }
getLanguageSettings
267,436
int (@NotNull PsiFile file) { return getIndentOptions(file).INDENT_SIZE; }
getIndentSize
267,437
void (@Nullable Project project, @NotNull CodeStyleSettings settings) { CodeStyleSettingsManager.getInstance(project).setTemporarySettings(settings); }
setTemporarySettings
267,438
void (@Nullable Project project) { CodeStyleSettingsManager codeStyleSettingsManager; if (project == null || project.isDefault()) { codeStyleSettingsManager = ApplicationManager.getApplication().getServiceIfCreated(AppCodeStyleSettingsManager.class); } else { codeStyleSettingsManager = project.getServiceIfCreated(Proje...
dropTemporarySettings
267,439
void (@NotNull Project project, @NotNull CodeStyleSettings localSettings, @NotNull Runnable runnable) { CodeStyleSettingsManager.getInstance(project).runWithLocalSettings(localSettings, runnable); }
runWithLocalSettings
267,440
void (@NotNull Project project, @NotNull CodeStyleSettings tempSettings, @NotNull Runnable runnable) { final CodeStyleSettingsManager settingsManager = CodeStyleSettingsManager.getInstance(project); CodeStyleSettings tempSettingsBefore = settingsManager.getTemporarySettings(); try { settingsManager.setTemporarySettings...
doWithTemporarySettings
267,441
void (@NotNull Project project, @NotNull CodeStyleSettings baseSettings, @NotNull Consumer<? super CodeStyleSettings> tempSettingsConsumer) { final CodeStyleSettingsManager settingsManager = CodeStyleSettingsManager.getInstance(project); CodeStyleSettings tempSettingsBefore = settingsManager.getTemporarySettings(); try...
doWithTemporarySettings
267,442
boolean (@NotNull Project project) { return CodeStyleSettingsManager.getInstance(project).USE_PER_PROJECT_SETTINGS; }
usesOwnSettings
267,443
void (@NotNull Project project, @NotNull CodeStyleSettings settings) { CodeStyleSettingsManager codeStyleSettingsManager = CodeStyleSettingsManager.getInstance(project); codeStyleSettingsManager.setMainProjectCodeStyle(settings); codeStyleSettingsManager.USE_PER_PROJECT_SETTINGS = true; }
setMainProjectSettings
267,444
boolean (@NotNull PsiFile file) { return !getSettings(file).getExcludedFiles().contains(file); }
isFormattingEnabled
267,445
void (@NotNull PsiFile fileToReformat, @NotNull PsiFile contextFile) { final Project project = contextFile.getProject(); CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project); CodeStyleSettings realFileSettings = getSettings(contextFile); runWithLocalSettings(project, realFileSettings, () -> codeSty...
reformatWithFileContext
267,446
CodeStyleSettings (@Nullable CodeStyleSettings baseSettings) { return CodeStyleSettingsManager.createTestSettings(baseSettings); }
createTestSettings
267,447
String (@NotNull Editor editor, @Nullable Language language, int offset, boolean allowDocCommit) { Project project = editor.getProject(); if (project == null) return null; LineIndentProvider lineIndentProvider = LineIndentProviderEP.findLineIndentProvider(language); String indent = lineIndentProvider != null ? lineInde...
getLineIndent
267,448
String (@Nullable Project project, @NotNull final Document document, int offset) { if (project == null) return null; PsiDocumentManager.getInstance(project).commitDocument(document); return CodeStyleManager.getInstance(project).getLineIndent(document, offset); }
getLineIndent
267,449
int (@NotNull Editor editor, @Nullable Language language, int offset, boolean allowDocCommit) { Project project = editor.getProject(); if (project == null) return 0; LineIndentProvider lineIndentProvider = LineIndentProviderEP.findLineIndentProvider(language); int space = lineIndentProvider instanceof JoinedLinesSpacin...
getJoinedLinesSpacing
267,450
CodeStyleSettings () { return CodeStyleSettingsManager.createTestSettings(null); }
createTestSettings
267,451
CodeStyleSettingsFacade (@NotNull PsiFile file) { return new DefaultCodeStyleSettingsFacade(getSettings(file), file.getFileType()); }
getFacade
267,452
CodeStyleSettingsFacade (@NotNull Project project, @NotNull Document document, @NotNull FileType fileType) { PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); return new DefaultCodeStyleSettingsFacade(psiFile == null ? getSettings(project) : getSettings(psiFile), fileType); }
getFacade
267,453
CommonCodeStyleSettings (Editor editor, int offset) { PsiFile psiFile = PsiEditorUtil.getPsiFile(editor); Language language = PsiUtilCore.getLanguageAtOffset(psiFile, offset); return getLanguageSettings(psiFile, language); }
getLocalLanguageSettings
267,454
CodeStyleCachingService (@NotNull Project project) { return project.getService(CodeStyleCachingService.class); }
getInstance
267,455
int (@NotNull Document document, @Nullable Project project, int startOffset, int endOffset, int maxPreferredOffset, boolean allowToBeyondMaxPreferredOffset, boolean isSoftWrap) { if (endOffset <= startOffset) { return endOffset; } myOffset2weight.clear(); myOffset2weight.anchor = startOffset; CharSequence text = docume...
calculateWrapPosition
267,456
boolean (@NotNull Document document, int offset, boolean virtual) { return true; }
canUseOffset
267,457
boolean (char c) { return c == '_' || c == '$' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }
isIdSymbol
267,458
int () { if (myOffset2weight.end <= 0) { return -1; } final double[] resultingWeight = new double[1]; final int[] resultingOffset = new int[1]; for (int i = myOffset2weight.end - 1; i >= 0; i--) { if (myOffset2weight.data[i] == 0) { continue; } if (resultingWeight[0] <= 0) { resultingWeight[0] = myOffset2weight.data[i]...
chooseOffset
267,459
void (int key, double value) { int index = key - anchor; if (index >= data.length) { int newLength = data.length << 1; while (newLength <= index && newLength > 0) { newLength <<= 1; } data = ArrayUtil.realloc(data, newLength); } data[index] = value; if (index >= end) { end = index + 1; } }
store
267,460
void () { anchor = 0; end = 0; Arrays.fill(data, 0); }
clear
267,461
LineWrapPositionStrategy (@NotNull Editor editor) { LineWrapPositionStrategy result = getDefaultImplementation(); Project project = editor.getProject(); if (project != null && !project.isDisposed()) { PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile != null) { resu...
forEditor
267,462
LineWrapPositionStrategy () { return super.getDefaultImplementation(); }
getDefaultImplementation
267,463
void (@NotNull Editor editor) { SelectionModel selectionModel = editor.getSelectionModel(); if(!selectionModel.hasSelection()) return; int selectionStart = selectionModel.getSelectionStart(); int selectionEnd = selectionModel.getSelectionEnd(); CaretModel caretModel = editor.getCaretModel(); if (editor.isColumnMode() &...
deleteSelectedText
267,464
void (@NotNull Editor editor, @NotNull String s) { insertStringAtCaret(editor, s, false, true); }
insertStringAtCaret
267,465
int (@NotNull Editor editor, @NotNull String s, boolean toProcessOverwriteMode) { return insertStringAtCaret(editor, s, toProcessOverwriteMode, s.length()); }
insertStringAtCaret
267,466
int (@NotNull Editor editor, @NotNull String s, boolean toProcessOverwriteMode, boolean toMoveCaret) { return insertStringAtCaret(editor, s, toProcessOverwriteMode, toMoveCaret, s.length()); }
insertStringAtCaret
267,467
int (@NotNull Editor editor, @NotNull String s, boolean toProcessOverwriteMode, int caretShift) { return insertStringAtCaret(editor, s, toProcessOverwriteMode, true, caretShift); }
insertStringAtCaret
267,468
int (@NotNull Editor editor, @NotNull String s, boolean toProcessOverwriteMode, boolean toMoveCaret, int caretShift) { int result = insertStringAtCaretNoScrolling(editor, s, toProcessOverwriteMode, toMoveCaret, caretShift); if (toMoveCaret) { scrollToCaret(editor); } return result; }
insertStringAtCaret
267,469
int (@NotNull Editor editor, @NotNull String s, boolean toProcessOverwriteMode, boolean toMoveCaret, int caretShift) { // There is a possible case that particular soft wraps become hard wraps if the caret is located at soft wrap-introduced virtual // space, hence, we need to give editor a chance to react accordingly. e...
insertStringAtCaretNoScrolling
267,470
String (@NotNull Editor editor) { int afterLineEnd = calcAfterLineEnd(editor); if (afterLineEnd > 0) { return calcStringToFillVirtualSpace(editor, afterLineEnd); } return ""; }
calcStringToFillVirtualSpace
267,471
String (@NotNull Editor editor, int afterLineEnd) { final Project project = editor.getProject(); StringBuilder buf = new StringBuilder(); final Document doc = editor.getDocument(); final int caretOffset = editor.getCaretModel().getOffset(); boolean atLineStart = caretOffset >= doc.getTextLength() || doc.getLineStartOff...
calcStringToFillVirtualSpace
267,472
void (@NotNull Editor editor) { if (editor.getCaretModel().getCurrentCaret() == editor.getCaretModel().getPrimaryCaret()) { editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } }
scrollToCaret
267,473
int (@NotNull Editor editor) { CaretModel caretModel = editor.getCaretModel(); int caretOffset = caretModel.getOffset(); LogicalPosition logicalPosition = caretModel.getLogicalPosition(); VisualPosition visualPosition = caretModel.getVisualPosition(); return calcAfterLineEnd(editor, caretOffset, logicalPosition, visual...
calcAfterLineEnd
267,474
int (@NotNull Editor editor, int caretOffset, @NotNull LogicalPosition logicalPosition, @NotNull VisualPosition visualPosition) { Document document = editor.getDocument(); int lineNumber = logicalPosition.line; int columnNumber = logicalPosition.column; if (lineNumber >= document.getLineCount()) { return columnNumber; ...
calcAfterLineEnd
267,475
PostprocessReformattingAspect (@NotNull Project project) { return PomManager.getModel(project).getModelAspect(PostprocessReformattingAspect.class); }
getInstance
267,476
Element () { return myState; }
getState
267,477
void (@NotNull Element state) { myState = state; }
loadState
267,478
void (@NotNull CodeStyleSettings rootSettings, @NotNull CustomCodeStyleSettingsFactory factory) { CustomCodeStyleSettings customSettings = factory.createCustomSettings(rootSettings); if (customSettings != null) { synchronized (myCustomSettings) { myCustomSettings.put(customSettings.getClass().getName(), customSettings)...
addCustomSettings
267,479
CustomCodeStyleSettings (@NotNull String customSettingsClassName) { for (final CustomCodeStyleSettingsFactory factory : CodeStyleSettingsService.getInstance().getCustomCodeStyleSettingsFactories()) { CustomCodeStyleSettings customSettings = factory.createCustomSettings(myRootSettings); if (customSettings != null && cus...
createCustomSettings
267,480
void (@NotNull CustomCodeStyleSettings customSettings) { for (String tagName : customSettings.getKnownTagNames()) { if (myUnknownCustomElements.containsKey(tagName)) { restoreCustomSettings(customSettings); return; } } synchronized (myCustomSettings) { myCustomSettings.put(customSettings.getClass().getName(), customSet...
registerCustomSettings
267,481
void (@NotNull CustomCodeStyleSettings customSettings) { Element tempElement = new Element("temp"); for (String tagName : customSettings.getKnownTagNames()) { Element unknown = myUnknownCustomElements.get(tagName); if (unknown != null) { tempElement.addContent(unknown.clone()); } } customSettings.readExternal(tempEleme...
restoreCustomSettings
267,482
void (@NotNull CustomCodeStyleSettingsFactory factory) { CustomCodeStyleSettings defaultSettings = factory.createCustomSettings(CodeStyleSettings.getDefaults()); if (defaultSettings != null) { synchronized (myCustomSettings) { CustomCodeStyleSettings customSettings = myCustomSettings.get(defaultSettings.getClass().getN...
unregisterCustomSettings
267,483
Language () { Language language = Language.findLanguageByID(myLangId); if (language == null) { LOG.error("Can't find the language with ID " + myLangId); return Language.ANY; } return language; }
getLanguage
267,484
IndentOptions () { myIndentOptions = new IndentOptions(); return myIndentOptions; }
initIndentOptions
267,485
CodeStyleSettings () { return myRootSettings; }
getRootSettings
267,486
IndentOptions () { return myIndentOptions; }
getIndentOptions
267,487
ArrangementSettings () { return myArrangementSettings; }
getArrangementSettings
267,488
void (@NotNull ArrangementSettings settings) { myArrangementSettings = settings; }
setArrangementSettings
267,489
void (boolean value) { myForceArrangeMenuAvailable = value; }
setForceArrangeMenuAvailable
267,490
boolean () { return myForceArrangeMenuAvailable; }
isForceArrangeMenuAvailable
267,491
CommonCodeStyleSettings (@NotNull CodeStyleSettings rootSettings) { CommonCodeStyleSettings commonSettings = new CommonCodeStyleSettings(myLangId); copyPublicFields(this, commonSettings); commonSettings.setRootSettings(rootSettings); commonSettings.myForceArrangeMenuAvailable = myForceArrangeMenuAvailable; if (myIndent...
clone
267,492
void (Object from, Object to) { assert from != to; ReflectionUtil.copyFields(to.getClass().getFields(), from, to); }
copyPublicFields
267,493
void (@NotNull CommonCodeStyleSettings source) { copyPublicFields(source, this); if (myIndentOptions != null) { CommonCodeStyleSettings.IndentOptions sourceIndentOptions = source.getIndentOptions(); if (sourceIndentOptions != null) { myIndentOptions.copyFrom(sourceIndentOptions); } } setSoftMargins(source.getSoftMargin...
copyFrom
267,494
void (Element element) { //noinspection deprecation DefaultJDOMExternalizer.readExternal(this, element); if (myIndentOptions != null) { Element indentOptionsElement = element.getChild(INDENT_OPTIONS_TAG); if (indentOptionsElement != null) { myIndentOptions.deserialize(indentOptionsElement); } } Element arrangementRules...
readExternal
267,495
void (Element element) { LanguageCodeStyleProvider provider = LanguageCodeStyleProvider.forLanguage(getLanguage()); if (provider != null) { writeExternal(element, provider); } }
writeExternal
267,496
void (@NotNull Element element, @NotNull LanguageCodeStyleProvider provider) { CommonCodeStyleSettings defaultSettings = provider.getDefaultCommonSettings(); Set<String> supportedFields = provider.getSupportedFields(); if (supportedFields != null) { supportedFields.add("FORCE_REARRANGE_MODE"); } else { return; } //noin...
writeExternal
267,497
boolean (@NotNull Field field) { if (mySupportedFieldNames != null && mySupportedFieldNames.contains(field.getName())) { return super.test(field); } return false; }
test
267,498
boolean (@NotNull String methodName) { if (!StringUtil.equals(BUILDER_METHODS, myCachedBuilderMethods)) { myCachedBuilderMethods = BUILDER_METHODS; myBuilderMethodsNameCache.clear(); Arrays.stream(BUILDER_METHODS.split(",")) .filter(chunk -> !StringUtil.isEmptyOrSpaces(chunk)) .forEach(chunk -> { myBuilderMethodsNameCa...
isBuilderMethod
267,499
void (Element element) { deserialize(element); }
readExternal