VS Code "Can not resolve workspace folder" - visual-studio

I've just started noticing something strange in VSCode 1.24.1 on MacOS 10.12.6 Sierra.
My file explorer has been marking my current working directories as "unresolved". This does not prevent me from doing anything I normally would though I am wondering why this is happening. The folder name will be yellow and will be marked with an ! on the right.
I've tried closing and reopening the directories in my file explorer, restarting VSCode itself and moving the folder to a separate directory. Nothing doing.
I haven't been able to find much on the issue except in the case of people working in Typescript files that aren't properly configured in a manifest file on React projects. These are mostly HTML/CSS/Sass/JS/MySQL.
Any insight would be appreciated, thank you.

I was having the same issue on Windows when I had previously created different projects on the undefined workspace (the default workdspace of VSCode).
When I create a workspace and I placed my root folders inside this one workspace, it will warn that it could not resolve workspace folder.
You have to edit your workspace config file, change the path of your folders and then restart VSCode.
On the VSCode command palette, type: workspace config - then choose "Open workspace configuration file."
You should have something like this:
{
"folders": [
{
"path": "OneProject"
},
{
"path": "AnotherProject"
}
],
"settings": {}
}
What you want is something like this:
{
"folders": [
{
"path": "C:/Somewhere/OneProject"
},
{
"path": "C:/Somewhere/AnotherProject"
}
],
"settings": {}
}
It's a known issue, it was fixed here - https://github.com/Microsoft/vscode/issues/50866
As of the 1.24.1 version it's not yet available. But the fix listed above should correct the problem you are having.

Replace ${workspaceFolder} with ${FOLDER_NAME:workspaceFolder} in your *.code-workspace file. (from here)
By the way, same goes to ${workspaceRoot}, you can replace it with ${FOLDER_NAME:workspaceRoot}.
Any more folder variables ca be fixed with this FOLDER_NAME: prefix? My workspaces did not use them so far.
Worked for me in Version: 1.44.2.

I had this issue also with VS and also showing an exclamation mark as well as the error code you have said, my solution was to go into my work folder where my file was located and in that folder i right clicked and re-arranged the folder so it was showing them as application order and it got rid of the error code and exclamation mark.

In my case I resolved this by restarting the WSL machine by writing the following in the windows cmd
wsl --shutdown
take care this might stop running docker containers and other related processes.
Then I started a new wsl terminal and vscode worked like a charm.

I deleted the folder and created a new one with a different name and it was fixed. No workspace config file fix needed as it fixes/updates itself when you change folder structure and update projects.

Please, remember to check what you opened. I struggled for this very stupid error for a day.
If you open VSCode, and then Open Folder, and then Add Folder, do not execpt theat ${workspaceFolder} will be you last folder, or the folder of your code. Its valeue will be the first folder you added...

Related

Error: No such file (sftp liximomo extension)

