How do I capture "Find" command in vscode custom editor extension? - visual-studio-code

I'm creating a custom editor document extension for vscode and I want to have a custom find widget that will suit what I'm doing in my document. How do I capture the find event and execute some code. I tried registering a command for "actions.find" but this made other tabs not able to use the find command. Is there an easy way to do this?

Related

VSCode Extension - How do i make a "select" in view command

I can find many examples having simple button-like action, I'de like to know if this kind of view is possible via the vscode api.

Is it possible to run ad-hoc code against the current editor in VSCode?

I would like to run some code to manipulate text in the editor of VSCode. Is there a way to do this without creating a new extension?

VSCode not showing function parameter list in Dart code

When I edit JavaScript code, VSCode immediately show me a popup with a list of parameters as soon as I have typed a function name followed by (.
When editing Dart code this is not the case. Here I have to use the mouse to hover over the function name to show a popup with information about the function.
Is this normal behaviour? Are there any way to change this behaviour? Does anyone know a shortcut to show the popup?
This is controlled by a VS Code user setting in the Dart extension (dart.triggerSignatureHelpAutomatically). It's not on by default because there are some quirks (that I don't remember exactly off the top of my head).
There's work in progress to move the extension to using the LSP protocol which will push some of this functionality into the Dart analysis server, which may make it easier to make some functionality like this more reliable (since more info is available in the language server than is currently exposed to the VS Code extension).

How to create a modal for a VSCode extension?

I'm trying to make an extension for VSCode to Find text in File (Like in Notepad++).
Is there an API for using a modal in a VSCode extension? or at least extend the Command Palette?
VS Code (1.34) has no concept modal UI. Extensions can only show basic dialog messages modally using the showMessage apis.
Messages can show message text and a set of buttons. By default VS Code will render messages in its UI. The MessageOptions.modal option makes VS Code render the message using system UI instead.
Try positing a more specific question about what you are trying to accomplish. VS Code's extension model is different from other editors, so if you are trying to replicate functionality from another editor like Notepad++ you may need to rethink the user experience.
I believe what you are looking for is an input box. It will show a UI where you can input text. From there you can grab the text of a document and parse it for entered text. For completeness, VS Code does this with ctrl + f or cmd + f depending on OS. Add the shift key to search the whole project.
As mentioned above there are the limited built-in inputs and message box (which can also be used to display choice buttons).
You can also have a look at WebView these can be used to display a side-bar view (like the EXPLORER) or a full document. They are made up from HTML and plain old JavaScript. You will have to pass simple string messages between your HTML/JS view and vscode itself.
https://code.visualstudio.com/api/extension-guides/webview
https://github.com/Microsoft/vscode-extension-samples/tree/main/tree-view-sample
A large 'document' view example vscode extension is call 'nearest-icons'
https://github.com/noGreg/nearest-icons

Does VS Code has any shortcut like ctrl+q in eclipse?

Does VS Code (I currently use v1.8.1) has any shortcut like ctrl+q in eclipse?
It returns your cursor to the place where you stopped writing code(very useful for fast code browsing)
and it is different to alt+left which navigate backward
EDIT: I have found that this extension should do that you're asking. I suggest trying it out.
Original:
Out of the box in VS Code, this command does not exist. The list of default shortcuts can be found here, or you can open the keybindings settings in VS Code (ctrl+k, ctrl+s on Windows) and see which commands are available.
If you'd like to suggest this as a feature, you can open a new issue on GitHub or consider creating an extension.
If I understand correctly, you want a command that will move the cursor to where the last edit in a document was made.
This should be possible using an extension that listens to document change events and records the position of the cursor. Then, when the command is issued, it sets the editors cursor to that saved position.
You can also try "Eclipse Keymap" from Alphabot Security, has a lot of eclipse bindings.
I don't believe there is a built-in way to do this, but you could work around it by using an extension such as https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks .