For some reason whenever I begin to type the file path after an #import rule in my main.scss file,
VSCode disconnects from WSL2. I am using WSL2 version 20.02 on Windows 10. VSCode is Version 1.54.1 (user setup).
I am pretty new to all this. I am simply trying to import an icon font that I selected from the icomoon.io app and I am using the sass files that the app generated. I am trying to copy and paste the variables into my own sass files. (I will also put the font in my files as well). I have some styles in "main.scss" just to kind of test things and then I have a bunch of variables in the _variables.scss file. I'll type #import and everything is fine but as soon as I begin to type the path within the "" WSL disconnects and cannot even read the _variables.scss or main.scss file, let alone save/write to the files.
I have to close the whole folder and reopen it again from the terminal using code bjf5201.github.io (bjf5201.github.io being my project folder name)
Any ideas?
I had the same issue and found out that it was because of the Color Highlight extension I was using. After disabling it, everything works fine.
There is an alternative extension colorize, which seems to be compatible and does the same thing.
Related
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
I'm working on Laravel project. When I want VSCode jump to class's file in vendor, just got issue that it can't open file in correct location.
My working directory is C:\wamp64\www\merchant but VSCode try to open the file from C:\wamp64\www\wallet
My question is that is there anyway to tell VSCode the correct working directory?
delete folder .phpls (~/.phpls or %USERPROFILE%\AppData\Local\PHP Language Server\ on Windows)
is the way to clear VSCode PHP extension server cache.
I'm attempting to put together a standard VS Code build for my company. I have a ps1 file that copies/installs extensions for VS Code after it's been installed but I can't seem to find how or even if it is possible to then configure VS Code settings to utilize those extensions.
For example, one of the extensions is "vscode-icons". I can install the extension just fine but then the user needs to setup his preferences manually to actually use the extension by going to the File->Preferences->File Icon Theme->VS Code Icons.
Is it possible to have my ps1 install file actually make configuration changes so any user who opens VS Code has the custom configuration settings?
The config settings for VS Code are JSON files - just needs to locate and edit them.
First check what manual change is doing then create part in the script to edit the settings.
https://code.visualstudio.com/docs/customization/userandworkspace
I know I can use command "code" to open VS code or file, but I don't know what should I do to make it possible after I install VS code in Ubuntu.Thanks.
Launching from the Command Line
You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. We find the best way to do this is to simply type:
code .
Tip: We have instructions for Mac users in our Setup topic that enable you to start VS Code from within a terminal. We add the VS Code executable to the PATH environment variable on Windows and Linux automatically during installation.
Sometimes you will want to open or create a file. If the specified files does not exist, VS Code will create them for you:
code index.html style.css readme.md
Tip: You can have as many file names as you want separated by spaces.
Source: https://code.visualstudio.com/Docs/editor/codebasics
So, there are a couple of solutions for this.
I've linked a video that shows you how to add vscode to $PATH
(which didn't work for me because I couldn't find the "shell:install path" command)
I uninstalled the vscode from my ubuntu and re-installed using sudo snap install --classic code
(This method worked for me)
Tell me which one works for you... and if you have extensions installed to your vscode then i guess you ought to make a backup or something.
Link to the video: https://youtu.be/iP5FKZXtDBs
I installed FSharp 3.1, Emacs 24 and fsharp-mode of emacs. Howerver the auto-completion feature (complete-at-point) didn't work. I followed all the instructions here https://github.com/fsharp/fsharpbinding/blob/master/emacs/README.md and added fsautocomplete.exe to my $PATH .
But it still didn't work.
PS:
I failed in Debian sid, Ubuntu Trusty and Mac 10.9.
I am the author. In order to have autocomplete in fsharp-mode, you must either be editing a script (.fsx) file, or a normal (.fs) file that is associated with a project (.fsproj) file.
If a .fs file is opened and no other project has already been loaded, then fsharp-mode will look for and load a .fsproj in the current and enclosing directories. This can be done manually using C-c C-p. At this point autocompletion will be available in all .fs files mentioned in the project.
If a project has not been loaded, then no autocompletion will be available in .fs files.
I tried to make this clear in the README.md. I'll have a look updating it, and trying to give feedback in the interface as to why autocompletion is not available.
The author gave me the solution that the .fs file must be in the same directory with the .fsproject relating to it.