Portal stays fun gratitude How would I go about adding a command that says "Edit this form in the external editor/ide, using the meta on it"? Does this already exist?
Is this a code form that exists in your current source code that has a file/line/column or a generated one that needs to be opened in a temporary file/buffer? And after editing the value, where does it need to end up? Also, what editor would you want this for?
It's Pathom resolvers that both exist as source code and is generated - when generated, we can attach the generator's file/line as meta. And I want to push a button to go-to that in Cursive
If you can provide metadata on the value like
{:file "..."
:line 123
:column 123}
The goto command in portal should work for you. If you have the https://plugins.jetbrains.com/plugin/18467-portal-inspector and you opened your portal instance with {:launcher :intellij} or {:editor :intellij} , it will open the file in Intellij. If you want to do so via a click, you can use the :portal.viewer/source-location viewer which expects the same data as above.https://cljdoc.org/d/djblue/portal/0.60.2/doc/guides/tufte-profiling might be of interest to you, especially how the :loc column is formatted.
This is magic, thank you @djblue! I did not see goto in the list of commands, so I assumed it did not exist. Glad I asked: https://cljdoc.org/d/djblue/portal/0.60.2/api/portal.ui.commands
Do you see goto in the command palette? The commands in portal.ui.commands are the ones registered in the Portal UI runtime. The goto one in registered in the jvm runtime since it needs access to the filesystem.
One thing to be aware of is that commands can specify predicates, so they will be hidden if the selected value doesn't conform to their expectations. In this case if the selected value isn't goto-able then it would be missing in the command palette.
I've now found it, and it works, and makes me very happy.
ClojureScript only. is what I missed when I first looked at the API