What I had to do step by step.
Update to the IDE to the latest version
Download a jvm with loom
Add the loom JDK to the IDE
Set it both to project and to your build tool
Set enable preview and source to 19 as compiler options
to do this, got to prefs -> compiler -> java compiler, uncheck the --release option thing and add the following compiler args for specific project global
--enable-preview --source 19
these are directly passed to javac when it compiles
Set the enable preview on you run configuration
add --enable-preview
as a jvm option (if you don't see it click 'Modify options')
You should be good to go, I faced a bug where sometimes gradle complained that it is not compatible with my JVM, to resovle this I had to switch the gradle VM to java 17, wati for it to build and them back to 19