robocorp / robotframework-lsp

Robocorp extensions for VS Code: Robocorp Code and RFW LSP
https://robocorp.com/docs/developer-tools/visual-studio-code
Apache License 2.0
206 stars 93 forks source link

StartupAbortedException when starting PyCharm with RF LS #240

Closed Noordsestern closed 3 years ago

Noordsestern commented 3 years ago

Describe the bug I download the zip file for PyCharm from latest build (0.7.1) and installed it in PyCharm Community Edition. When starting, I get the several exceptions starting with this one:

com.intellij.ide.plugins.StartupAbortedException: Fatal error initializing 'com.intellij.psi.stubs.StubUpdatingIndex'
    at com.intellij.serviceContainer.ComponentManagerImplKt.handleComponentError(ComponentManagerImpl.kt:1071)
    at com.intellij.util.indexing.FileBasedIndexDataInitialization.lambda$initAssociatedDataForExtensions$0(FileBasedIndexDataInitialization.java:71)
    at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.executeNestedInitializationTask(IndexInfrastructure.java:174)
    at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.runParallelNestedInitializationTasks(IndexInfrastructure.java:162)
    at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.call(IndexInfrastructure.java:123)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ExceptionInInitializerError
    at robocorp.robot.intellij.RobotFrameworkFileType.<init>(RobotFrameworkFileType.java:14)
    at robocorp.robot.intellij.RobotFrameworkFileType.<clinit>(RobotFrameworkFileType.java:11)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:398)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.instantiateFileTypeBean(FileTypeManagerImpl.java:410)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.mergeOrInstantiateFileTypeBean(FileTypeManagerImpl.java:384)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.instantiatePendingFileTypes(FileTypeManagerImpl.java:376)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.getRegisteredFileTypes(FileTypeManagerImpl.java:730)
    at com.intellij.psi.stubs.StubUpdatingIndex.instantiateElementTypesFromFields(StubUpdatingIndex.java:577)
    at com.intellij.psi.stubs.StubUpdatingIndex.lambda$ensureSerializationManagerInitialized$0(StubUpdatingIndex.java:569)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:218)
    at com.intellij.psi.stubs.StubUpdatingIndex.ensureSerializationManagerInitialized(StubUpdatingIndex.java:568)
    at com.intellij.psi.stubs.StubUpdatingIndex.getValueExternalizer(StubUpdatingIndex.java:336)
    at com.intellij.util.indexing.FileBasedIndexImpl.createIndexStorage(FileBasedIndexImpl.java:484)
    at com.intellij.util.indexing.FileBasedIndexImpl.initIndexStorage(FileBasedIndexImpl.java:431)
    at com.intellij.util.indexing.FileBasedIndexImpl.registerIndexer(FileBasedIndexImpl.java:398)
    at com.intellij.util.indexing.FileBasedIndexDataInitialization.lambda$initAssociatedDataForExtensions$0(FileBasedIndexDataInitialization.java:65)
    ... 16 more
Caused by: java.lang.RuntimeException: Unable to discover __main__.py location.
Resource file: home/daedalus/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/203.7148.72.plugins/robotframework-intellij/lib/robotframework-intellij-0.7.1.jar!/robotframework-intellij-resource.txt
Details:
Target location:
home/daedalus/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/203.7148.72.plugins/robotframework-intellij/lib/robotframework_ls/__main__.py
Target location:
home/daedalus/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/203.7148.72.plugins/robotframework-intellij/robotframework_ls/__main__.py

    at robocorp.robot.intellij.RobotFrameworkLanguage.getMain(RobotFrameworkLanguage.java:213)
    at robocorp.robot.intellij.RobotFrameworkLanguage.createProcessBuilderFromPreferences(RobotFrameworkLanguage.java:113)
    at robocorp.robot.intellij.RobotFrameworkLanguage.<init>(RobotFrameworkLanguage.java:44)
    at robocorp.robot.intellij.RobotFrameworkLanguage.<clinit>(RobotFrameworkLanguage.java:29)
    ... 36 more

To Reproduce

Do I probably need to configure some path to my virtual python environment in the plugin settings? Or do plugins use the python path automatically already that is provided by PyCharm?

Thank you! I am excited to finally have found the PyCharm plugin :)

Markus

fabioz commented 3 years ago

Sorry about that.

It should be fixed in the build in: https://github.com/robocorp/robotframework-lsp/actions/runs/554375389

csonuryilmaz commented 3 years ago

Hi @fabioz, As far as I understand this commit should fix the error.

Today I've installed PyCharm 2020.3.4 CE and installed IDE recommended plugins for Robot Framework test development.

But I'm getting the same error IMHO:

