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
Related
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).
Is it possible to make an extension that draw lines on the background? You can decorate a lot of thing but I can't find a way to draw colored lines.
I would like to see the flow of my data (inspired by visual programming).
Something like that (but the like drawn under the text) :
Keep in mind vscode is an add-on to Electron, which is a webbrowser in a desktop raiment. So what you see are webpages and hence everything what's possible on a webpage (with a node.js basement) is also possible in vscode - at least in theory. I say "in theory" because after all vscode is a text editor and limits interaction in a way that supports this goal. So, what you can is either some drawing/graphics or add extensions that work in normal editor pages. You certainly don't want to write your own text editor interface within vscode.
I'm trying to make little utility for macOS(not iOS) using by Swift(newbie).
I guess this utility would be
command line tool triggered by other apps or
Menu bar application.
I implemented features that I've wanted,
but I have no idea how to edit focused text field.
e.g. Get text from a text editor(atom, sublime, ... when this app triggered.) and make some changes on that text and paste back to the text editor.
I want to make this app works on system-wide,
I want to know how to implement things below
Get text from currently active/focused text field.
Delete text on currently active/focused text field.
Paste text to currently active/focused text field.
(text means just one word or line before the cursor)
I'm trying this on command line tool and keyboard event(CGEvent) now which seems no good idea.
Please help!
I think you need to implement a system service, like described in the docs here.
The relevant parts (although you need to read it all) are here in the section "Sending Data to the Service" or "Receiving Data from the Service" (it's done using the pasteboard).
As an alternate solution (maybe better) you should consider packaging your app as a share app extension (see here)
Take a look at the macOS accessibility features in the ApplicationServices framework. Specifically, the classes with an "AX" prefix (these are the accessibility ones). It's not the prettiest thing to work with (especially in Swift) but you can achieve what you want with it.
Is it possible with some program to to send an OnClick Event eg: MenuNewClick (File New) or others.
I have an application that has no Keyboard shortcuts.
When I use a Resource Editor I can see the Delphi Forms for each OnClick Event I need.
I would just like to be able to send these OnClick Events with Keyboard Shortcuts into the running exe.
Have used apps like Darker's Enabler, EDA Preview that allow you to modify the layout of a running exe.
Possible ?
Even this forum has options "Keyboard shortcuts
Enable keyboard shortcuts (when enabled, press ? for help)"
Thanks.
If the application is indeed made with Delphi and if it uses default TMainMenu component you could modify the RCData in which the .dfm is stored (this data alows you to view the form and its properties with programs like PE Exporer and similar) in a way that you change the AutoHotkeys property of TMainMenu to maAutomatic and then change ShortCut property of each menu item to contain proper keyboard shortcut.
If you have access to Delphi I recomend you first make an example application which will have all available shourctuts implemented so you could comparison the RCData between these two applications and made necessary changes.
NOTE: What I'm suggesting will require editing the EXE resource data so make sure you are working on a copy of the exe and not on the real one so you don't break your application.
I'm looking for a way to use my favorite "native" editor, Sublime Text 2, to fill textareas and/or WYSIWYG-editors like TinyMCE.
I'd like to have some kind of daemon, service or browser extension that waits for, say, a focus event on a textarea and opens a new Sublime Text 2 window for me to type in. Everytime I save (could be to a file in a temporary directory for all I care), the background daemon/service/extension/… updates the contents of the web form field.
So much for my ideal scenario. Is there any way you know of to make this possible (FYI, I'm working under OS X Lion)?
I don't know what browser you're using, but there's an extension for Firefox called "It's all text" where you can:
Right click on a textarea, select "It's All Text!" and edit the text in the editor of your choice.
You can also make a shortcut instead of rightclicking.
[EDIT] And for Google Chrome now there is: https://github.com/Cacodaimon/GhostTextForSublimeText
P.S. In an ideal world all textareas should be small ST2 windows...
Sure, this is possible.
You'll need to write a browser extension for it.
Look for a snippet saving addon on whichever browser you use, go through the source code, figure out how it works, then make one to fit your use-case.
In the meantime, repeat: Ctrl+C, Alt-Tab, Ctrl-V!