Closed bentsherman closed 3 weeks ago
Really the only thing to be updated for Nextflow scripts is name checking and beyond, they don't need to be re-parsed. That's probably good enough for a first iteration. Making the includes explicit would be a nice improvement in the future
Maybe I can just re-compile the entire lib directory every time the ast cache is updated. I could even check the file timestamps to see if they were changed.
Merged via 3583c60d255eb8f684624ac1cd78616eecab84c9
Close #4
Adds a custom Groovy AST cache to compile Groovy classes in the
lib
directory, and provide them to theResolveVisitor
. It mostly works, some expressions aren't being resolved correctly though.The main challenge that remains is to keep the cache up to date as the user edits. I could implement full language support for
*.groovy
files and hook into all of the lifecycle events, but I probably wouldn't want to extend it to all Groovy files. Maybe it could work if I manage only thelib
directory. Or I could add thelib
directory to the list of "watched files" and update that way.Also, the classes in the
lib
directory are automatically exported to all Nextflow scripts, so if I update something in thelib
directory, all Nextflow scripts would have to be re-compiled. Maybe we should requirelib
classes to be explicitly imported by a module viainclude
statement, so that the static analysis can be more efficient. Probably would make the Nextflow scripts more readable too.