Closed ognjen-vuceljic closed 5 days ago
Thanks for submitting this feature request!
It does look like a neat feature. Do you know how this works in VSCode, would you mind to elaborate the steps?
There are steps I don't have clear picture in mind yet. For example, once the highlighted SOQL runs, should it run in the terminal or background? Is the result the debug log or precisely the SQOL result? Should the result display in a new buffer/window or in the terminal?
@xixiaofinland Sure, please find the VS Code feature breakdown below:
Notice the "Execute SOQL With The Currently Selected Text" above - that's the VS Code shortcut that I can use whenever a portion of code is selected. This command is triggered via shortcut that VS Code gives us with this Salesforce extension. It would probably be equivalent to the keymap in Neovim which would grab the selected code and put it in the sf data query
command
For consistency sake, I would keep the output structure of this command the same as the structure of any other SF command we execute in the terminal. It's descriptive enough for us to understand what the final result was, and what are the rows that query returned.
The key part here is an easy way to execute SOQL commands regardless of where we are within our project structure. Having dedicated .soql
files from which we can run existing SOQL commands is nice and useful, but I think this would speed things up even more, and provide better user experience.
Hope this breakdown was useful - feel free to let me know if anything else is needed!
Appreciate for the clear description. This is clear for now. I will inform here once it's done.
a new run_highlighted_soql()
(hotkey <leader>sq
) is added.
The hotkey is enabled in visual mode only, it copies the selected text and pastes into the term as a SOQL. Please test out.
Thank you @xixiaofinland
Initial tests are showing that <leader>sq
executes the highlighted SOQL properly for both one-line and multi-line (formatted) queries.
There's just one UI/UX thing that I spotted (multi-line formatted query via prettier
):
This query functionally worked, and produced expected results. However, the UI representation in the terminal appears to show some command not found
messages.
Not fully get your point. I did a quick bug fix, does it happen to solve ur problem?
Selection across multi lines should be ok
Thank you @xixiaofinland , now it looks ok :)
Apologies, I had to edit the previous comment, as I initially didn't write that multi-line queries were affected.
Now both single and multi line queries are correctly visualized in terminal, and they both produce expected results.
great!
Hello,
thanks a lot for continuous improvements for this plugin!
Here's an idea that I have (similar feature, I think, exists in VS Code):
sf data query --query "{this would be the selected text}"
Example of usage:
Sometimes there is a need to quickly inspect data from the current org, without the need to create a separate file that would be a source for
SFRunQuery
command.Having the ability to execute a query by visually selecting SOQL portion from any file might speed some things up.
Apologies in advance if such feature already exists, or if it is hard to implement.
@xixiaofinland