Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDEA 2022.x support #1097

Merged
merged 11 commits into from
Apr 2, 2023
Merged

IDEA 2022.x support #1097

merged 11 commits into from
Apr 2, 2023

Conversation

rosingrind
Copy link
Contributor

Summary

This pull request is made to introduce support for modern IDEA versions starting from 2022.3. Any changes introduced by merging this pull request may break builds for older versions - read next:

Dependencies

All plugin dependencies are upped according to bare minimum 2022.3 support. It's possible to build on any 223.* platform version, 2022.3 and 2022.3.3 tested (entry for flex plugin left questionable as current versionWithMajor pattern does not support patch number)

API updates

Overall, this refactoring contains runtime error fixes, logger library transition and transitions from not only deprecated, but turned down api. Be aware, these types of changes may break building on older versions entirely

  • module intellij-haxe:main is completely transitioned to HaxeDebugLogger to fix clashing with IDEA logger initialization after moving to reload4j, module intellij-haxe:common left unchanged as constraint violation behaviour was not spotted
  • HaxeLineMarkerProvider transitioned to updated LineMarkerInfo generation, but left with DaemonBundle.message() unchanged as modifying messages requires standardization
  • .gradle files include fixes made when booting up main branch from older Gradle, but also includes configuration updates for newer JRE version
  • all other files contains numerous updates and runtime error fixes which may break build on older JRE versions or put down builds for older IDEA version entirely; consider reviewing and testing these changes and updating README.md support info if needed

This pull request close #1083, close #1096

@rosingrind
Copy link
Contributor Author

I recommend you to reconsider older IDEA versions support, as since 2022.* supporting older builds seems not possible. I may be wrong, but I leave this decision up to you for resolution. Adding version-specific patches to barely maintainable open-source project is not an easy engineering, and this may lead the plugin to eternally-stale state

case "2020.2" : plugins.add('com.intellij.flex:202.6397.59'); break
case "2020.3" : plugins.add('com.intellij.flex:203.5981.155'); break
case "2021.1" : plugins.add('com.intellij.flex:211.6693.111'); break
case "2022.3" : plugins.add('com.intellij.flex:223.7571.4'); break
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested specifically on 2022.3, not compatible with 2022.3.3

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its about time we drop support for older versions if they are holding us back due to API changes etc. but perhaps a do a release for all older versions before we move on. it would be nice if we could follow the latest version so people can upgrade their IDEs

case "2020.3" : plugins.add('com.intellij.flex:203.5981.155'); break
case "2021.1" : plugins.add('com.intellij.flex:211.6693.111'); break
case "2022.3" : plugins.add('com.intellij.flex:223.7571.4'); break
case "2022.3.3" : plugins.add('com.intellij.flex:223.8617.9'); break
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested specifically on 2022.3.3, not compatible with 2022.3

