Idea source code download and custom language formatting
My repository configuration is like this.
I can't download the source code of ideaIC:IC-223.7571.182, but I can find this version of the source code jar package from this link 『www.jetbrains.com/intellij-repository/releases』, and I can download it manually and select the source, then the source code of AbstractJavaBlock can be viewed, that means the package I downloaded manually is the one that failed to download when I downloaded it automatically. How is it?
BTW, the reason I wanted to look at AbstractJavaBlock's source code is that I was developing a plugin for a custom language, and then got stuck formatting the nested structure of the code, and wanted to refer to how java does it. The official Custom Language Support Tutorial doesn't have anything on this, only the simplest single-level example. Is there any formatting related tutorials anywhere?
Please sign in to leave a comment.
Is this the key point of code indentation logic when Java implements formatting? Based on left and right curly braces and Indent.getSmartIndent(Indent.Type.CONTINUATION) to implement Indent for sub-level Block?
I looked at kotlin's indentation implementation logic at the same time, and it doesn't seem to implement indentation via Indent as Java does, is it Alignment?
Does this mean that, unlike things like bnf and jflex, intellij doesn't provide an out-of-the-box solution for indentation, but rather lets plugins make judgments and implementations based on their own logic?
Hi,
By default, IDE installers are downloaded, and build versions (like 223.7571.182) don't work. You must use product version: 2022.3 in this case.
If you want to use a build version, disable downloading installers.
Regarding formatter implementation, did you read https://plugins.jetbrains.com/docs/intellij/code-formatting.html?
I apologize, I forgot the definition of
sinceVersion
... But I'm already using the “2022.3” format, so I don't know why it still uses the build version when downloading the source code.As for the indentation when formatting, I've actually seen the link you gave before, I just could never understand it
By learning how other plugins implement it, I've understood what indentation is all about and have successfully implemented it
So now the only problem left is the source code download…
This is the modified
build.gradle.kts
section on idea version settingsBy using the build version number and disabling the installer, I see the idea's source zip download at build time, but I still can only look at AbstractBlock's source, not AbstractJavaBlock and KotlinBlock's.
Seems to have gotten something wrong, it's not the idea's source code that's not downloaded, it seems to be the source code for the java and kotlin plugins?
What needs to be downloaded now is actually the plugin source code, not the idea's source code... Are there any options that need to be specified in this case?
Hi,
For plugin classes, you should get an editor banner with the possibility to download missing sources:
If the sources don't appear, reload the project in the Gradle tool window and try again.
“Download sources -> gradle reload -> download sources”, this process will be retried at least twice after each change to the gradle configuration…
It doesn't work.
But this time I noticed this error message:
Combined with my gradle configuration, is there a certain collection property missing from the configuration somewhere?
Please see https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#attaching-sources if there is any step missed.
If it still doesn't work, I suggest cleaning up your project build and gradle cache directories and trying again. If it still doesn't work, please create an issue at https://github.com/JetBrains/intellij-platform-gradle-plugin/issues with a minimal sample project to reproduce and exact steps.
It still doesn't work, I've got the mre project and screenshots and posted the Issue.