Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check filetype for anon execution instead of file extension #37

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

lkalabis
Copy link
Contributor

📃 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

The current implementation checks an anonymous buffer for the extension: 'apex'. Only in this case its possible to run the current file 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
@jonathanmorris180
Copy link
Owner

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?

@lkalabis
Copy link
Contributor Author

lkalabis commented Apr 21, 2024

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

@jonathanmorris180
Copy link
Owner

@lkalabis I added an update that pipes the unsaved buffer contents into the Plenary job. Seems to work nicely so will merge this in.

@jonathanmorris180 jonathanmorris180 merged commit cf0df1b into jonathanmorris180:main Apr 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants