Visual Studio Code, how to make local file link open default program - visual-studio-code

VS Code text editor highlights and allows to follow links, this includes local file URLs:
Ctrl+click opens the file in a new editor tab:
Is it possible to configure VS Code is some way to open the file in default program instead upon ctrl+click / follow link? (e.g. html file in web browser, mp3 in media player etc.)
Any setting, extension or different text markdown will do.

I don't think there is a default way in vscode to set open a file with default program.
However, there are extensions to deal with it. For example: Open in Application

Related

Is it possible to paste files copied to the clipboard from other applications in VS Code?

Within the explorer panel of VS Code itself, if I want to copy a file to another directory in the workspace, I can use ctrl+c and ctrl+v, but if I find a file from another application on my computer such as the native File Explorer application, first pressing the shortcut key ctrl+c and then going to the VS Code window and pressing the shortcut key ctrl+v in the Explorer panel, there is no effect.
Note that I'm not talking about copying the contents of the file and pasting into VS Code. I'm talking about copying "the file" as in the notion of the file to the desktop environment.
The workaround is the use the native file explorer, copy the file first, then open the folder opened in VS Code, and finally paste it within the native file explorer. But I find this so troublesome.
Is there an easier way to do this? Does VS Code support such functionality to paste files copied to the clipboard from a different application (not VS Code) and paste into VS Code? Is that functionality hidden behind a setting that I need to change? Or is this possible via an extension?
Vscode does dragging the filename from a native file explorer (at least on Windows) and dropping in vscode's Explorer where you want it.
You can also use your OS's Open With... functionality and then drag the tab of that editor into whichever directory you want.
You can choose Add File from File to add a file to your workspace. Or you can use New File from File to create a new file in your workspace and copy the content of the file outside to it.
At the time of this writing, this is not supported... yet!
Work to implement this is tracked under this GitHub issue: Explorer: allow to paste files from the clipboard into target folder #130036, which is a subtask of a larger issue tracking a larger effort for Better drag and drop / clipboard integration of files across applications #164.
You can give a thumbs up reaction on those issue pages to increase their prioritization (but please don't leave "me too" comments there, as such comments are considered annoying noise).
pingren (a contributor to the VS Code repository) tried to implement this and found it to be more complicated than it looks. You can read their explanation of why in their comment there. One of the difficulties stems from itegration with system keybindings and VS Code's affordance for remapping keys:
the onPaste event could only be triggered by system paste (cmd+V on macOS). Users could change filesExplorer.paste command to any keybindings. So we need to consider how to merge native paste from clipboard and VSCode explorer paste.
There's another feature-request issue (Copy paste files from native explorer to vscode #89862, created before #130036) where isidorn (another VS Code contributor) commented:
This is a fair feature request however I believe there is a Chrome limtation which is preventing us from achieving this. [...]
As for extensions that might do this, I don't know of any (but haven't tried searching intently).
Other possible workarounds:
Try dragging the file from your native file explorer application to the VS Code file explorer panel. This is confirmed to work at least on Windows and Ubuntu.
From Mark's answer (copied under CC-BY-SA):
You can also use your OS's Open With... functionality and then drag the tab of that editor into whichever directory you want.
From user103's answer (copied under CC-BY-SA), and partially mentioned in the question post already:
You can choose Add File from File to add a file to your workspace. Or you can use New File from File to create a new file in your workspace and copy the content of the file outside to it.

Open soucemap links (webpack://) directly in VSCode?

Webpack JS/SCSS-sourcemaps shows where the source originates on inspection. Actually I use Laravel Mix. Tooltips on hover in dev-console look something like webpack:///src/scss/includes/_typography.scss:124
Clicking on it, opens the source file in dev-console. I would prefer, to open corresponding line in my editor (VSCode). There must be a way, to open those webpack://-Links directly from the browser (FF usually) with an external App like VSCode?

How to keep open file input in Visual Studio Code when I change of window?

I would like to know if it is possible to keep this search engine (Ctrl-P) open if I change the window, in Visual Studio Code.
It is a not very relevant functionality but it would help me when I forget part of the name of the file I want to search for or I have to change the window to solve another situation, however, when returning to Visual Studio Code the file browser closed itself and I must return to write part of the file path from the start.
Is there a configuration or extension with this functionality?
Thank you very much!
No, you cannot keep that open when you change windows. Since the search engine provides compilers or lints for various languages that you are editing in the ide space. So when you open a new window by default VS code provides a different configuration for the script, so the search engine cannot be kept open.
A detailed description can be found here https://code.visualstudio.com/docs/getstarted/settings

Is there a way to see a preview of a webpage?

I was wondering if there is a way to see a preview of an webpage page that we are working on in a web browser directly from the Visual Studio Code editor, instead of having to click the file to make it open by the default web browser.
You can open your Visual Studio Code project in a browser window by configuring a gulp task with the node module gulp-open. Then you can run the gulp task from inside Visual Studio Code.
Here's how you might configure the gulp task:
var open = require('gulp-open');
gulp.task('browser', function(){
// Define the source to match the file you wish to open:
gulp.src('./www/index.html')
// Designate the browser you wish the file opened in:
.pipe(open('<%file.path%>', {app: 'google-chrome'}));
});
});
Since we've named our task "browser", from inside Visual Studio Code we can hit command/control P to bring up the command pallet and type task. Then start to type browser. You should see code complete for the full task as you type. Hit return and it will open the your file in the browser you designate. Once the browser is open, you can resize it and Visual Studio Code so that they are side by side. Then as you work you can refresh the browser to see your changes.
You can consult the docs for gulp-open on NPM.
Directly from the editor, there are WYSIWYG editors such as Adobe Dreamweaver, Kompozer, etc. Though these often offer a poor preview of anything beyond simple HTML and CSS (i.e. no JS, no animations, possibly different CSS support).
Using a text editor such as the Visual Studio Code Editor, Sublime Text or vim, there is no such preview function.
Ideally, you'd want to test in the browser (the browsers you'd expect your target audience to be using) to ensure you have an idea of what exactly your visitors will see.
To save time between coding and previewing, you could simply keep the window/tab open in Chrome/Firefox/Edge and refresh after saving the file in the editor.

Change what text editor the "Open this file in GitHub for Mac" link uses

When I click this link it opens up the file in Xcode. Unfortunately there doesn't seem to be any way to change this. I would like it to open in Sublime or Atom. I've checked the GitHub for Mac preferences menu but there is nothing there related to your default editor. I've tried changing my default git editor but that doesn't work either. How do I set the editor GitHub for Mac uses?
I figured it out. Github for Mac uses the same application that finder would use if you double clicked on the file. You can follow these instructions to change the default application for a given file type http://computers.tutsplus.com/tutorials/quick-tip-how-to-change-the-default-application-to-open-files--mac-51413.
Unfortunately the accepted answer does not works anymore.
I just created simple chrome extension which allows to automatically replace github-mac links to any other existing url provider with template set by user in the options: https://github.com/extempl/github-mac-replacer.