How to stop VScode creating a symlink instead of a file - visual-studio-code

I have tried to google, this can't find anything or on here so suspect i'm being a noob, so perhaps someone can educate me.
I am copying a file from one directory within by repo in VScode to another. It is a MAKEFILE (which i'm not that familiar with anyway).
I then select copy...
And then i select a sub directory within same directory so i can paste
Once i complete this, rather than the file being copied, it creates a syslink to the file which isn't what i want as i now need to modify the file...
Even if i create the file as a new file, this will still display as a symlink.
Am i doing something stupid here?
I have created the file through the command line but the file still shows as a symlink.
Driving me crazy, please help!
thanks :)

I found the solution here, just complete these steps:
Open VSCode and press Command+Shift+p
Type Uninstall and select option "Uninstall code command from PATH"
Input admin password and then close VSCode once it confirms its been removed
Close VScode application
Re-open VScode and press Command+Shift+p
Type "Install code command to PATH"
Input admin password
Try now and this should work.
I found if i didnt close VScode after removing/adding command to PATH, the setting was lost.
Hope this helps.

Related

Renaming files doesn't take effect in VScode while using WSL2

I have a very annoying problem in my VScode setup.
I'm using WSL as a terminal to work on my projects and occasionally, mistype the name of one of the folder or file that I'm working with.
For example:
I accidentally created the Mainheader.js file in layout folder (without the capitalized L) therefore, I decided to rename the folder with a capital L.
Now on my React app, any changes made to MainHeader.js file will not be reflected. I did update the related import.
So I decided to delete the entire folder and recreate it with MainHeader.js but this is what I end up with.
The file is there in my folder but when I click on it, I get
"Unable to open Mainheader.js - File not found"
So I try to create it then I get this error:
Unable to create file 'wsl\path]to\MainHeader.js' that already exists when overwrite flag is not set
Has anyone run into this type of behavior in WSL before? It's quite annoying because the only workaround I've found so far is to create a completely different folder with a different name...
Any help would be appreciated. I can't really work like this.
I've been having the same problem for the past 2 days. I presume its a permissions issue, but unfortunately I don't know how to permanently fix it.
I did find this work-around though:
Open a new VS Code window. (I'd recommend closing any VS Code window that had
your project directory open.)
Create a duplicate or copy the contents of the problem file so you don't lose
your code.
Delete the problem file.
Now create the file again using VS Code. Go to File > New Text File. Next paste
in your code.
Now save your new file. Go to File > Save As and save your new file with at the same path + filename + extension that was giving you problems previously. VS Code should allow you to save the new file without any issue.
Now you can open this new VS Code window to your project directory and you should be able to continuing accessing the file that was a problem before.
Basically we just deleted the problem file and then created it again from scratch in a new VS Code window.
Hope this work-around works for you!
EDIT 09/20/2022
Following Baza86's answer here solved the issue for me. Seems like it was a permissions issue of sorts, but if you use the Remote-WSL extension VS code can directly access the linux filesystem.
How to run VScode in sudo mode in WSL2?
You may need add the case option to you options in the wsl config. The default is set to off, however you can set this to off, dir or force.
Open your wsl.conf using sudo with any text editor while running window subsystem Linux. The config file resides in /etc/wsl.conf. This file is used to configure settings per-distribution for Linux distros running on WSL 1 or WSL 2.
My default config looked like this yours may be different:
[automount]
options = "metadata"
add
[automount]
options = "metadata,case=dir"
Here is the official Microsoft docs for Advanced settings configuration in WSL - https://learn.microsoft.com/en-us/windows/wsl/wsl-config

How to change folder that opened by default in VSCode?

