Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to open editorconfig causes IDE exception #392

Closed
chriswilty opened this issue Dec 6, 2022 · 5 comments
Closed

Attempting to open editorconfig causes IDE exception #392

chriswilty opened this issue Dec 6, 2022 · 5 comments

Comments

@chriswilty
Copy link

plugin version: 0.109-2022.3
IDE: WebStorm 2022.3 (#WS-223.7571.168)

Description

When attempting to open .editorconfig an exception occurs (see stacktrace below).
When I disable ReasonML plugin and restart Webstorm, the file opens as expected.
When I subsequently re-enable plugin and restart Webstorm, same exception occurs and none of my editor tabs opens.

Content of .editorconfig:

root = true

[*]
insert_final_newline = true

[*.{css,html,js,json,res,yml}]
charset = utf-8
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

(note that removing explicit "res" file-ending from pattern above makes no difference)

Stacktrace:

java.lang.NullPointerException: Cannot invoke "com.intellij.openapi.vfs.VirtualFile.exists()" because "this.m_file" is null
	at com.reason.ide.format.ORPostFormatProcessor$ResFormatProcessor.apply(ORPostFormatProcessor.java:132)
	at com.reason.ide.format.ORPostFormatProcessor.processText(ORPostFormatProcessor.java:63)
	at com.intellij.psi.impl.source.codeStyle.CoreCodeStyleUtil.postProcessText(CoreCodeStyleUtil.java:104)
	at com.intellij.formatting.service.CoreFormattingService.lambda$formatRanges$0(CoreFormattingService.java:64)
	at com.intellij.psi.impl.source.codeStyle.CoreCodeStyleUtil.postProcessRanges(CoreCodeStyleUtil.java:94)
	at com.intellij.formatting.service.CoreFormattingService.formatRanges(CoreFormattingService.java:64)
	at com.intellij.formatting.service.FormattingServiceUtil.formatRanges(FormattingServiceUtil.java:93)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:167)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:132)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:114)
	at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.reformatText(CodeStyleManagerImpl.java:109)
	at org.editorconfig.configmanagement.editor.EditorConfigPreviewFile.lambda$reformat$0(EditorConfigPreviewFile.java:80)
	at com.intellij.application.options.CodeStyle.doWithTemporarySettings(CodeStyle.java:308)
	at org.editorconfig.configmanagement.editor.EditorConfigPreviewFile.lambda$reformat$1(EditorConfigPreviewFile.java:79)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:955)
	at org.editorconfig.configmanagement.editor.EditorConfigPreviewFile.lambda$reformat$2(EditorConfigPreviewFile.java:72)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:210)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150)
	at org.editorconfig.configmanagement.editor.EditorConfigPreviewFile.reformat(EditorConfigPreviewFile.java:70)
	at org.editorconfig.configmanagement.editor.EditorConfigPreviewFile.<init>(EditorConfigPreviewFile.java:41)
	at org.editorconfig.configmanagement.editor.EditorConfigEditorProvider$MyEditorBuilder.build(EditorConfigEditorProvider.java:87)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.createComposite(FileEditorManagerImpl.java:1174)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4Edt(FileEditorManagerImpl.java:1068)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$openFileImpl4$18(FileEditorManagerImpl.java:1036)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.runBulkTabChange(FileEditorManagerImpl.java:1894)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$openFileImpl4$19(FileEditorManagerImpl.java:1035)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:408)
	at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:441)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4(FileEditorManagerImpl.java:1030)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.lambda$openFileImpl2$13(FileEditorManagerImpl.java:939)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:210)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl2(FileEditorManagerImpl.java:938)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:818)
	at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:778)
	at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.java:131)
	at com.intellij.codeInsight.navigation.NavigationUtil.activatePsiElementIfOpen(NavigationUtil.java:202)
	at com.intellij.codeInsight.navigation.NavigationUtil.lambda$openFileWithPsiElement$2(NavigationUtil.java:171)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150)
	at com.intellij.codeInsight.navigation.NavigationUtil.openFileWithPsiElement(NavigationUtil.java:170)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.navigate(AbstractPsiBasedNode.java:268)
	at com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode.navigate(AbstractPsiBasedNode.java:278)
	at com.intellij.ide.projectView.impl.nodes.PsiFileNode.navigate(PsiFileNode.java:116)
	at com.intellij.util.OpenSourceUtil.navigateToSource(OpenSourceUtil.java:126)
	at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:81)
	at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:59)
	at com.intellij.util.OpenSourceUtil.navigate(OpenSourceUtil.java:52)
	at com.intellij.util.OpenSourceUtil.openSourcesFrom(OpenSourceUtil.java:20)
	at com.intellij.util.EditSourceOnDoubleClickHandler$TreeMouseListener.processDoubleClick(EditSourceOnDoubleClickHandler.java:172)
	at com.intellij.util.EditSourceOnDoubleClickHandler$TreeMouseListener.onDoubleClick(EditSourceOnDoubleClickHandler.java:166)
	at com.intellij.ui.DoubleClickListener.onClick(DoubleClickListener.java:30)
	at com.intellij.ui.ClickListener$1.mouseReleased(ClickListener.java:59)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392)
	at com.intellij.ui.treeStructure.Tree.processMouseEvent(Tree.java:424)
	at com.intellij.ide.dnd.aware.DnDAwareTree.processMouseEvent(DnDAwareTree.java:44)
	at java.desktop/java.awt.Component.processEvent(Component.java:6413)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:909)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:831)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:753)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:774)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:813)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
@chriswilty
Copy link
Author

Thank you for this lovely plugin by the way, is making ReScript development a pleasant experience! VS Code is all well and good, but Webstorm is my IDE of choice.

giraud added a commit that referenced this issue Dec 6, 2022
@giraud
Copy link
Owner

giraud commented Dec 6, 2022

it should be fixed in 0.109.1

@giraud giraud closed this as completed Dec 6, 2022
@chriswilty
Copy link
Author

Thank you so much for the rapid turnaround! Will try it out.

@chriswilty
Copy link
Author

chriswilty commented Dec 8, 2022

Ah, I just saw the note in the README saying ReScript support is on pause, and specifically that code reformatting is not supported for ReScript; I had been wondering why formatting wasn't now working with editorconfig 🤦‍♂️

Is there an issue for tracking formatting of rescript files? I or others might be able to contribute, at least to the discussion, if we know what the problems are.

@giraud
Copy link
Owner

giraud commented Dec 9, 2022

oops, it’s an error, rescript dev has restarted. and format should work.
I invite you to create a discussion in this github repo or go to discord if you want to talk about formatting, this is not related to this bug :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants