Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
48,100
boolean () { return true; }
isCommunity
48,101
void () { String name = getTestName(true); myFixture.configureByFile(name + "_before" + ".editorconfig"); EditorConfigGenerateLanguagePropertiesAction.generateProperties(getProject(), myFixture.getEditor(), EditorConfigLanguage.INSTANCE); myFixture.checkResultByFile(name + "_after" + ".editorconfig"); }
testGenerateProperties
48,102
boolean () { return true; }
isCommunity
48,103
String () { return "/plugins/editorconfig/testData/org/editorconfig/language/codeinsight/actions/generate/"; }
getBasePath
48,104
void (String[] args) { System.out.println("Hello, world!"); }
main
48,105
Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, EditorconfigIcons.class.getClassLoader(), cacheKey, flags); }
load
48,106
void (Project project, String id, @Nls String message) { String value = PropertiesComponent.getInstance(project).getValue("editorconfig.notification"); if (id.equals(value)) { return; } NotificationGroup group = NotificationGroupManager.getInstance().getNotificationGroup(GROUP_DISPLAY_ID); Notifications.Bus.notify(grou...
error
48,107
String (String globString) { StringBuilder result = new StringBuilder(); Glob glob = new Glob(globString); try { Method m = glob.getClass().getDeclaredMethod("convertGlobToRegEx", String.class, List.class, StringBuilder.class); m.setAccessible(true); m.invoke(glob, globString, new ArrayList<>(), result); } catch (NoSuc...
globToRegEx
48,108
boolean (@NotNull VirtualFile file) { return myEditorConfigIndentOptions; }
areActionsAvailable
48,109
AnAction (@NotNull Project project) { return EditorConfigActionUtil.createDisableAction(project, EditorConfigBundle.message("action.disable")); }
createDisableAction
48,110
String () { return myEditorConfigIndentOptions ? Utils.EDITOR_CONFIG_NAME : null; }
getHint
48,111
boolean () { return false; }
isShowFileIndentOptionsEnabled
48,112
AnAction[] (@NotNull PsiFile file) { EditorConfigNavigationActionsFactory navigationActionsFactory = EditorConfigNavigationActionsFactory.Companion.getInstance(file); if (navigationActionsFactory == null) { return AnAction.EMPTY_ARRAY; } List<AnAction> actions = new ArrayList<>(navigationActionsFactory.getNavigationAct...
createNavigationActions
48,113
AnAction (@NotNull Project project, @NotNull @Nls String message) { return DumbAwareAction.create( message, e -> { EditorConfigSettings settings = CodeStyle.getSettings(project).getCustomSettings(EditorConfigSettings.class); settings.ENABLED = false; CodeStyleSettingsManager.getInstance(project).notifyCodeStyleSettings...
createDisableAction
48,114
void (@NotNull Project project) { EditorConfigDisabledNotification notification = new EditorConfigDisabledNotification(project); notification.notify(project); }
showDisabledDetectionNotification
48,115
void (@NotNull AnActionEvent e) { ShowSettingsUtilImpl.showSettingsDialog(e.getProject(), "preferences.sourceCode", "EditorConfig"); }
actionPerformed
48,116
void (@NotNull AnActionEvent e) { final CodeStyleSettings rootSettings = CodeStyle.getSettings(myProject); EditorConfigSettings settings = rootSettings.getCustomSettings(EditorConfigSettings.class); settings.ENABLED = true; CodeStyleSettingsManager.getInstance(myProject).notifyCodeStyleSettingsChanged(); myNotification...
actionPerformed
48,117
AnAction () { return new DumbAwareAction(EditorConfigBundle.message("editor.config.files.show")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { Project project = e.getProject(); if (project != null) { showEditorConfigFiles(e.getProject(), e); } } }; }
createShowEditorConfigFilesAction
48,118
void (@NotNull AnActionEvent e) { Project project = e.getProject(); if (project != null) { showEditorConfigFiles(e.getProject(), e); } }
actionPerformed
48,119
void (@NotNull Project project, @NotNull AnActionEvent event) { SearchEverywhereManager seManager = SearchEverywhereManager.getInstance(project); String searchProviderID = SearchEverywhereManagerImpl.ALL_CONTRIBUTORS_GROUP_ID; if (seManager.isShown()) { if (!searchProviderID.equals(seManager.getSelectedTabID())) { seMa...
showEditorConfigFiles
48,120
StripTrailingSpacesFilter (@Nullable Project project, @NotNull Document document) { if (project != null) { PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document); if (file != null) { EditorConfigTrailingSpacesOptionsProvider optionsProvider = TrailingSpacesOptionsProvider.EP_NAME.findExtension(Edit...
createFilter
48,121
NavigationItem[] () { return myItems.isEmpty() ? NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY : myItems.toArray(NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY); }
getItems
48,122
void () { }
done
48,123
EditorConfigPsiFile (@NotNull Project project, @NotNull VirtualFile virtualFile) { Document document = FileDocumentManager.getInstance().getDocument(virtualFile); if (document != null) { PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); if (psiFile instanceof EditorConfigPsiFile) { return ...
getPsiFile
48,124
void (@NotNull VirtualFile root, @NotNull Callback callback) { for (VirtualFile parentDir = root.getParent(); parentDir != null; parentDir = parentDir.getParent()) { VirtualFile editorConfig = getEditorConfigUnder(parentDir); if (editorConfig != null) { if (callback.found(editorConfig) == Callback.Result.Stop) { return...
searchParentEditorConfigs
48,125
VirtualFile (@NotNull VirtualFile dir) { for (VirtualFile file : dir.getChildren()) { if (isEditorConfig(file)) { return file; } } return null; }
getEditorConfigUnder
48,126
boolean (@NotNull VirtualFile file) { return Utils.EDITOR_CONFIG_FILE_NAME.equals(file.getName()); }
isEditorConfig
48,127
void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { final PsiElement position = parameters.getPosition(); if (isAfterSeparator(position) && position.textMatches(CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) { result.addElement(LookupElementBuilder.c...
addCompletions
48,128
boolean (@NotNull PsiElement position) { PsiElement parent = position.getParent(); if (parent == null) return false; PsiElement prev = parent.getPrevSibling(); if (prev instanceof PsiWhiteSpace) prev = prev.getPrevSibling(); return prev != null && prev.getNode().getElementType() == EditorConfigElementTypes.SEPARATOR; }
isAfterSeparator
48,129
JComponent () { myForm = new CreateEditorConfigForm(myProject); return myForm.getTopPanel(); }
createCenterPanel
48,130
EditorConfigPropertyKind[] () { EnumSet<EditorConfigPropertyKind> kinds = EnumSet.noneOf(EditorConfigPropertyKind.class); if (myForm.isStandardProperties()) { kinds.add(EditorConfigPropertyKind.EDITOR_CONFIG_STANDARD); } if (myForm.isIntelliJProperties()) { kinds.add(EditorConfigPropertyKind.LANGUAGE); kinds.add(Editor...
getPropertyKinds
48,131
boolean () { return myForm.isRoot(); }
isRoot
48,132
boolean () { return myForm.isCommentProperties(); }
isCommentProperties
48,133
List<Language> () { return myForm.getSelectedLanguages(); }
getLanguages
48,134
void (JComponent component, float factor) { final Dimension originalDim = component.getMinimumSize(); final Dimension newDim = new Dimension(originalDim.width, Math.round(originalDim.height * factor)); component.setMinimumSize(newDim); }
adjustVerticalSize
48,135
void (ActionEvent e) { final boolean addProperties = myIntelliJPropertiesCb.isSelected() || myStandardPropertiesCb.isSelected(); setLanguagePanelEnabled(addProperties); myCommentProperties.setEnabled(addProperties); }
actionPerformed
48,136
List<LanguageCheckBoxRec> (JPanel languagesPanel) { List<LanguageCheckBoxRec> checkBoxes = new ArrayList<>(); JPanel currPanel = null; int rowCount = 0; for (Language language : LanguageCodeStyleSettingsProvider.getLanguagesWithCodeStyleSettings()) { LanguageCodeStyleSettingsProvider provider = LanguageCodeStyleSetting...
creteLanguageCheckBoxes
48,137
void (boolean enabled) { myLanguagesPanel.setEnabled(enabled); for (LanguageCheckBoxRec checkBoxRec : myLanguageCheckBoxes) { checkBoxRec.myCheckBox.setEnabled(enabled && isLanguageCheckBoxEnabled(checkBoxRec)); } }
setLanguagePanelEnabled
48,138
boolean (LanguageCheckBoxRec checkBoxRec) { if (!myIntelliJPropertiesCb.isSelected()) { CodeStyleSettings settings = CodeStyle.getSettings(myProject); CommonCodeStyleSettings.IndentOptions langOptions = settings.getLanguageIndentOptions(checkBoxRec.myLanguage); final CommonCodeStyleSettings.IndentOptions commonIndentOp...
isLanguageCheckBoxEnabled
48,139
JPanel () { JPanel colPanel = new JPanel(); colPanel.setLayout(new BoxLayout(colPanel, BoxLayout.Y_AXIS)); colPanel.setAlignmentY(Component.TOP_ALIGNMENT); return colPanel; }
createLanguageColumnPanel
48,140
void () { myAboutEditorConfigLink = new BrowserLink( EditorConfigBundle.message("export.editor.config.about"), "http://www.editorconfig.org"); myAboutEditorConfigLink.setIconTextGap(0); myAboutEditorConfigLink.setHorizontalTextPosition(SwingConstants.LEFT); myContextHelpLabel = ContextHelpLabel.create("", EditorConfigB...
createUIComponents
48,141
JPanel () { return myTopPanel; }
getTopPanel
48,142
List<Language> () { return myLanguageCheckBoxes.stream() .filter(rec -> rec.myCheckBox.isSelected()) .map(rec -> rec.myLanguage).collect(Collectors.toList()); }
getSelectedLanguages
48,143
boolean () { return myCommentProperties.isSelected(); }
isCommentProperties
48,144
void (@NotNull AnActionEvent e) { Project project = e.getProject(); if (project != null) { CreateEditorConfigDialog dialog = new CreateEditorConfigDialog(project); if (dialog.showAndGet()) { final IdeView view = getIdeView(e); if (view != null) { CodeStyleSettings settings = CodeStyle.getSettings(project); PsiDirectory...
actionPerformed
48,145
PsiFile (@NotNull Project project, @NotNull VirtualFile file) { Document document = FileDocumentManager.getInstance().getDocument(file); if (document != null) { return PsiDocumentManager.getInstance(project).getPsiFile(document); } return null; }
getPsiFile
48,146
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
48,147
void (@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); if (PlatformUtils.isRider()) { presentation.setVisible(false); return; } IdeView view = getIdeView(e); if (view != null) { presentation.setVisible(e.getProject() != null && isAvailableFor(view.getDirectories())); } else { presentation.se...
update
48,148
boolean (PsiDirectory @NotNull [] dirs) { for (PsiDirectory dir : dirs) { if (dir.getVirtualFile().getFileSystem().isReadOnly()) { return false; } } return dirs.length > 0; }
isAvailableFor
48,149
boolean () { return true; }
isDumbAware
48,150
IdeView (@NotNull AnActionEvent e) { return e.getData(LangDataKeys.IDE_VIEW); }
getIdeView
48,151
File (@NotNull VirtualFile dir) { return new File(dir.getPath() + File.separator + ".editorconfig"); }
getOutputFile
48,152
VirtualFile (@NotNull VirtualFile outputDir, @NotNull File outputFile, @NotNull Project project, @NotNull CodeStyleSettings settings, boolean isRoot, boolean commentOutProperties, @NotNull List<Language> languages, EditorConfigPropertyKind @NotNull ... propertyKinds) { try { VirtualFile target = outputDir.createChildDa...
export
48,153
void (@NotNull Exception e) { LOG.warn(e); Notifications.Bus.notify( new Notification(EditorConfigNotifier.GROUP_DISPLAY_ID, EditorConfigBundle.message("notification.title.editorconfig.creation.failed"), e.getMessage(), NotificationType.ERROR)); }
notifyFailed
48,154
CodeInsightActionHandler () { return HANDLER; }
getHandler
48,155
boolean (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { if (file instanceof EditorConfigPsiFile) { int currOffset = editor.getCaretModel().getOffset(); if (currOffset == file.getTextLength() && currOffset > 0) currOffset --; PsiElement contextElement = file.findElementAt(currOffset); if (con...
isValidForFile
48,156
void (@NotNull Project project, @NotNull Editor editor, @NotNull Language language) { LanguagePropertiesGenerator.generateProperties(project, editor, language); }
generateProperties
48,157
boolean () { return false; }
startInWriteAction
48,158
void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { ListPopup languagePopup = createLanguagePopup(project, file, editor); languagePopup.showInBestPositionFor(editor); }
invoke
48,159
void (@NotNull Project project, @NotNull Editor editor, @NotNull Language language) { LanguageCodeStyleSettingsProvider provider = LanguageCodeStyleSettingsProvider.forLanguage(language); if (provider != null) { ByteArrayOutputStream output = new ByteArrayOutputStream(); try ( EditorConfigSettingsWriter writer = new Ed...
generateProperties
48,160
ListPopup (@NotNull Project project, @NotNull PsiFile file, @NotNull Editor editor) { DefaultActionGroup languageGroup = new DefaultActionGroup(); Set<Language> preferredLanguages = getPreferredLanguages(file, editor.getCaretModel().getOffset()); getSupportedLanguages().stream() .sorted((l1, l2) -> { if (preferredLangu...
createLanguagePopup
48,161
List<Language> () { return LanguageCodeStyleSettingsProvider.getAllProviders() .stream() .filter(provider -> provider.supportsExternalFormats()) .map(provider -> provider.getLanguage()) .sorted((l1, l2) -> l1.getDisplayName().compareToIgnoreCase(l2.getDisplayName())) .collect(Collectors.toList()); }
getSupportedLanguages
48,162
Set<Language> (@NotNull PsiFile file, int offset) { Set<Language> languages = new HashSet<>(); int currOffset = offset == file.getTextLength() && offset > 0 ? offset - 1 : offset; PsiElement contextElement = file.findElementAt(currOffset); if (contextElement != null) { EditorConfigHeader header = findHeader(contextElem...
getPreferredLanguages
48,163
EditorConfigHeader (@NotNull PsiElement contextElement) { if (contextElement instanceof PsiWhiteSpace) { PsiElement prev = contextElement.getPrevSibling(); if (prev instanceof EditorConfigSection) { return ((EditorConfigSection)prev).getHeader(); } } PsiElement parent = contextElement.getParent(); while (parent != null...
findHeader
48,164
String () { return "editorconfig"; }
getExtension
48,165
String (@NotNull String schemeName) { return ""; }
getDefaultFileName
48,166
VirtualFile (@Nullable Project project) { if (project != null) { @SuppressWarnings("deprecation") VirtualFile baseDir = project.getBaseDir(); if (baseDir != null) { return baseDir; } } return super.getDefaultDir(project); }
getDefaultDir
48,167
EditorConfigPropertyKind (@NotNull String name) { if (PROPERTY_KIND_MAP.containsKey(name)) { return PROPERTY_KIND_MAP.get(name); } return LANGUAGE; }
getPropertyKind
48,168
void () { AbstractCodeStylePropertyMapper mapper = new AbstractCodeStylePropertyMapper(CodeStyleSettings.getDefaults()) { @NotNull @Override protected List<CodeStyleObjectDescriptor> getSupportedFields() { List<CodeStyleObjectDescriptor> descriptors = new ArrayList<>(); descriptors.add(new CodeStyleObjectDescriptor(new...
collectCommonLanguageProperties
48,169
List<CodeStyleObjectDescriptor> () { List<CodeStyleObjectDescriptor> descriptors = new ArrayList<>(); descriptors.add(new CodeStyleObjectDescriptor(new CommonCodeStyleSettings(Language.ANY), null)); descriptors.add(new CodeStyleObjectDescriptor(new CommonCodeStyleSettings.IndentOptions(), null)); return descriptors; }
getSupportedFields
48,170
String () { return "any"; }
getLanguageDomainId
48,171
String (@NotNull String externalName) { return null; }
getPropertyDescription
48,172
boolean (@NotNull VirtualFile file) { return true; }
areActionsAvailable
48,173
String () { return EditorConfigBundle.message("action.group.title"); }
getActionGroupTitle
48,174
String () { return EditorConfigBundle.message("config.code.style.overridden"); }
getTooltip
48,175
AnAction (@NotNull Project project) { return EditorConfigActionUtil.createDisableAction(project, EditorConfigBundle.message("action.disable")); }
createDisableAction
48,176
String (@NotNull PsiFile psiFile) { IndentOptions fileOptions = CodeStyle.getSettings(psiFile).getIndentOptionsByFile(psiFile); String indentInfo = IndentStatusBarUIContributor.getIndentInfo(fileOptions); IndentOptions projectOptions = CodeStyle.getSettings(psiFile.getProject()).getIndentOptions(psiFile.getFileType());...
getStatusText
48,177
AnAction (@NotNull Project project) { return EditorConfigActionUtil.createShowEditorConfigFilesAction(); }
createShowAllAction
48,178
Icon () { return AllIcons.Ide.ConfigFile; }
getIcon
48,179
List<String> (@NotNull AbstractCodeStylePropertyMapper mapper, @NotNull String propertyName) { if (isIgnored(propertyName)) { return Collections.emptyList(); } return switch (IntellijPropertyKindMap.getPropertyKind(propertyName)) { case EDITOR_CONFIG_STANDARD -> List.of(propertyName); case LANGUAGE -> mapper instanceof...
toEditorConfigNames
48,180
String (@NotNull AbstractCodeStylePropertyMapper mapper, @NotNull String propertyName) { return IDE_PREFIX + mapper.getLanguageDomainId() + "_" + propertyName; }
getLanguageProperty
48,181
String (@NotNull String editorConfigName) { return StringUtil.trimStart(StringUtil.trimStart(editorConfigName, IDE_PREFIX), GENERIC_PROPERTY_PREFIX); }
toIntellijName
48,182
String (@NotNull String propertyName) { if (propertyName.startsWith(IDE_PREFIX)) { String id = StringUtil.trimStart(propertyName, IDE_PREFIX); int separatorPos = id.indexOf("_"); if (separatorPos > 0) { id = id.substring(0, separatorPos); return id; } } return null; }
extractLanguageDomainId
48,183
boolean (@NotNull String propertyName) { propertyName = StringUtil.trimStart(propertyName, IDE_PREFIX); return "indent_size".equals(propertyName) || "indent_style".equals(propertyName) || "tab_width".equals(propertyName) || "continuation_indent_size".equals(propertyName); }
isIndentProperty
48,184
boolean (@NotNull String propertyName) { // TODO<rv>: Provide an API instead of a hardcoded value return "uniform_indent".equals(propertyName); }
isIgnored
48,185
Lexer () { return PlatformUtils.isRider() ? new EditorConfigLexerAdapter() : new MyLexerAdapter(new IntellijEditorConfigLexerAdapter()); }
getAdapter
48,186
MergeFunction () { return new MergeFunction() { @Override public IElementType merge(IElementType type, Lexer originalLexer) { if (!IDENTIFIER_TOKENS.contains(type)) { return type; } while (true) { final IElementType tokenType = originalLexer.getTokenType(); if (!IDENTIFIER_TOKENS.contains(tokenType)) break; originalLex...
getMergeFunction
48,187
IElementType (IElementType type, Lexer originalLexer) { if (!IDENTIFIER_TOKENS.contains(type)) { return type; } while (true) { final IElementType tokenType = originalLexer.getTokenType(); if (!IDENTIFIER_TOKENS.contains(tokenType)) break; originalLexer.advance(); } return EditorConfigElementTypes.IDENTIFIER; }
merge
48,188
IElementType () { IElementType tokenType = super.getTokenType(); if ( tokenType == EditorConfigElementTypes.DOT && myState == AdapterState.Value) { return IntellijEditorConfigTokenTypes.VALUE_CHAR; } return tokenType; }
getTokenType
48,189
void () { super.advance(); if (getTokenText().contains("\n")) { myState = AdapterState.Initial; } else { if (getCurrentPosition().getState() > 0) { myState = AdapterState.Header; } else { final IElementType tokenType = getTokenType(); switch (myState) { case Initial -> { if (tokenType == EditorConfigElementTypes.IDENTI...
advance
48,190
EditorConfigSettings (@NotNull Project project) { return CodeStyle.getSettings(project).getCustomSettings(EditorConfigSettings.class); }
getEditorConfigSettings
48,191
PsiFile (@NotNull FileType fileType) { return PsiFileFactory.getInstance(myProject) .createFileFromText("preview", fileType, myDocument.getText(), LocalTimeCounter.currentTime(), false); }
createPsi
48,192
void (@NotNull CodeStyleSettingsChangeEvent event) { VirtualFile virtualFile = event.getVirtualFile(); if (virtualFile == null || isOriginalFile(virtualFile)) { reformat(); } }
codeStyleSettingsChanged
48,193
boolean (@NotNull VirtualFile file) { return file.getPath().equals(myOriginalPath); }
isOriginalFile
48,194
void () { if (!myProject.isInitialized()) return; CommandProcessor.getInstance().executeCommand( myProject, () -> ApplicationManager.getApplication().runWriteAction( () -> { PsiFile originalPsiFile = resolveOriginalPsi(); if (originalPsiFile != null) { CodeStyleSettings settings = CodeStyle.getSettings(originalPsiFile)...
reformat
48,195
void () { if (System.currentTimeMillis() - myLastChangeTime > CHECK_DELAY && myDocument.getModificationStamp() != myLastDocStamp) { myLastDocStamp = myDocument.getModificationStamp(); for (InactivityListener listener : myListeners) { try { listener.onInactivity(); } catch (Exception e) { LOG.error(e); } } } }
checkLastUpdate
48,196
void (@NotNull DocumentEvent event) { myLastChangeTime = System.currentTimeMillis(); myLastDocStamp = event.getOldTimeStamp(); }
documentChanged
48,197
Element () { Element state = new Element("previewData"); for (String key : myPreviewMap.keySet()) { String value = myPreviewMap.get(key); if (value != null) { Element previewRec = new Element(PREVIEW_RECORD_TAG); previewRec.setAttribute(EDITORCONFIG_FILE_ATTR, key); previewRec.setAttribute(PREVIEW_FILE_ATTR, value); st...
getState
48,198
void (@NotNull Element state) { for (Element previewRec : state.getChildren(PREVIEW_RECORD_TAG)) { String key = previewRec.getAttributeValue(EDITORCONFIG_FILE_ATTR); String value = previewRec.getAttributeValue(PREVIEW_FILE_ATTR); if (key != null && value != null) { myPreviewMap.put(key, value); } } }
loadState
48,199
EditorConfigPreviewManager (@NotNull Project project) { return project.getService(EditorConfigPreviewManager.class); }
getInstance