I have small problem with VSCode folder, that opened by default.
Problem description: I start new instance of VSCode (trough File->New Window), and then if I choose File->Open Folder it opens dialog with my Windows user folder as starting point (C:\Users\MyUser)
Question: How can I change that folder in settings (if it possible)? So by default it will show as start point for example D:\development\ ?
At the time I write this answer, this is not possible. There are two problems on Windows, and one problem on Mac and Linux:
VS Code does not provide a default path to the file dialog 1. It does remember the last folder that you opened a file in, but that path cannot be used as a default because it is overwritten constantly.
On Windows only, Electron ignores the default path when creating a file dialog if the default path is a directory 2.
An extension also cannot solve this, because extensions are not allowed to modify the File menu 3.
I think the best option at this point is to pin a folder to the Quick Access area in Windows Explorer, as suggested in a comment, or to put an actual shortcut in the user profile folder.
Workspaces and File > Open Recent may also be helpful if you often open the same folders.
Your main problem is that you are unable to open your specific folder in VScode.
To solve that you can simply open the terminal/cmd in that specific window by just typing cmd in your search bar or just by pressing shift+right-click in that folder.
Now your cmd is open and you just have to type "code ." in the cmd and press enter to open the current folder in your VSCode.
In case that code . doesn't work for you then you have to add the Vscode in the environment variables of your windows.
Visual Studio doesn't provide a specific feature to open a specific path. But there is a solution to your problem. You are saying that you want D:\develpment as a default when you open VS Code. You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.
make a shortcut on the desktop for vscode and then modify it and add the folder after the .exe command. This will default open that folder when you double click on it.
Visual Studio Code can be installed in two ways - User setup and System setup. I strongly believe you have User setup installed in your PC. Try re-installing it System-wide. That should probably fix your problem.
For more information: https://code.visualstudio.com/docs/setup/windows#_user-setup-versus-system-setup
PS: A lot more information is needed, you can share a screenshot of the window and elaborate more on it.

How to NOT open Visual Studio Code from the command line

I see a lot of posts asking how to open VScode from the command line; I have the opposite problem!
When a type a file name from the CMD terminal, VSCode is launched with the file contents...why is that? I don't want that to happen! Any ideas on how to stop this from happening?
Maybe you should check your environment variables and find path for VScode, then delete it
Also maybe in your file properties VScode is set to default opening app , so it open files by default
For example (In my case Intellij IDEA) it looks something like this:
this mean you should go to properties and change "opens with" options
Thanks for the hints; they both helped on solving the problem.
The one particular file that I wanted to execute and NOT open with vscode is a bash script file with extension " .sh ".
I checked the file manager and it is not associated with vscode; instead, it says "SH Source File".
Then, I followed the link to thisdavej and after seeing the proposed registry entries, I went ahead and looked into my own registry...found that the .sh extension had an "OpenWithProgids/VSCode.sh", deleting that solved my problem. Now, when I type the name of the shell script, it actually executes.
Thanks.

Atom - Unable to save file: Permission denied (Windows)

I've been a long time user of notepad++ and I enjoy it a lot, but a friend recently recommended me to use Atom, so I gave it a try. However, when I try to save anything in my project folder (or any file at all), I receive this message that I am unable to save file: permission denied.
I've tried typing the command sudo atom /path/to/file in my PowerShell for Windows, but I get the following message:
I understand that sudo is a Linux-based command and thus would not work in a Windows environment but would there be an alternative route to get Atom working on my machine?
Thanks a lot!
The files were made "Read Only" somehow (maybe your anti-virus software or something, who knows...).
Solution:
Go to the folder in the Explorer, highlight all of the files in your project. Right click, open the properties. Deselect "Read-Only" and push ok. When it asks if you would like to apply to only the selected files or also to the files in any sub-folders, click yes if you need to.
This should fix your problem.

QuickText in notepad++ not saving code snippets!

I installed notepad++ on Windows7. I installed QuickText into notepad++. I add my custom snippets into QuickText and while notepad is open, the snippets work fine. As soon as I close notepad and open it again, the snippets are gone. Has anyone else had this problem, it should be an easy fix? They are not persisting or sticking.
Anyone know how to fix this? Any ideas?
Haven't used Quicktext but it looks like it is no longer under development.
From what I can tell FingerText is similar, and hopefully should be able to do what you are after.
The complete answer lies in a combination of Nick's and Jrod's answers.
If you create the a Config folder in the C:\Program Files\Notepad++\plugins\ (or C:\Program Files (x86)\Notepad++\plugins\ if you installed it to that folder) and then place the QuickText.ini file within that folder you will notice many default "snippits" show up.
Now in order for you to save your "snippits" if you are in Windows 7 or Vista (which will save to the QuickText.ini file) you must run Notepad++ as Administrator.
As a side note the snippits save fine with in Linux if you install Notepad++ through Wine.
This issue is caused by administrative privileges. You need to run notepad++ as an administrator or it will fail silently.
You must copy QuickText.ini to folder c:\Program Files\Notepad++\plugins\Config\ (I created this folder itself)
This page help me
Sorry for my badly english. Your problem is in inslall. Correct install:
Copy to folder plugins all files except one (quicktext.ini).
In such directory create new folder config.
Copy quicktext.ini into it.
After such installation snippets works correctly.