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?
Related
I'm using Doxyfile 1.8.17, and decompiling an Android app, with apktool, and also unzipping the APK to view some files in there too with Doxygen. I've managed to pull only what I need using EXCLUDE_PATHS. SOURCE_BROWSER is set to YES. My problem is whenever I go to click on the file in File List, I just get a link to go to the source code of the file. When I click it, it opens the source code in the right plane. I would like to just click the left plane and view the source code instantly in the right plane, however, there doesn't seem to be an option to change the behaviour. In the html output folder there is two types of files. foo.html and foo_source.html. This is the same for every file that you pull from INPUT sources. I just want it to show me foo_source.html and nothing else. Is this possible?
I know you can format on demand, save etc. However, I want my JSON files to be formatted automatically when I open them.
I'm currently using Prettier for my default formatter; which works great when I force the formatting through ctrl+shift+p > format document or just pressing ctrl+s does it (because I have that enabled).
I forgot to mention that if I have the file open in the editor (no pending changes) and the file is updated from a source outside of the editor, the formatting resets.
How can I prevent the formatting from resetting after the file is updated?
Does anyone have this working and if so how?
I've just started using Vscode and have a created a WebAPI project. On trying to open any of the default code files (Startup.cs and Program.cs) whatever I type starts to appear in the blue bar as shown below instead of where I have placed the cursor. I have no idea what's going on or what that blue bar is.
I am able to add my own code files and edit these as I would expect.
I'm running Vscode 1.29.1 on Win 10 on a Dell Latitude 12 7275. The vscode extension
Enabled extensions :
That's caused by Vim extension. Uninstall or disable it, otherwise use insert key on your keyboard to put it in insert mode.
I'l leave this here for future readers
Basically, if I split files in tabs in VS Code, I could work with the files on the left hand side but could "read-only" all the files on the right hand side.
When I went to the extensions tabs I noticed that whatever I typed was being typed in the field in the extensions search bar. After deleting that, and clicking back on the "Files" tab, it went back to normal and can basically edit files on the both sides of my split screen.
If cannot type
Check where whatever you type is going (e.g. Extensions > Search bar)
Delete wherever it's being typed, and click back on the "Files tab"
Check if it works
I had to change the parent folders permission...
Try changing the entire folder to:
Read & Write: Allows a user to open the item and change it.
https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac
So when using Qt to build user interfaces, you all know that .ui files (forms) open in Designer mode by default, and that if you manually switch back to the Editor, then this message appears "This file can only be edited in Designer-mode".
Well, for some reason, and at some point, my file now opens BY DEFAULT in the editor, and the message does not show up. Worse, when manually switching to Designer mode, the main editing field is gray and empty and none of my stuff shows up ... Also no scroll bars or anything.
EDIT : actually, it is whichever form was loaded last that appears. And it is editable and all ... only the drop-down menu with the file name clearly indicates that it is MY file that is opened. When I perform an edit, then the edit is performed to this same last-opened form, and is reflected upon compiling. My display remains unchanged to the state that it had the last time that I was able to open it in the Designer.
EDIT : Also, along with the fact that my .ui file now opens by default in the Editor, it is also editable there like any other source file. But edits don't seem to bother, I modified some stuff or added gibberish, and it never showed after compiling nor did the compiler ever complaine ...
What's going on ? What did I do ? I have no crash nor any recent weird events to report ... It just suddenly started happening.
Thanks in advance for any clues,
Charles
In Eclipse, if I change a file programmatically, and it is open in a text editor, it doesn't always reload, not even when refreshing the resource programmatically. How can I forcibly reload the text editor from code so that it show the changed file contents?
In your project explorer or navigator, you can right-click on the file that's currently open and select refresh. This has always worked for me, even when editing files with several programs. Make sure to click the file itself, not parent objects like packages or folders or projects.
Edit
Refreshing programmatically? I would look into an Eclipse scripting tool:
http://eclipse-shell.sourceforge.net/
I guess there was another one called Monkey, but it doesn't appear to be maintained.
I don't know of any possibility to programmatically reload the file.
Some editors (e.g. GMF editors) look for changes in the underlying files, and refresh themselves, but this is not required at all.
I don't think that a forced reload is an option implemented globally, as in some cases there could be some merging steps involved that can be quite erroneous.
My ideas to solve this:
Have a specific editor that refreshes its content when the used resource changes (this can be timeconsuming);
Or close the editors of the file and reopen them (this is ugly in the eye of the user).
Since the Luna release of eclipse there's no need to reload files with F5/manual Refresh.
Really nice, especially as there was a bug with the F5 key binding.