Closed lkalabis closed 2 months ago
Hi @lkalabis, thanks for this contribution. My only concern with this would be that you could then run cls
files anonymously as these also have the apex
filetype set. Maybe we could check that the filetype is set to apex
and the current file extension is not cls
or trigger
?
Unfortunately, the solution here is not as simple as I hoped. The command: sf run apex -f requires a file as input. In our case, this file does not exist and so the system waits for input from the user.
What works is the following:
%!sf apex run
If you run this from your current buffer directly in vim it executes successfully. Unfortunately, it do not give the result into the popup. I'm not so familiar with Lua so I don't know whats the best way to include it into the current solution.
something like:
if file_type == "apex" AND path == "" then local command = string.format("%!sf apex run") end
@lkalabis I added an update that pipes the unsaved buffer contents into the Plenary job. Seems to work nicely so will merge this in.
📃 Summary
The current implementation checks an anonymous buffer for the extension: 'apex'. Only in this case its possible to run the current buffer in an anonymous execution. It makes more sense to check if the filetype is 'apex' since its not necessary to save a file for anonymous execution
📸 Preview
No visual impact