I have this problem when I upload a file on the server using the extension liximomo/vscode-sftp for visual studio code.
[error] Error: No such file
at SFTPStream._transform
at SFTPStream.Transform._read
at SFTPStream._read
How I can fix this problem? I tried to upload files to different servers, so I guess it's not a server-related problem but an extension.
There is a better fix on GitHub that works for upload and download via SFTP extension:
Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;
Add options.autoDestroy = false; after both instances.
- mrjcgoodwin commented 8 days ago
This is apparently a brand new problem that has been introduced into the newer versions of VS Code. I have FOUND A SOLUTION that seems to work well, by modifying a single line in the extension code. This is only valid for version 1.12.9 of the liximomo.sftp extension.
Here are the steps:
Shutdown / Quit VS Code.
Locate the following file:Mac OS X:
~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.jsWindows:C:\Users\account_name\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js
Make a backup copy of the file.
Modify line 388, which should be:if ( code === STATUS_CODE . OK ) { changing it to:if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {
Save the file.
Relaunch VS Code; test by uploading or downloading from your sftp server. The error should not be present.
The alternative solution involves downgrading your version of VS Code. This is not desirable as you are not getting the latest fixes, security patches, etc..
See the following links regarding this issue:
https://github.com/liximomo/vscode-sftp/issues/266
https://github.com/liximomo/vscode-sftp/issues/569 (repeat)
https://gitmemory.com/issue/liximomo/vscode-sftp/915/827578565 (note, this site has a bad SSL certificate).
If you want to downgrade your VS Code; use this link to find the older versions:
https://code.visualstudio.com/updates/v1_55
CREDIT:
Bao from: https://blog.naver.com/PostView.nhn?blogId=pcgun70&logNo=222341271496
From their blog entry (translated by Google to English):
"At first, there was no solution, but Now, 12 hours later, the Holy
One appeared, who told me how to solve it.files that sftp cannot find
in the first place. There is a calling phrase, VScode is upgraded and
an error is called. It came out. Actually, I did not solve the
problem. Even if the file is not found, the same result as the
success process is exported. It is just a modification. It is
expected that a modified version will be released in the future."
Not an answer to the problem, but solution in another (simple) way:
install Run On Save VSCode extension
write a deploy.sh script along the lines
rsync -avz -e 'ssh -i /home/user/.ssh/id_rsa' --exclude '.history' --exclude '.vscode' --exclude '.git' --exclude '.gitignore' --exclude 'deploy.sh' ./ user#domain.net:/home/user/public_html/
add the following configuration to VSCode settings.json to trigger the deploy.sh script on file save:
"emeraldwalk.runonsave": {
"commands": [
{
"match": ".*",
"isAsync": false,
"cmd": "${workspaceFolder}/deploy.sh"
},
]
}
Just switch to the second one:
There is another solution only upgrading the ssh2 package from the extension.
You just need to go to the extension path:
Windows:
C:\Users\your-user\.vscode\extensions\liximomo.sftp-1.12.9
When you are there, change the version of ssh2 package on the package.json file to ^1.1.0. Finally, just run npm install.
You should restart VSCode.
Alternatively, you could use a fork of the repository that is active and fixing these issues: https://github.com/Natizyskunk/vscode-sftp

Missing manifest.json when uploading Firefox Add-on to AMO

I'm unable to upload my firefox extension using the form provided by mozilla. I'm constantly getting the error Your add-on failed validation with 2 errors.
No install.rdf or manifest.json foundAdd-on missing manifest, which is very misleading because my application has a manifest.json.
The manifest.json looks like this:
{
"manifest_version": 2,
"version": 1.0,
"name": "my-extension-name",
"description": "Lorem ipsum dolor sit amet",
"background": {
"scripts": ["js/background.js"]
},
"main": "popup.js",
"browser_action": {
"default_icon": "img/icon_grey.png",
"default_popup": "popup.html",
"default_title": "loremipsum"
},
"engines": {
"firefox": ">=38.0a1"
},
"permissions": [
"activeTab",
"tabs",
"background",
"http://*/*",
"https://*/*",
"notifications",
"alarms",
"storage",
"webRequest",
"webRequestBlocking",
"clipboardRead"
]
}
What is missing for this to work?
I was running into the same problem but all of these instructions didn't solve it.
What i always did was to pack the whole folder, hence the manifest.json was not on the first level, when unpacked.
SOLUTION FOR ME
Select all files, instead of the folder, and then pack them as one .zip file and it should work. At least it did for me.
Here is a link to the MDN Documentation.
The very simple answer to this is that its unable to find the manifest in your zip file. This is caused because when you take a file and zip it using the default compressor in windows it takes the file and throws it into a sub folder of the zip file you created...
before compressing
folderYouWantCompressed
-FileInFolder.html
-Manifest.json
after compressing it will look like this
nameOfZip.zip
-folderYouWantCompressed
-FileInFolder.html
-Manifest.json
but what you want is
nameOfZip.zip
-FileInFolder.html
-Manifest.json
the reason Oliver Sauter answer works is because when you select all the files within the "folderYouWantCompressed" it compresses without the sub folder meaning you dont run into this problem and it has no problem finding the manifest file.
for what I can tell the "correct answer" seems to be signing the add-on itself and is able to get the manifest file properly, so it does work but just seems like a 3rd party way of doing it (I did not look into it too deeply)
Note: that I originally had my issue solved by looking at Oliver Sauter post I just wanted to make it clear for future people looking at this post.
When you open your addon package zip file, the manifest.json file should be visible to you in order to upload it on AMO.
In your case, it looks like when you open your package zip, there is a folder and inside that folder manifest.json is located.
As I have found a solution to my problem and would like to share it for future reference I answer my own question:
The issue at hand was that I did not use the web-ext command line tool to create the .zip / .xpi package. I was able to solve the problem by installing web-ext and using web-ext build to build the extension. The result of this operation is a .xpi file that contains the project which I was then able to upload to the AMO service. Note that the manifest.json in the newly created package is identical to the manifest.json I originally provided. However, in addition to the manifest.json a directory META-INF was created which contains a mozilla.mf, mozilla.rsa and mozilla.sf file.
This however, did not entirely solve my problem. After uploading the extension to AMO, it could not be installed and was said to be damaged. Apparently, which is what I read somewhere in the interwebz (and forgot the source), Mozilla opens the .zip / .xpi package that is uploaded to test it and since my package was not signed, Mozilla could not ensure its integrity and marked it as insecure (i.e. damaged).
In order to solve the second problem I had to sign the extension. This can be done using the following command:
web-ext sign --api-secret YOUR_API_SECTER --api-key YOUR_API_KEY
After this, I was able to upload and install the extension.
Got the same problem, the problem was thats the file name is case sensitive:
Manifest.jason -> error, no manifest found
manifest.json -> susscessful
my solution (in mac os):
zip a directory using zip in terminal command zip -r example.zip example instead of right-clicking files and clicking "Compress" in mac os

Icon not showing in firefox add-on manager

I have a new Firefox add-on with the following directory structure:
/
package.json
data/
icons/
icon48.png
In my package.json file I have this:
"icon": "data/icons/icon48.png",
(among other things). When I run jpm run as recommended by the Firefox add-on docs, the extension loads but the icon is not visible in the add-on manager. Any idea what I'm missing? I have been referencing this page: https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/package_json#icon, but no luck.
Thanks!
Apparently this is a bug. See this issue in the jpm repository.
For me, moving the icon image to the root directory (i.e. the same path as package.json) and renaming it "icon.png" fixed the problem.
I still have this bug with jpm 1.0.6 version. I solved it adding the next icon path:
{
"id": "jid1-AKuBexDY5zJsIQ#jetpack",
"icon": "resource://jid1-akubexdy5zjsiq-at-jetpack/data/images/icon48.png",
}
Note that the "path" is similar to the "id" field but there are not capital letters

Xcode 6 beta 3: invalid virtual filesystem overlay file

After updating to Xcode 6 beta 3 the compiler keeps crashing with the following error:
/[Long-path-goes-here]/all-product-headers.yaml:4:13: error: Could not find closing ]!
'roots': [
^
fatal error: invalid virtual filesystem overlay file '/[Long-path-goes-here]/all-product-headers.yaml'
1 error generated.
Solved by doing the following:
Find the /[Long-path-goes-here]/all-product-headers.yaml (Go to Folder... in Finder)
Replace the contents with the code below.
Save and lock the file. (Get info for file, check locked.)
{
'version': 0,
'case-sensitive': 'false',
'roots': []
}
After this Xcode will complain about not being able to write the file with this error this is expected and doesn't seem to affect the build. Edit: For most people. If it prevents you from running try disabling Defines Module in Build Settings of your Target:
Unable to write to file /Users/user/Library/Developer/Xcode/DerivedData/.. (You don’t have permission to save the file “all-product-headers.yaml” in the folder “Pods.build”.)
Hat off to the discussion on Apple Developer forums. Also, this is the relevant issue in CocoaPods issue tracker.
Try setting "Defines Module = YES" in your app target. Works for my project.
Clean (command-shift-K), and clean-build-folder (command-alt-shift-K) and build again worked for me.
I had this problem because I deleted some old archives and files from my mac to make more space. However running pod install for this project solved it.
Perhaps your path to .yaml file contains ' character. It makes the parser confused. Using TextWrangler, you can see your path has different colors (red & black).
That's my case, and moving project to another path (which doesn't contain ') solved my problem.
I solved it by delete the current project's DerivedData folder by (Xcode 8):
Xcode > Preferences > Locations tab > Click on the right arrow under
DerivedData > inside the folder DerivedData delete the project folder.
Better to do hard clean also by Shift+Cmd+Alt+K.
And build.
Can fix with one shell command:
echo "{\n\t'version': 0,\n\t'case-sensitive': 'false',\n\t'roots': []\n}" > /[Long-path-goes-here]/all-product-headers.yaml
Where the path is copied out of the Xcode error.
See Daniel Schlaug's answer for background info
I tried all the answers above/below. None worked.
However, Restarting Xcode did it.
Try that before going into the madness of trying to fix the actual situation of the missing file. All the rest is madness. Heck, If that doesn't fix it. I would even try restarting every time you do one of the strategies listed here. Maybe one of those fix it but Xcode gets stuck until you restart it.
Nothing else to do, Xcode is just too buggy at times.
I get this error too frequently, so I've made a simple bash script based on Daniel Schlaug's answer. I've never needed to lock the file. Just copy the file referenced in your error log and use it as the only parameter. Don't forget to chmod +ux before running.
#!/bin/bash
if [ "$#" -eq "0" ]
then
echo "No arguments supplied"
exit
fi
rm -rf $1
echo "
{
'version': 0,
'case-sensitive': 'false',
'roots': []
}" > $1

Sublime Text projects on both Mac and Windows

I'm not sure if this is possible or been done before but...
I jump between a Windows and Mac Sublime Text 2 IDE. My active projects are stored in a Dropbox folder that is synced between my Windows machines. Tonight I opened up Sublime on my OSX Maverick machine hoping to pound out some code. Of course the project file wasn't able to find my Windows path and open the folders needed. I opened the project file and see my windows path being specified.
"folders":
[
{
"path": "/C/Users/me/Documents/Dropbox/Development/Projects/Active/folder"
}
]
Is it possible to specify the mac folder in the same project file? Am I missing something very simple?
Thank you!
There were multiple threads started on ST forums, I will post a few of them where you may find suggestions that may help, but there are no ways to do this but keeping the path relative to the .sublime-project file. You may keep it in the directory where your project resides and point to it with "path": ".".
https://www.sublimetext.com/forum/viewtopic.php?f=2&t=14601
http://www.sublimetext.com/forum/viewtopic.php?f=2&p=57728
https://www.sublimetext.com/forum/viewtopic.php?f=2&t=15278
As ST devs are very quiet right now I doubt it will be changed before the ST3 release.
I am using sublime text 3.
Creating a folder structure with sublime in Windows it looks like this:
{
"folders":
[
{
"path": "C:\Dropbox\workspace\01_snippets\os"
},
]
}
The only way to get it running on a mac and win is
* using relative paths
* to change from \ to /

Resources