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 95 forks source link

intellij: Cannot distinguish StubFileElementTypes #1021

Open FOXimir opened 11 months ago

FOXimir commented 11 months ago

Hi could you please check this error? Error is visible after starting Pycharm and editing code. Few minutes later (40-120), plugin starts highlight incorrectly, linting stop working and whole plugin is unusable. In order to use plugin again I have to close and reopen Pycharm then I have another 40-120 minutes for my work.

Similar issue described here

Full logs attached in Logs.zip stacktrace.txt:

com.intellij.diagnostic.PluginException: Cannot distinguish StubFileElementTypes. This might worsen the performance. Providing unique externalId or adding a distinctive debugName when instantiating StubFileElementTypes can help (override getExternalId() and/or getDebugName() in StubFileElementType). See attachment for additional information. [Plugin: robocorp.lsp.intellij]
    at com.intellij.psi.stubs.PerFileElementTypeStubModificationTracker.reportStubFileElementTypeVersionConflict(PerFileElementTypeStubModificationTracker.java:281)

To Reproduce Steps to reproduce the behavior:

  1. Open robot file
  2. Start editing file

Expected behavior Extension is working without errors and issues.

Versions:

Logs Logs.zip

okleinke commented 2 months ago

@FOXimir In case you're still interested in a solution: I have created a patch that resolves the issue, here in my fork: https://github.com/okleinke/robotframework-lsp/commit/6544c7e366392f7760e7fda80b746a122a00b47e

I also built a new version here, https://github.com/okleinke/robotframework-lsp/releases/tag/robotframework-lsp-1.12.1, which seems to work fine for me.

I've adapted the missing subclass/overrides mostly from here: https://github.com/YannCebron/m68kplugin/blob/313a3da739b04dfcd26de614e0c8a886a0140cf4/src/com/yanncebron/m68kplugin/lang/M68kFileElementType.java