<@UBBFK40RZ> I'd like to follow up on <this proble...
# github-workflows-kt
p
@Nikky I'd like to follow up on this problem with IntelliJ not seeing the dependencies. If you still have this code around, could you paste it in the thread so that I can try reproducing? In general, depending on these server-side bindings works for me, so I'm wondering maybe you're using an older version of IntelliJ? If we don't manage to figure out what the cause is, let's report to JB
another idea for a root cause: since there are 11 action dependencies, you might get unlucky and none/little were cached on the server, making Kotlin script wait for building the JARs on the fly. Then, some timeout might happen. Maybe try removing some deps and see if it works?
looking at IDE logs also can give some clues
code from your screenshot:
Copy code
#!/usr/bin/env kotlin

@file:Repository("<https://repo1.maven.org/maven2/>")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.14.0")
@file:Repository("<https://github-workflows-kt-bindings.colman.com.br/binding/>")
@file:DependsOn("actions:checkout:v4")
@file:DependsOn("actions:setup-java:v4")
@file:DependsOn("actions:setup-node:v4")
@file:DependsOn("actions:github-script:v7")
@file:DependsOn("google-github-actions:auth:v2")
@file:DependsOn("google-github-actions:setup-gcloud:v2")
@file:DependsOn("gradle:actions__setup-gradle:v3")
@file:DependsOn("gradle:gradle-build-action:v3")
@file:DependsOn("docker:setup-buildx-action:v3")
@file:DependsOn("docker:build-push-action:v5")
@file:DependsOn("8398a7:action-slack:v3")
"works on my machine" 😛
Copy code
IntelliJ IDEA 2023.3.2 (Community Edition)
Build #IC-233.13135.103, built on December 20, 2023
Runtime version: 17.0.9+7-b1087.9 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.4.1
GC: G1 Young Generation, G1 Old Generation
Memory: 1024M
Cores: 8
Metal Rendering is ON
Registry:
  debugger.new.tool.window.layout=true
  ide.experimental.ui=true
Non-Bundled Plugins:
  IdeaVIM (2.10.2)
  kotest-plugin-intellij (1.3.74-IC-2023.3)
  com.nbadal.ktlint (0.22.0)
Kotlin: 233.13135.103-IJ
there's 2024.1 already, let me update and check there
works there as well
n
IntelliJ IDEA 2023.3.3 (Community Edition) might try updating the fact that it also shows the warning "file not found" for this line though
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.14.0")
makes me think there is something more fundamentally different in the setup that makes it break or work
🤔 1
p
maybe try on your colleague's machine
n
same problems there
p
n
i have those open.. and all i can see is it failing to find a appleboy/ssh-action .. but thats not even in the dependencies anymore
😅 1
p
do these log lines have current timestamps? does the IDE keep looking for this action?
n
so either its caching agressively and not logging when its loading that .. or the IDE thinks everything is fine
p
could you try run such script from the console? at least there I know where the Kotlin compiler caches compiler scripts
n
certainly seems like its the correct logfile, last lines look like so..
Copy code
2024-04-12 15:01:06,768 [ 614276]   INFO - #c.i.o.v.n.p.FSRecords - 1401102 file records checked: 1137339 children, 17443 contents
👍 1
p
so the next thing I'd check is if the Kotlin compiler alone also displays this behavior
n
well.. the compiler works.. idea also has it all figured out.. once i make it refresh the file.. or auto reload is enabled then highlighting and autocompletion just works.. the annoying part is just.. not knowing which dependencies work because they are all marked as errors
p
what is exactly marked as errors? actually using the class? can you share a screenshot?
n
updating idea right now... wanna bet this just randomly works now ?
🎲 1
yep... somehow now its behaving... maybe it was the restart.. maybe something else... there was a screenshot of this in the othe thread...

https://files.slack.com/files-pri/T09229ZC6-F06TV0LQXGA/image.png

p
I'm lovin it
n
all these had the popup of file not found on it
which is sensible.. as these are evidently filenames.. yes
p
ok, let's see if it reoccurs 😄 can you consider adopting the new approach in just one non-critical script? worst case you can revert right?
I'll keep an eye on this problem myself in my scripts, so far it didn't happen 🤷
n
i have adopted this in one script already.. not sure if i will commit this yet... probably on monday
👍 1
will see if we can maybe help out with making refreshVersions a standalone thing and make it able to parse and edit .kts files... how hard could it be... right ?... i wish i had 96 hours i na day.. minimum
p
in theory yes, as long as you parse the .kts into an AST/PSI, you should be able to do what you need
I'll try to create a custom inspection via IntelliJ plugin that will check for updates for Maven dependencies in Kotlin scripts, but not sure when it will land
n
tbh for what we need we just need to match for
@DependsOn(".*:.*:.*")
and add commented out copies of that underneat with newer versions
p
regex ftw
mind that
@DependsOn(...)
can specify more than one dependency, but the simplification to just one dependency would be a fair one for the beginning
n
or even just line by line chekcing using startsWith
hmmm.. gotta see if i can make this a multiline thing
yeah.. this is actually even better
p
FWIW, in Renovate I did it the same way (regex): https://github.com/renovatebot/renovate/blob/17cf8b6a597d96017fe51bf0312cf51caf6f78b5/lib/modules/manager/kotlin-script/extract.ts#L7 although it now works with just a single dependency per a single
@file:DependsOn