Visual Studio Code: Unable to open 'MyFile.h': File not found - visual-studio-code

I got this kind of errors when attempting to go to the declaration of some attributes/methods (using ctrl/cmd + left click):
Unable to open 'MyFile.h': File not found
probably this happens because the file MyFile.h has been moved recently.

I solved this problem by forcing VSCode to re-scan the project structure.
In order to do that, I closed VSCode, deleted the .vscode hidden folder of my project, and opened it again.

I had the same issue and solved it by reloading my VS code window.
Ctrl + Shift + P on Windows
Command + Shift + P on Mac
Type:
Reload Window
Then select Developer: Reload Window

Related

Updating vscode doesn't show user code snippets

Updating vscode doesn't show user code snippets.
If I move the cursor after entering the prefix, it appear only then.
This issue can be resolved by following these steps:
Close Visual Studio Code.
Go to your user snippets folder, usually located at ~/.config/Code/User/snippets (for Linux), %APPDATA%\Code\User\snippets (for Windows) or ~/Library/Application Support/Code/User/snippets (for Mac).
Backup your user snippets folder by renaming it to something like snippets_backup.
Reopen Visual Studio Code.
Check if your user snippets are appearing now.
If the above steps don't solve the problem, you can try clearing the Visual Studio Code's cache:
Go to the Command Palette (Ctrl + Shift + P on Windows, or Cmd + Shift + P on Mac).
Type in "Developer: Delete Settings File".
Select the option "Developer: Delete Settings File" from the dropdown.
Confirm the deletion of the settings file by clicking on the "Yes" button.
Reopen Visual Studio Code.
These steps should resolve the issue with your user code snippets not appearing after updating Visual Studio Code.

How to go back from the native notebook experience in vscode Jupyter

So today my ipynb files were now opening in the native notebook experience and I want to revert back to as it was before. I tried installing previous versions of the jupyter extension but it's still opening my ipynb files in the native experience only. Any idea how I can accomplish that?
open your settings JSON (press F1 or Windows: Ctrl + Shift + P, Mac: Command + Shift + P)
add the following to your JSON settings:
"jupyter.experiments.optOutFrom": ["NativeNotebookEditor"],
restart vscode and check if you have the old version back.

Visual Studio Code 2019 terminal not opening

I was using visual studio code 2019 for C++ Programs, and suddenly now I have seen that when I press Ctrl + ~ my VS code terminal is not opening.
It gets open and close again. It is not showing any error.
I tried uninstall and install again of VS code and I tried changing setting.json modification. I am not sure what it is going wrong.
Please Note: after all this I tried using code runner but it was not helping, so
I again uninstalled it.
My setting.json is like below
{
"terminal.integrated.inheritEnv":true,
"code-runner.runInTerminal": false,
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"C_Cpp.default.compilerPath": "",
"terminal.integrated.automationShell.windows": ""
}
I have not a good fix but probably it can work.
Follow this step by step and hope it fixes it for you.
Step 1: Uninstall VS Code using Program and Features.
Press Windows Key + R
Enter appwiz.cpl
Press enter.
The Uninstall a Program window will be open. Find VS Code and uninstall it from there.
Close the window.
Step 2: Remove the saved data from the Local folder.
Press Windows Key + R
Enter appdata
Press enter.
The AppData folder of your current use will open. Now do:
Double Click and Open Local folder.
Find the folder named Programs and Open it.
If you see the folder named: Microsoft VS Code then delete it. (Only do it after you delete VS Code from Uninstall a Program) else, return to the Local folder.
Close the folder.
Step 3: Remove the saved data from Roaming folder.
Press Windows Key + R
Enter Appdata
Press Enter
The Appdata folder will open again.
Double Click and Open Roaming folder.
Find the folder named: Code and delete it. (Only if you have deleted VS Code from Uninstall a Program)
Now install the setup of VS Code and install it again. This issue, most probably solved. This is because the left over setting of VS Code can be stored in your PC in order to use again if install. So casual reinstallation can't help. If you remove the saved folder the previous settings will not be inherited as they will not exist. A new folder will be created and thus new setting will be used which can be set accordingly again.
Hope this helps to solve your problem. :)
Thank You! :D
I was able to solve this with installing again Powershell.

Vscode peek definition stops working after one/two use/s

I am using vscode version 1.51.1 e5a624b788d92b8d34d1392e4c4d9789406efe8f x64 on ubuntu version Ubuntu 20.04.1 LTS.
I am working on C code in Vscode. It has extension C/C++ (C/C++ IntelliSense, debugging, and code browsing.).
The option - peek definition works fine for the first one/two times but then goes away.
Screenshot of peek definition when working:
Screenshot of peek definition on second attempt - not working:
For now, to get the peek definition back, I have to either reload window (ctrl + shift + p -> reload window -> enter) or restart Vscode.
Any idea how to stop the feature from disappearing?
The problem persists when symlink is used to open the project in vs code. If the actual path is provided while opening the project, the plugin vscode-cpptools works correctly.
Refer link [issue on github] - https://github.com/microsoft/vscode-cpptools/issues/6280

How do I factory reset Visual Studio Code or Delete Folders

I started to learn one language and moved to a different one. I want to start with that language with a fresh code editor. But I don't know how to reset visual studio code and delete all my data. Can someone help me? I'm quite new to vs code. (Sorry if this is a stupid question)
You can delete VSCode related data comletely by deleting both of these or if you just want to reset your editor just delete the .vscode folder in your user profile.
To Delete user data directory Code:
Windows %APPDATA%\Code
macOS $HOME/Library/Application Support/Code
Linux $HOME/.config/Code
To Delete the extensions and other related data, delete the folder named .vscode:
Windows %USERPROFILE%\.vscode
macOS ~/.vscode/
Linux ~/.vscode/
Press CTRL + SHIFT + P
Type "settings json"
Click "Preferences: Open Settings (JSON)"
Edit file and leave only braces { }