@@ -320,13 +328,13 @@ task cleanGenerated(type: Delete, group: 'generate') {
task generateHaxeParser(dependsOn: ':setupTools', type: JavaExec, group: 'generate') {
workingDir = "${toolDir}"
main '-jar'
args = ['grammar-kit.jar', "${generatedSrcDir}", "${grammarHaxe}"]
args = ['--add-opens=java.base/java.lang.reflect=ALL-UNNAMED', '--add-opens=java.base/java.util=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED', 'grammar-kit.jar', "${generatedSrcDir}", "${grammarHaxe}"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these and next jvmArgs are added as reflection is restricted on newer JREs

Copy link

@lppedd lppedd Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these and next jvmArgs are added as reflection is restricted on newer JREs

@rosingrind beware that GrammarKit has a Gradle plugin now, exposing GenerateLexerTask and GenerateParserTask.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally understandable, however the next step you should consider to perform transition to newer versions - dropping gradle-grammar-kit-plugin completely as it does not work as expected, see JetBrains/gradle-grammar-kit-plugin#3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left gradle-grammar-kit-plugin configurations as-is because it haven't introduced new problems yet, but it may do so potentially. Correct implementation of utilizing gradle-grammar-kit-plugin means double-pass generation as there are some clashing problems in gradle JVM and gk-plugin generation steps, see linked issue for more info

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosingrind interesting. I wasn't aware of this, and I see it's a long standing issue too. Good catch, thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have wanted to upgrade grammar-kit and use the plugin but the reason why we stuck with the old version was because newer versions would output different code on different operating systems. but this could have been solved by now, so we could test the plugin and se how it goes

@@ -80,7 +80,7 @@
<depends optional="true" config-file="debugger-support.xml">com.intellij.modules.ultimate</depends>

<!-- Leave the '999' at the start of unreleased version numbers so that it's always newer than any released version. -->
<version>999 Unreleased Post 1.3.1@plugin.dev.version@ for @plugin.compatibility.description@</version>
<version>DEV @plugin.dev.version@ for @plugin.compatibility.description@</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cut as maximum allowed is 64 characters long

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We left the initial number high on purpose, and it got updated as a release step. The primary reason is so that IDEA doesn't go out and try to download the released version over the top of a custom version you're developing. YMMV.

The 64 char limit must be new.

@@ -68,7 +69,8 @@ public HaxePsiBuilder(@NotNull Project project,
@NotNull Lexer lexer,
@NotNull LighterLazyParseableNode chameleon,
@NotNull CharSequence text) {
super(project, parserDefinition, lexer, chameleon, text);
// FIXME: https://github.com/JetBrains/intellij-community/commit/bf92a4bfea21ac1269017a52a347ab32c1a87323#r105729752
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super() call should work unchanged, see commit discussion for clarification

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in JetBrains/intellij-community@be794f3: wait for a release tag, bump plugin SDK and roll back (ASTNode) cast

@m0rkeulv
Copy link
Member

cool, thanks for putting inn all this work, ill try to take a closer look during the weekend :)

@@ -36,7 +36,7 @@
<table width="100%" cellpadding="5px" border="0" style="background-color:rgb(168,75,56);">
<tr">
<td align="right"><b>Documentation:</b></td>
<td align="left"><a style="color:white;" href="http://intellij-haxe.org">Project Web Site</a></td>
<td align="left"><a style="color:white;" href="https://intellij-haxe.org">Project Web Site</a></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self:

  • add Discord info ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note regarding https. The intellij-haxe web site does not have a cert, so can't be addressed using https at this time (you will get a "this web site is not secure" screen from your browser). I don't feel like paying $100/yr to the ISP just to protect a read-only web site that I'm not actively maintaining. If somebody knows how to set up a cert manually that can be deployed without paying the ISP (Ionos), I'm all ears.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use letsencrypt + certbot if you control the system and can install software

(i personally use certbot + bypass as my provider as their certificate lasts longer before you have to renew)

@@ -46,12 +46,6 @@ public boolean isParsable(@NotNull CharSequence buffer, @NotNull Language fileLa
return false;
}

@Override
public PsiBuilder parseLight(ASTNode chameleon) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why this has to be removed, did it break anything ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these methods does not exist anymore

@lppedd
Copy link

lppedd commented Mar 26, 2023

@rosingrind I'd bump to 2023.1 (LATEST-EAP-SNAPSHOT) to check if all keeps working.
Otherwise you'll have to do more work again soon.

@teotigraphix
Copy link

I just have to say, this is really great you have put time into this @rosingrind. I think if this plugin can be maintained, it opens a lot more possibilities for Haxe in the future, for those that use IDEA everyday for food. Thanks again.

@rosingrind
Copy link
Contributor Author

@teotigraphix there are still a lot of improvements (2023.1 just got released), but at least I'm glad I am allowed to put a fresh start for this plugin. If this update happens to be deployed then following support will certainly be easier, and this makes me happy too. Obviously, for any maintainer this is not a small decision to accept such a pull, and I plan to continue on polishing and renovating (by coincidence, I'm interested in this) - so now we just relax and wait

@alexk74
Copy link

alexk74 commented Mar 30, 2023

I was looking for this PR for ages! Thanks for the work you have put up for this.
I managed to build the extension on a mac silicon using java 17.0.6 2023-01-17 LTS, so I can test for the 2022.3 version.
When I open the editor I get:
com.intellij.diagnostic.PluginException: Cannot create extension (class=com.intellij.plugins.haxe.ide.index.HaxeComponentIndex) [Plugin: com.intellij.plugins.haxe] at com.intellij.serviceContainer.ComponentManagerImpl.createError(ComponentManagerImpl.kt:1057) at com.intellij.openapi.extensions.impl.XmlExtensionAdapter.doCreateInstance(XmlExtensionAdapter.kt:70) at com.intellij.openapi.extensions.impl.XmlExtensionAdapter.createInstance(XmlExtensionAdapter.kt:31) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapter(ExtensionPointImpl.java:445) at com.intellij.openapi.extensions.impl.ExtensionPointImpl.access$200(ExtensionPointImpl.java:32) at com.intellij.openapi.extensions.impl.ExtensionPointImpl$1.next(ExtensionPointImpl.java:353)
I have no experience building plugins nor I am a java developer and maybe I've done something wrong. I just want to use the plugin so I can upgrade to 2022.3 so I can use the Copilot :)

@rosingrind
Copy link
Contributor Author

rosingrind commented Mar 30, 2023

@alexk74 honestly, this is not enough info for me to pinpoint an issue, I'm assuming you didn't set up your dev environment correctly. I'll leave pre-built reference version here just in case (tested on 2022.3.3): intellij-haxe-2022.3.zip

Comment on lines 53 to 56
<tr>
<td align="right"><b>Enterprise Support:</b></td>
<td align="left"><a style="color:white;" href="http://bishtonsoftwaresolutions.com/">Bishton Software Solutions</a></td>
<td align="left"><a style="color:white;" href="https://bishtonsoftwaresolutions.com/">Bishton Software Solutions</a></td>
</tr>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop this stanza as there are no customers for Enterprise Support at this time, and I'm not actively involved any more.

</tr>
<tr>
<td align="right"><b>Enterprise Support:</b></td>
<td align="left"><a style="color:white;" href="http://bishtonsoftwaresolutions.com/">Bishton Software Solutions</a></td>
<td align="left"><a style="color:white;" href="https://bishtonsoftwaresolutions.com/">Bishton Software Solutions</a></td>
</tr>
<tr>
Copy link
Member

@EricBishton EricBishton Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same is true for this table row (through line 60), since I no longer am accepting donations via Patreon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the table at (62-66)

@alexk74
Copy link

alexk74 commented Mar 30, 2023

@rosingrind Thanks for the help and for the zip file, I really appreciate it. I managed to open the editor after I installed the plugin from you. When I built it myself, only intellij-haxe.jar was produced, I guess the dependencies should have been built too.

I got a few errors though, but I can work with them.

For the filter function it shows a type mismatch if argument n is typed.

var list:Array<Int> = [1,2,3,4];
list = list.filter((n:Int) -> n%2 == 0);
//Error:Type mismatch (Expected: 'T->Bool' got: 'Int->Bool')

When the editor starts, it throws this plugin exception:

com.intellij.diagnostic.PluginException: Cannot add 'haxe-jps-plugin.jar' from 'Haxe Toolkit Support the '999' at the start of unreleased version @plugin.dev.version@ for @plugin.compatibility.description@' to compiler classpath [Plugin: com.intellij.plugins.haxe]
	at com.intellij.compiler.server.impl.BuildProcessClasspathManager$Companion.findClassesRoot(BuildProcessClasspathManager.kt:137)
	at com.intellij.compiler.server.impl.BuildProcessClasspathManager$Companion.computeCompileServerPluginsClasspath(BuildProcessClasspathManager.kt:152)
	at com.intellij.compiler.server.impl.BuildProcessClasspathManager$Companion.access$computeCompileServerPluginsClasspath(BuildProcessClasspathManager.kt:89)
	at com.intellij.compiler.server.impl.BuildProcessClasspathManager.getStaticClasspath(BuildProcessClasspathManager.kt:82)
	at com.intellij.compiler.server.impl.BuildProcessClasspathManager.getBuildProcessPluginsClasspath(BuildProcessClasspathManager.kt:75)
	at com.intellij.compiler.server.impl.BuildProcessClasspathManager.getBuildProcessClasspath(BuildProcessClasspathManager.kt:44)
	at com.intellij.compiler.server.BuildManager.launchBuildProcess(BuildManager.java:1502)
	at com.intellij.compiler.server.BuildManager.lambda$scheduleBuild$12(BuildManager.java:970)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:243)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:216)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:205)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Also, as a mention, when starting a new project from 2022.3 it does not show the option to create a Haxe project like the 2020 version does.

@EricBishton
Copy link
Member

For the filter function it shows a type mismatch if argument n is typed.

var list:Array<Int> = [1,2,3,4];
list = list.filter((n:Int) -> n%2 == 0);
//Error:Type mismatch (Expected: 'T->Bool' got: 'Int->Bool')

That's a separate bug entirely, having to do with the internal (Haxe) type resolver. Please file it separately. Thanks.

@m0rkeulv m0rkeulv merged commit d2c2229 into HaxeFoundation:develop Apr 2, 2023
@Deirel
Copy link

Deirel commented Apr 11, 2023

@alexk74
I have no experience in building plugins either, but maybe this information will be useful for you.
It seems that after building the plugin with the command:

.\gradlew.bat clean setupDependencies build verifyPlugin -PtargetVersion="2022.3.3"

In the folder build/distributions is a zip-archive with a name like "intellij-haxe-", which contains the necessary dependencies and works correctly.

@Borman2000
Copy link

Do you have plans to get rid of AnnotationHolder's implementation (implemented in HaxeAnnotationHolder) as it marked as @ApiStatus.NonExtendable?
Also most of interface's methods marked @deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use-case suggestion Incompatibility with 2021.1
8 participants