Skip to content

Instantly share code, notes, and snippets.

@bishabosha
Created October 10, 2025 18:16
Show Gist options
  • Save bishabosha/94da5f7b8b0f97589ceb6f5006389915 to your computer and use it in GitHub Desktop.
Save bishabosha/94da5f7b8b0f97589ceb6f5006389915 to your computer and use it in GitHub Desktop.
Zed configuration to extract main class fqn for Scala
[
{
"label": "Scala run",
"command": "scala",
"args": [
"run",
"-M",
"$(if [ -z \"${ZED_CUSTOM_scala_package_name:}\" ] ; then echo \"$ZED_CUSTOM_scala_main_function_name\"; else echo \"${ZED_CUSTOM_scala_package_name:}.$ZED_CUSTOM_scala_main_function_name\"; fi)",
"$ZED_WORKTREE_ROOT"
],
"tags": ["scala-main"]
}
]
@bishabosha
Copy link
Author

the task interpreter seems to have a critical flaw that any "optional" env var will cause the task to not run at all if it doesnt exist, so you have to do a higher level operation to escape it via ${ZED_CUSTOM_scala_package_name:} which basically means resorting to builtins to compare the length

@bishabosha
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment