In my extension I use CodeActionsProvider and HoverProvider.
This functionality works well when I open a file - it shows me the problems and the hovers.
However I want to apply CodeAction and Hover on open files:
User opens "abc.txt".
User changes something in "abc.txt" and save it.
My extension does its magic and creates some new hovers and problems. "abc.txt" is still open.
The new hovers and problems are presented to the user in "abc.txt" without reopenning the file. <-- How??
I managed to present the new hovers and problems by executing the save command: workbench.action.files.save. However, I couldn't find any way on how to do it without saving the file.
How can I trigger a file inspection without saving it?
Related
On some files I need to change standard save as file dialog.
I want to use custom command that executed 'workbench.action.files.saveLocalFile' command with some params that can change availible file extensions.
Where I can find the params if they exist?
Another way:
Custom command with showSaveDialog (my own vscode.SaveDialogOptions)
Close unsaved editor
Open saved file in editor
At step 2 I use 'workbench.action.closeActiveEditor' command, but I can see confirm dialog (Do you want to save the changes...)
How to remove this confirm?
How can I force PlantUML to refresh its preview, using code?
Longer Explanation
I have 2 editors open
Editor 1 contains a yml file.
Editor 2 contains a plantuml .wsd file
and a 3rd pane is showing the plantuml preview. (which is technically not an editor)
When I modify the yml file, it modifies a json model, and rewrites the .wsd file, and thus I get a new state diagram showing me the structure of my yml file in graph format.
The content of wsd is updating correctly when the yml changes. V1 created a new file each time, it saved fine I could see the content change, but the preview never updated.
Settings->PlantUML auto update is ticked.
In order to trigger the refresh I had to select the editor, and either modify or save.
So I re-wrote the code to select the editor 2 wsd contents, replace it in the existing file, and then save that file. Still the preview does not update.
I have also tried to fire the vscode command plantuml.preview, which is what the plantuml extension itself fires to display the preview, it fires and returns, but does not update the preview.
I have vscode.window.visibleTextEditors[ii], from which I can select the right editor, but I cannot find anything to set the focus. I've tried setting selections, and saving but still no refresh.
I am now trying to find the right vs code way to set the focus on the right editor and save it, then switch back to the left editor, mimicking pressing CMD-2, CMD-S, CMD-1, or manually selecting the editor and saving, which is the only way to update the preview.
I cannot find anything on how to set the editor focus, so perhaps I am going down the wrong path. Can anyone suggest how this could be done?
I'm developing an extension in which I prompt the user for a folder in their file system and open that folder using
await commands.executeCommand("vscode.openFolder",<Uri_to_open>,true)
As described in the API docs (and whenever I open a folder in vanilla VSCode), the window is refreshed, removing all previously open files.
I now want do stuff within the new window. Like createTerminal() or use the outputChannel. I've tried both and neither run after the new folder has been opened and the window refreshed. If I use true within the executeCommand() line, I can see these actions being performed on the "old" window, not in the window of my newly selected folder. How do I ensure when I run window., I'm specifying the new window?
I have recently switched to VSCode, and am loving it, except for one specific thing that drives me nuts.
My "goto" command is {Command+P}, the easy search-and-open-file bar. If I type the name of a file into this bar and it does not exist, I want to be able to hit ENTER and have it open a tab editing that file as a new file. This is the behavior I would get in old-school Windows Notepad, or in mvim :e <filename>, but I can't figure out how to do it in VSCode.
Is there a toggle or a plugin I can use to get this behavior straight out of the Go To File dialog?
Answering my own question:
No, there's no way to do this using {Command+P}. This is strictly a file finder and I've yet to see any plugin that changes the behavior.
If you're using the VsCodeVim plugin, an almost-as-good approach is just :e <file> - immediately open a new buffer editing the given file. There's no tab autocomplete this way, but you just have to live with that.
When I delete file notepad++ displays the below message:
The file "D:\xxx.txt" does not exist any more . keep file in the editor?
Can I stop this message and silently remove deleted files from the editor?
Message box with the question is displayed unconditionally. There cannot be anything done about removing it simply by chaging configuration.
If you have necessary programming and app building skills and you wish to remove it, search for Notepad_plus::doCloseOrNot in Notepad++ source file <source root>\PowerEditor\src\Notepad_plus.cpp and modify the code accordingly – for example to always return No (=do not keep file in editor) without showing a dialog. Then build Notepad++ from these modified sources so the change will be there.