Open Markdown Preview tab in New Window? - visual-studio-code

I have two monitors, one is my MacBook 13" that is very small to have multiple/split windows, and another one that I have my preview windows. When I'm writing a nodejs code that I store it on GitHub, I always edit some markdown files. The issue is:
I want to "detach" the Markdown Preview Windows to a "new window", so I can send it to my second monitor, so I can edit on one and see it on the other.
There are some similar questions on StackOverflow, but the solutions don't work for this case, because if I open another window/workspace and drag the preview window there, it does not update the preview when I save the original MD file... If I drag the preview window to the other monitor, it creates a "webview-panel" file.
E.g.: Markdown open a new window link
Any tips?
I tried with the default preview and the enhanced preview plugin, same results...

VS Code does not have built-in support for multi-monitor setup... sorry :)
The solution would be to simply open another window of VSCode, of the same workspace, and open there the preview of the markdown file, while keep editing in the original window.
Edit 1
Here are the actions to reproduce the solution:
Open 1st VSCode window with the project
Cmd-Shift-N to open a 2nd VSCode window
Point 2nd VSCode window to same project - but at a different root folder (as if it's the same - VSCode with just revert you to the 1st window
Open on the 2nd VSCode window the markdown file you wish to preview, and then hit Cmd-Shift-V
(Make sure you keep the tab of the markdown file open on the 2nd window as this is what VSCode Markdown preview uses to detect the file change events AFAIK)
Edit the file on the 1st window and viola, it will auto-refresh on the 2nd window preview
Edit 2
How-to video (Hosted on youtube)

Configure the 2nd monitor to have the same height as the 1st.
Stretch VS Code horizontally to span 2 monitors (am assuming this can be done on a Mac.) Now the left half of VS Code is on the 1st monitor, and the right half is on the 2nd.
Open the Markdown file in the left half of VS Code, and open the preview in the right half.
A bit of hack, but it works.

Just for those, who are still looking for a good solution to see the current changes to a Markdown file in real time in another window, you can use the Instant Markdown extension.
It provides a browser window in which the preview is displayed and also listens for changes in VSCode. Here you find more information about that package.

So I have this setup: one monitor aligned vertically for editing the source and the horizontal one one the right (or left, you can change that to your needs) shows the preview of my edit.
I use VS Code for Markdown and Tex, so its pretty cool to work like that. If you preview the stuff in the splitview you can set on the option to split it. So if you right click it and then go to Split up, your preview is down which you then can scale to your monitor size.

Related

How to run VS code on more than one monitor?

I'm still new to VS code and I saw this type of using VS code on two monitors, so I have 3 monitors and I'm on windows 10, I use the left one as a preview for the code I'm typing in chrome so that is sorted and I want my middle one to have the main code I'm working on and my right one is set vertically so I want it to run the terminal or of that file or another file so I can use both my right and middle to write code and I have no idea how can I do this.
there is a workaround, first in the file you want to open go and click ctrl+shift+p and search for open active file in new window, then in your new instance, press again ctrl+shit+p and search for Open User Settings(JSON) and add this line at the end of the settings "files.autoSave": "onFocusChange", so whenever you change windows the current file you're working on will be auto saved, hope this helps

How to open files in new tabs in Visual Studio Code

I recently started using Visual Studio Code and I would like to know, is a way to open files in a new tab? Currently whenever I open a new file the files I currently have open disappear. I say new tab, but any option that will let me open a new file in the same window as the old one works.
I have tried disabling Preview Mode through the workbench settings as shown in this answer: How to config vscode to open files always in a new tab?. However, when I choose Open or Open Recent the new file still replaces my old file.
Thanks.
Once you have to open your settings file, add the "workbench.editor.enablePreview" property and set value to false.
For 1.21.1 version.
In user settings =>
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen"
the best way i found.
Starting with VSCode 1.52 (Nov. 2020), you should not have any more issue: all files will open in new tabs, even in preview mode.
Better handling of preview editors:
Preview editors are now better handled with numerous improvements based on feedback and making this feature work more consistent.
The setting workbench.editor.enablePreviewFromQuickOpen is now disabled by default so that editors opening from quick open will not appear in preview mode anymore.
When you start a navigation (e.g. go to definition), the editor you start from will move out of preview mode to keep it open while the new editor will be in preview mode until you navigate further.
We changed all of our custom trees (the ones used from extensions or Git changes view for example) to work more consistently like our built-in trees (like the explorer).
This means, the following interactions now apply to all of them:
double-click or mouse-middle-click to open non-preview
Enter to open non-preview (Space to open in preview-mode)
Note: if you are the author of an extension that is leveraging our custom tree API, you can benefit from this change as well.
Make sure to use vscode.open or vscode.diff commands for the TreeItem.command and you are in!
A new menu item in the editor overflow menu allows to quickly turn off preview editors altogether:
You need to double click on the name of the file. Also, it needs to be done swiftly elsewhere you will be opening in the same tab.
You can drag and drop file near to the opened tab and the file will open in new tab.
Thanks everyone. Double clicking and dragging was useful, but it still didn't solve my problem when opening files from different projects with the "Open File" menu command. I found that Multi-root Workspaces is what I was looking for. https://code.visualstudio.com/docs/editor/multi-root-workspaces
This is likely due to Visual Studio Code opening file in what's called "Preview Mode", which allows you to quickly view files, ideally if a tab is in Preview Mode then its title in the tab bar, will be italic.
To disable Preview Mode set "workbench.editor.enablePreview": false in your settings file or use the "workbench.editor.enablePreviewFromQuickOpen" option to disable it only from the quick open menu.
Alternatively, use command palette CTL+Shift+P (to get all settings) VScode settings then in User => Workbench => Editor Management you can uncheck Enable Preview and Enable Preview from Quick Open to get the same results described above

Visual Studio Code: How to have both Debug window and Explorer window open together?

I'm new to Visual Code and I have a small question.
You have two buttons circled in red line. The first button opens the Explorer window and the second circled button opens the Debug window.
I want to have both of these windows open. Do you know how to do it?
This is not possible as of VSCode 1.13
A feature request for showing multiple panels was tracked here but the issue has been closed as as-designed. If you are passionate about the problem, please file a new issue to see if thinking on this has changed in the past year
V1.43 will have the ability to move various views, like Variables, Watch and Callstack from the sidebar to the panel (it works nicely in the Insiders' Build v.1.43). Demo:
See v1.43 release notes: https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_43.md#easier-moving-of-even-more-views with a demo gif of dragging views to and from the panel.
and this setting:
We've introduced a new command to make moving views easier
with the keyboard: View: Move Focused View
(workbench.action.moveFocusedView).
And finally, this is a preview feature. So, in case you get into a
state that you can't fix, there is a command to reset all views to
their original locations: View: Reset View Locations
(workbench.action.resetViewLocations).

VSCode: How to turn off auto select in File Explorer when changing window tabs?

In VSCode, if I have an editor window tab open and I click anywhere in that editor window, the selected file in the File Explorer changes to the file being edited. I would like to prevent that behavior. This is possible in Visual Studio, but I can't seem to find a similar setting in the preferences file of VSCode.
Can anyone provide some suggestions?
This has been added, see https://github.com/Microsoft/vscode/issues/14745.
Configuration is "explorer.autoReveal": false
You can't, at least not today. The only thing you can do, is keeping the scroll position when switching tabs. See this answer for the setting: VSCode prevent file Explorer from jumping
And here is the feature request on Github: https://github.com/Microsoft/vscode/issues/14745
(Feel free to add a "Thumbs Up" via Github Reaction at the top so the request gets more attention in the future, this increases the chances that it gets implemented sooner)

How to Display VS Code output window to side rather than below

In my VS Code set up I see the output/FSI frame below the main text editor pane like this:
whereas I would love it to appear to the right in the side-by-side view like it does on the images in this link: http://www.wintellect.com/devcenter/jwood/a-quick-look-at-f-in-visual-studio-code
Is there a config option I cannot find somewhere?
I tried Googling but drew a blank and cannot see anything obvious in the config options mentioned on the vs code site page describing the config options
as of version 1.51.1 right click in the right corner on the output panel. then select option 'move panel right'
I don't believe you can detach/move the output windows in Visual Studio Code. You can move the side bar to the left/right side, but that's it. There is no config option, sorry.
You could try posting a feature request on the GitHub page: https://github.com/Microsoft/vscode
EDIT: This was changed in VS Code 0.10.8, it was once on the side but was moved to the bottom. See this GitHub issue: https://github.com/Microsoft/vscode/issues/2806
This feature is not available yet in VS Code. However as of today (March 30, 2017) it's on 6 months roadmap so it should be done in a near feature.
This feature is available from version 1.18.0+
Simply click this icon to dock to the right:
Just follow the steps mentioned:
In Visual Studio Code -
View Tab > Appearance > Toggle Panel Position
That's it.
Your original link to the view your desire is obsolete, so it is a guess as to what you wanted. But here is a demo of setting up a terminal/output look side-by-side. It is a little tricky - you drag your Outline header over the Terminal header which will then allow you the option of putting it to the left or right of the Terminal:
its easy. just right-click on the terminal, select 'move panel right' like in the image below and voila
the image can be found here
Vertical Split:
From VS Code Menu bar:
View >> Appearance >> Move Panel Right
Version 1.47.0 of VS Code (at the moment of posting this, the latest one) allows you to drag output (or any other panel tab, e.g. terminal) to the activity bar. This way you can obtain output to the side of the editor.
Just right click on the panel of output section then select "Move panel left or right" as per your wish.
here your can see the move panel left option.
Press CTRL + SHIFT + P
Select Preferences: Open User Settings (JSON)
Insert (or change if it is there --search for it) the following config line:
"workbench.panel.defaultLocation": "right",
Save file.
That will work for new workspaces. VS-Code saves your preferences for each folder you start it in. So, if you navigate to a folder you previously called VS-Code in (I mean, from the terminal), it will open the output panel in the same location it was the last time you have used VS-Code from the same location.
After making the change above, go to a new place, like /opt and start VS-Code there to make a test.