consulo / consulo-csharp

Languages: C#
Apache License 2.0
50 stars 6 forks source link

Issues with customization #589

Closed zRevenger closed 8 months ago

zRevenger commented 8 months ago

The C# plugin currently seems to have issues with customization. It seems like pages for customization will not load and return errors when trying to access them.

First case scenario (picture below) is oriented towards the "Color & Fonts" section, selecting the language will infinitely load image

The same will happen in the second case (picture below) when trying to change code styles image

Following will be the stack trace for the error returned when trying to access the colo & fonts c# page:

java.lang.NullPointerException
    at java.base/java.io.Reader.<init>(Reader.java:168)
    at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:76)
    at consulo/consulo.util.io@3-SNAPSHOT/consulo.util.io.FileUtil.loadTextAndClose(FileUtil.java:722)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpLanguageCodeStyleSettingsProvider.loadPreview(CSharpLanguageCodeStyleSettingsProvider.java:165)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpLanguageCodeStyleSettingsProvider.getCodeSample(CSharpLanguageCodeStyleSettingsProvider.java:148)
    at consulo/consulo.language.code.style.api@3-SNAPSHOT/consulo.language.codeStyle.setting.LanguageCodeStyleSettingsProvider.getCodeSample(LanguageCodeStyleSettingsProvider.java:117)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CustomizableLanguageCodeStylePanel.getPreviewText(CustomizableLanguageCodeStylePanel.java:79)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.createEditor(CodeStyleAbstractPanel.java:145)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.<init>(CodeStyleAbstractPanel.java:102)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.<init>(CodeStyleAbstractPanel.java:95)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CustomizableLanguageCodeStylePanel.<init>(CustomizableLanguageCodeStylePanel.java:56)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.OptionTreeWithPreviewPanel.<init>(OptionTreeWithPreviewPanel.java:63)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleSpacesPanel.<init>(CodeStyleSpacesPanel.java:28)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel$MySpacesPanel.<init>(TabbedLanguageCodeStylePanel.java:392)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.addSpacesTab(TabbedLanguageCodeStylePanel.java:116)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.initTabs(TabbedLanguageCodeStylePanel.java:92)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeStyleMainPanel.initTabs(CSharpCodeStyleMainPanel.java:39)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.ensureTabs(TabbedLanguageCodeStylePanel.java:145)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.getPreviewText(TabbedLanguageCodeStylePanel.java:224)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.createEditor(CodeStyleAbstractPanel.java:145)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.<init>(CodeStyleAbstractPanel.java:102)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.<init>(TabbedLanguageCodeStylePanel.java:71)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeStyleMainPanel.<init>(CSharpCodeStyleMainPanel.java:33)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeStyleConfigurable.createPanel(CSharpCodeStyleConfigurable.java:39)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractConfigurable.createComponent(CodeStyleAbstractConfigurable.java:52)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.NewCodeStyleSettingsPanel.getPanel(NewCodeStyleSettingsPanel.java:52)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.CodeStyleMainPanel.ensurePanel(CodeStyleMainPanel.java:223)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.CodeStyleMainPanel.ensureCurrentPanel(CodeStyleMainPanel.java:212)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.CodeStyleMainPanel.lambda$onCurrentSchemeChanged$0(CodeStyleMainPanel.java:141)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    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:758)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:854)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:765)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:429)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.progress.CoreProgressManager.computePrioritized(CoreProgressManager.java:771)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:428)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.BaseApplication.runIntendedWriteActionOnCurrentThread(BaseApplication.java:815)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:477)
    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.pumpEventsForFilter(EventDispatchThread.java:121)
    at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191)
    at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236)
    at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234)
    at java.desktop/java.awt.Dialog.show(Dialog.java:1080)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.dialog.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:799)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.dialog.DialogWrapperPeerImpl.lambda$showAsync$4(DialogWrapperPeerImpl.java:545)
    at consulo/consulo.ui.api@3-SNAPSHOT/consulo.ui.UIAccess.lambda$give$1(UIAccess.java:98)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.impl.AWTUIAccessImpl.lambda$give$1(AWTUIAccessImpl.java:77)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    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:758)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:854)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:765)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:429)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.progress.CoreProgressManager.computePrioritized(CoreProgressManager.java:771)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:428)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.BaseApplication.runIntendedWriteActionOnCurrentThread(BaseApplication.java:815)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:477)
    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)
zRevenger commented 8 months ago

Line 165 in CSharpLanguageCodeStyleSettingsProvider.java should be the issue: return FileUtil.loadTextAndClose(CSharpLanguageCodeStyleSettingsProvider.class.getResourceAsStream("/codeStyle" + file));

