ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
548 stars 129 forks source link

Not Working in intellij 2019.1.1 for golang projects #83

Closed fullstackdev-star closed 5 years ago

fullstackdev-star commented 5 years ago

Screenshot_1 Screenshot_2

I set all like as guide, but not working for golang

ashald commented 5 years ago

Thanks for reporting the issue! How exactly it doesn't work? It crashes with an error or you don't see env vars set? Unfortunately I don't have access to a Windows computer so won't be able to debug directly.

fullstackdev-star commented 5 years ago

Thanks for your reply. If you want, I can provide my pc via teamviewer or anydesk for you to debug. I can not get the env variables from .env file in code.

ashald commented 5 years ago

I hope we will be able to figure it out easier. Could you please share an example of your .env file?

Also, do I understand correctly that you use Intellij 2019.1.1 with Go plugin rather than GoLand?

ashald commented 5 years ago

I was able to get access to a Windows VM and tried the plugin in GoLand 2019.1.2 - it worked as expected: image

ashald commented 5 years ago

It actually worked same way for me in Intellij 2019.1.2 image

Based on that I'd assume that plugin works correctly. Please let me know if you need any help figuring out how your configuration should be adjusted to make it work.

fullstackdev-star commented 5 years ago

Hello, what command line did you use to check the env veriables is useful?

ashald commented 5 years ago

It is in the screenshot above - I used a simple program that just prints all environment variables:

package main

import (
    "fmt"
    "os"
)

func main() {
    for _, e := range os.Environ() {
        fmt.Println(e)
    }
}
fullstackdev-star commented 5 years ago

hmm, it is wired. I can see it is not working Screenshot_6

fullstackdev-star commented 5 years ago

I am using intellij with go module

ashald commented 5 years ago

Can you try this program?

package main

import (
    "fmt"
    "os"
    "strings"
)

func main() {
    for _, e := range os.Environ() {
        if strings.HasPrefix(e, "BOARDCHAIN_") {
            fmt.Println(e)
        }
    }
}

Also, maybe you can make a screenshot similar to one that I posted - that would combine EnvFile configuration and the output on the same screen? Also, can you try updating to 2019.1.2?

fullstackdev-star commented 5 years ago

ok, thanks, let me update

fullstackdev-star commented 5 years ago

Please check this. Screenshot_7 Screenshot_8

ashald commented 5 years ago

If I understand correctly you ran the app typing go run main.go in the terminal - if that's the case then it's not something this plugin supports. You have to run it using "Run Configuration" dialog as on the video below: out

fullstackdev-star commented 5 years ago

Hello, Please check when you would be online. image java.lang.AssertionError: Already disposed: Project (Disposed) BiSu at com.intellij.openapi.components.impl.ComponentManagerImpl.lambda$throwAlreadyDisposed$1(ComponentManagerImpl.java:245) at com.intellij.openapi.application.ReadAction.lambda$run$1(ReadAction.java:53) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:970) at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:57) at com.intellij.openapi.application.ReadAction.run(ReadAction.java:53) at com.intellij.openapi.components.impl.ComponentManagerImpl.throwAlreadyDisposed(ComponentManagerImpl.java:243) at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:236) at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:46) at com.intellij.project.ProjectKt.getStateStore(project.kt:17) at com.intellij.openapi.project.impl.ProjectImpl.getStateStore(ProjectImpl.java:178) at com.intellij.openapi.project.impl.ProjectImpl.getBaseDir(ProjectImpl.java:210) at net.ashald.envfile.platform.EnvFileEntry.getFile(EnvFileEntry.java:108) at net.ashald.envfile.platform.EnvFileEntry.validatePath(EnvFileEntry.java:62) at net.ashald.envfile.platform.ui.table.EnvFilePathColumnInfo$1.getTableCellRendererComponent(EnvFilePathColumnInfo.java:64) at javax.swing.JTable.prepareRenderer(JTable.java:5729) at com.intellij.ui.table.JBTable.prepareRenderer(JBTable.java:546) at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2114) at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:2016) at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1812) at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161) at javax.swing.JComponent.paintComponent(JComponent.java:780) at com.intellij.ui.table.JBTable.paintComponent(JBTable.java:309) at javax.swing.JComponent.paint(JComponent.java:1057) at com.intellij.ui.table.JBTable.paint(JBTable.java:408) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JViewport.paint(JViewport.java:737) at com.intellij.ui.components.JBViewport.paint(JBViewport.java:234) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JComponent.paintChildren(JComponent.java:890) at javax.swing.JComponent.paint(JComponent.java:1066) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5211) at javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1620) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1595) at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1532) at javax.swing.RepaintManager.paint(RepaintManager.java:1299) at javax.swing.JComponent._paintImmediately(JComponent.java:5159) at javax.swing.JComponent.paintImmediately(JComponent.java:4970) at javax.swing.RepaintManager$4.run(RepaintManager.java:848) at javax.swing.RepaintManager$4.run(RepaintManager.java:829) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:829) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:804) at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:753) at javax.swing.RepaintManager.access$1200(RepaintManager.java:71) at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1867) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:734) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:729) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:678) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:373) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109) at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190) at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235) at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233) at java.security.AccessController.doPrivileged(Native Method) at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233) at java.awt.Dialog.show(Dialog.java:1077) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:706) at com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:437) at com.intellij.openapi.ui.DialogWrapper.invokeShow(DialogWrapper.java:1682) at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1631) at com.intellij.openapi.ui.DialogWrapper.showAndGet(DialogWrapper.java:1646) at com.intellij.execution.actions.ChooseRunConfigurationPopup$9.perform(ChooseRunConfigurationPopup.java:1141) at com.intellij.execution.actions.ChooseRunConfigurationPopup$ConfigurationListPopupStep.lambda$onChosen$1(ChooseRunConfigurationPopup.java:494) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$13(AbstractPopup.java:1416) at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:3080) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:159) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:111) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:179) at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:58) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1412) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:160) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:306) at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48) at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44) at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:136) at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:105) at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:214) at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:105) at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:162) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:263) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:442) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:395) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:341) at com.intellij.execution.actions.ChooseRunConfigurationPopup$RunListPopup._handleSelect(ChooseRunConfigurationPopup.java:813) at com.intellij.execution.actions.ChooseRunConfigurationPopup$RunListPopup.handleSelect(ChooseRunConfigurationPopup.java:809) at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:501) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) at java.awt.Component.processMouseEvent(Component.java:6550) at javax.swing.JComponent.processMouseEvent(JComponent.java:3325) at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:555) at java.awt.Component.processEvent(Component.java:6315) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4899) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4721) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4721) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:739) at java.awt.EventQueue$4.run(EventQueue.java:737) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:736) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:729) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:674) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:373) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

ashald commented 5 years ago

I've seen this error reported once in the past but wasn't able to reproduce it so far. It seems that the issue is in a corrupted section of project config. I heard people were able to recover from it by recreating their project but maybe it will be enough to re-create the run configuration. Sorry for the inconvenience.

I also pushed an update v3.1.2 that should try to workaround the issue but it will take about 2 days for JetBrains to approve it. In meantime you can try to install the latest version directly from a file https://github.com/ashald/EnvFile/releases/tag/v3.1.2

Please let me know if you would be able to make it work after all.

fullstackdev-star commented 5 years ago

ok, thanks

ashald commented 5 years ago

Can you confirm if it works for you?

ashald commented 5 years ago

Given no reply I assume everything works fine. Please feel free to re-open if that's not the case.

fullstackdev-star commented 5 years ago

Hello, thanks for your asking. That's working, but sometimes not working