obiwan87 / odin-intellij

Odin Support plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/22933-odin-support
MIT License
37 stars 3 forks source link

WIP: Using 'odin build' to display errors and warnings #47

Closed Dima-369 closed 2 months ago

Dima-369 commented 2 months ago

There were many issues coming up when adding my code, I am still fixing them, but feel free to check them out as well. My code worked in master apparently.

Issues:

  1. odin build is never run. Is there an issue with canRunOdinBuild()?

  2. Is this an issue? The files exist:

CleanShot 2024-08-13 at 13 49 30@2x

  1. OdinSdkFilesIndexContributor.java crashed, so I added try/catch on indexing some files, maybe the same issue as in 2.?
Dima-369 commented 2 months ago

@obiwan87 would you like to try to fix the issues yourself? The new IntelliJ version behaves differently, apparently.

obiwan87 commented 2 months ago

Thank you for reporting the issues. The OdinFileIndexContributor issue is known to me. The other ones might just be a consequence of files not yet being indexed. I haven't noticed any divergence in behaviour yet. The indexing problem was present before as well. It has to do with the fact that IDEA cancels tasks if they take too much time. So need to create an async task for indexing.

But, yes, I'll fix the more general issues myself. Were you able to build the plugin using 2024.2? Does your code add any additional issues?

Dima-369 commented 2 months ago

Were you able to build the plugin using 2024.2?

Yeah, it works.

Does your code add any additional issues?

Nothing apart what I noted above. I am just a bit sad that the error reporting via odin build doesn't work on 2024.2, and I haven't figured out why 😢

obiwan87 commented 2 months ago

It does work! But if there's other errors in the file - such as the ones produced by my annotator - your annotator will just return.

obiwan87 commented 2 months ago

Here you go: There seems to be a problem with the text ranges

image

Dima-369 commented 2 months ago

It does work! But if there's other errors in the file - such as the ones produced by my annotator - your annotator will just return.

Oh yeah, I see!

obiwan87 commented 2 months ago

Also, you can use odin check 'path to dir or file' --json-errors which should be faster

obiwan87 commented 2 months ago

Anyway, I just fixed some issues with Windows (like the missing ".exe" in the end. Will commit and push in a sec

Dima-369 commented 2 months ago

Also, you can use odin check 'path to dir or file' --json-errors which should be faster

Oh yeah, I was looking for this the whole time. Cool!

It works the same from what I see, can you switch to it?

Dima-369 commented 2 months ago

I also left in many calls to Notifier.notify(... while debugging this PR, those were merged - let's remove/comment them out.

obiwan87 commented 2 months ago

Also, you can use odin check 'path to dir or file' --json-errors which should be faster

Oh yeah, I was looking for this the whole time. Cool!

It works the same from what I see, can you switch to it?

Yes, I will switch to it. It might even make the "Directory to compile" obsolete, as you can indicate a single file.

obiwan87 commented 2 months ago

Ok, just pushed. Can you please test if it works for you on mac?

EDIT: Please regenerate the grammar files, as I had to modify Odin.bnf to support a new feature of Odin