The path is missing a "/" as the path is "resources/codeStyle/filename" instead of "resources/codeStylefilename" and since this happened when being called from line 148 of the same file which sends the file string as "spacing.txt" that should be it. Lmk if this could work :)

VISTALL commented 8 months ago

Hello. I will test today.

VISTALL commented 8 months ago

Thanks you. You were right about problem. Also I found another issue with UI (not tested after refactoring) - also fixed.

Fix will be in nightly channel (https://consulo.help/platform/settings/platformAndPlugins/updateSettings/)

zRevenger commented 8 months ago

After having to force manual update on platform this error is returned instead:

java.lang.IllegalAccessError: class consulo.csharp.impl.ide.codeStyle.CSharpCodeGenerationSettingsConfigurable (in module consulo.csharp) cannot access class com.intellij.uiDesigner.core.GridLayoutManager (in module forms.rt) because module consulo.csharp does not read module forms.rt
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeGenerationSettingsConfigurable.$$$setupUI$$$(CSharpCodeGenerationSettingsConfigurable.java)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeGenerationSettingsConfigurable.<init>(CSharpCodeGenerationSettingsConfigurable.java:56)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeGenerationSettingsProvider.createSettingsPage(CSharpCodeGenerationSettingsProvider.java:69)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.createTab(TabbedLanguageCodeStylePanel.java:190)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeStyleMainPanel.initTabs(CSharpCodeStyleMainPanel.java:44)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.ensureTabs(TabbedLanguageCodeStylePanel.java:145)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.getPreviewText(TabbedLanguageCodeStylePanel.java:224)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.createEditor(CodeStyleAbstractPanel.java:145)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractPanel.<init>(CodeStyleAbstractPanel.java:102)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.TabbedLanguageCodeStylePanel.<init>(TabbedLanguageCodeStylePanel.java:71)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeStyleMainPanel.<init>(CSharpCodeStyleMainPanel.java:33)
    at consulo.csharp/consulo.csharp@3-SNAPSHOT/consulo.csharp.impl.ide.codeStyle.CSharpCodeStyleConfigurable.createPanel(CSharpCodeStyleConfigurable.java:39)
    at consulo/consulo.language.code.style.ui.api@3-SNAPSHOT/consulo.language.codeStyle.ui.setting.CodeStyleAbstractConfigurable.createComponent(CodeStyleAbstractConfigurable.java:52)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.NewCodeStyleSettingsPanel.getPanel(NewCodeStyleSettingsPanel.java:52)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.CodeStyleMainPanel.ensurePanel(CodeStyleMainPanel.java:223)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.CodeStyleMainPanel.ensureCurrentPanel(CodeStyleMainPanel.java:212)
    at consulo/consulo.ide.impl@3-SNAPSHOT/consulo.ide.impl.idea.application.options.codeStyle.CodeStyleMainPanel.lambda$onCurrentSchemeChanged$0(CodeStyleMainPanel.java:141)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    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:758)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:777)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue._dispatchEvent(IdeEventQueue.java:688)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:370)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.progress.CoreProgressManager.computePrioritized(CoreProgressManager.java:770)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:369)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.BaseApplication.runIntendedWriteActionOnCurrentThread(BaseApplication.java:795)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.dispatchEvent(IdeEventQueue.java:418)
    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.pumpEventsForFilter(EventDispatchThread.java:121)
    at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:191)
    at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:236)
    at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:234)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:234)
    at java.desktop/java.awt.Dialog.show(Dialog.java:1080)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.dialog.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:799)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.dialog.DialogWrapperPeerImpl.lambda$showAsync$4(DialogWrapperPeerImpl.java:545)
    at consulo/consulo.ui.api@3-SNAPSHOT/consulo.ui.UIAccess.lambda$give$1(UIAccess.java:102)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.impl.AWTUIAccessImpl.lambda$give$2(AWTUIAccessImpl.java:98)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    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:758)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:777)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue._dispatchEvent(IdeEventQueue.java:688)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:370)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.progress.CoreProgressManager.computePrioritized(CoreProgressManager.java:770)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:369)
    at consulo/consulo.application.impl@3-SNAPSHOT/consulo.application.impl.internal.BaseApplication.runIntendedWriteActionOnCurrentThread(BaseApplication.java:795)
    at consulo.desktop.awt/consulo.desktop.awt.ide.impl@3-SNAPSHOT/consulo.desktop.awt.ui.IdeEventQueue.dispatchEvent(IdeEventQueue.java:418)
    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)