Screen Shot 2021-03-18 at 19 21 00
com.intellij.ide.plugins.StartupAbortedException: Fatal error initializing 'com.intellij.psi.stubs.StubUpdatingIndex'
    at com.intellij.serviceContainer.ComponentManagerImplKt.handleComponentError(ComponentManagerImpl.kt:1071)
    at com.intellij.util.indexing.FileBasedIndexDataInitialization.lambda$initAssociatedDataForExtensions$0(FileBasedIndexDataInitialization.java:71)
    at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.executeNestedInitializationTask(IndexInfrastructure.java:174)
    at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.runParallelNestedInitializationTasks(IndexInfrastructure.java:162)
    at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.call(IndexInfrastructure.java:123)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ExceptionInInitializerError
    at robocorp.robot.intellij.RobotFrameworkFileType.<init>(RobotFrameworkFileType.java:14)
    at robocorp.robot.intellij.RobotFrameworkFileType.<clinit>(RobotFrameworkFileType.java:11)
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:398)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.instantiateFileTypeBean(FileTypeManagerImpl.java:410)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.mergeOrInstantiateFileTypeBean(FileTypeManagerImpl.java:384)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.instantiatePendingFileTypes(FileTypeManagerImpl.java:376)
    at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.getRegisteredFileTypes(FileTypeManagerImpl.java:730)
    at com.intellij.psi.stubs.StubUpdatingIndex.instantiateElementTypesFromFields(StubUpdatingIndex.java:577)
    at com.intellij.psi.stubs.StubUpdatingIndex.lambda$ensureSerializationManagerInitialized$0(StubUpdatingIndex.java:569)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:218)
    at com.intellij.psi.stubs.StubUpdatingIndex.ensureSerializationManagerInitialized(StubUpdatingIndex.java:568)
    at com.intellij.psi.stubs.StubUpdatingIndex.getValueExternalizer(StubUpdatingIndex.java:336)
    at com.intellij.util.indexing.FileBasedIndexImpl.createIndexStorage(FileBasedIndexImpl.java:484)
    at com.intellij.util.indexing.FileBasedIndexImpl.initIndexStorage(FileBasedIndexImpl.java:431)
    at com.intellij.util.indexing.FileBasedIndexImpl.registerIndexer(FileBasedIndexImpl.java:398)
    at com.intellij.util.indexing.FileBasedIndexDataInitialization.lambda$initAssociatedDataForExtensions$0(FileBasedIndexDataInitialization.java:65)
    ... 16 more
Caused by: java.lang.RuntimeException: Unable to discover __main__.py location.
Resource file: /Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework-intellij-0.9.1.jar!/robotframework-intellij-resource.txt
Details:
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework-intellij-0.9.1./robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework-intellij-0.9.1./robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/JetBrains/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/Application%20Support/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/Library/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/robotframework_ls/__main__.py
Target location:
/Users/onuryilmaz/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/Users/robotframework_ls/__main__.py
Target location:
/Users/robotframework-ls/src/robotframework_ls/__main__.py
Target location:
/robotframework_ls/__main__.py
Target location:
/robotframework-ls/src/robotframework_ls/__main__.py

    at robocorp.robot.intellij.RobotFrameworkLanguage.getMain(RobotFrameworkLanguage.java:248)
    at robocorp.robot.intellij.RobotFrameworkLanguage.createProcessBuilderFromPreferences(RobotFrameworkLanguage.java:143)
    at robocorp.robot.intellij.RobotFrameworkLanguage.<init>(RobotFrameworkLanguage.java:54)
    at robocorp.robot.intellij.RobotFrameworkLanguage.<clinit>(RobotFrameworkLanguage.java:32)
    ... 36 more

Do you have any recommendations?

fabioz commented 3 years ago

That is really weird...

I think it may be because of the %20 in:

/Users/onuryilmaz/Library/Application%20Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework_ls/__main__.py

Can you check if the file exists at:

/Users/onuryilmaz/Library/Application Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework_ls/__main__.py?

fabioz commented 3 years ago

I made a fix (based on the assumption that it was a url-quoting issue).

Please do the following: uninstall the version you have there, get the artifacts from: https://github.com/robocorp/robotframework-lsp/actions/runs/665287608 and install that version locally to see if it fixes the issue for you (if it does fix it I'll do a new release with it as that seems pretty critical).

fabioz commented 3 years ago

@csonuryilmaz Note: to install it, you need to extract that file locally and then head on to File > Settings > Plugins, click on the gear icon and then choose to Install plugin from disk, then select the robotframework-intellij-0.9.1.zip you just extracted.

csonuryilmaz commented 3 years ago

.. get the artifacts from: https://github.com/robocorp/robotframework-lsp/actions/runs/665287608

I got the artifacts. intellij-distribution.zip

.. you need to extract that file locally

I extracted archive.

Screen Shot 2021-03-19 at 06 28 18

.. then select the robotframework-intellij-0.9.1.zip you just extracted.

But it doesn't contain any .zip file. I can't find robotframework-intellij-0.9.1.zip in extracted folder.

I tried to "install plugin from disk" function on robotframework-intellij-0.9.1.jar but got another error message.

Screen Shot 2021-03-19 at 06 32 44

I think that's because of other dependencies (.jar files) in the folder. I have to install them all together.

csonuryilmaz commented 3 years ago

@fabioz This is a late answer from me to your previous question (before fix):

.. Can you check if the file exists at:

/Users/onuryilmaz/Library/Application Support/JetBrains/PyCharmCE2020.3/plugins/robotframework-intellij/lib/robotframework_ls/main.py?

Screen Shot 2021-03-19 at 06 38 16

Yes, file exists. Although you've made the fix, I'm answering in order to provide you more feedback. 🙏

fabioz commented 3 years ago

Ok... your zip program is probably unzipping twice as it's a .zip with a single .zip inside it...

Anyways, I've just done a release which should address your case as well as improve some other things (such as semantic highlighting).

It should be available in the Intellij Marketplace soon, but you can already download it at: https://plugins.jetbrains.com/plugin/16086-robot-framework-language-server/versions/stable/114294 (in this case, you can just get that .zip and install it without unzipping it).

Please let me know if it works for you.

csonuryilmaz commented 3 years ago

.. but you can already download it at:

Ok, I've downloaded (v0.10.0) and after fix that error disappeared. Thanks. 🙏

But now there is another exception not related w/ previous one, maybe it should be discussed in another issue.

Screen Shot 2021-03-20 at 10 26 54

Full stack trace: error.txt

It seems to be related w/ FeatureSemanticHighlighting.