VS Code“无法解析工作区文件夹" [英] VS Code "Can not resolve workspace folder"

查看:39
本文介绍了VS Code“无法解析工作区文件夹"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始注意到 MacOS 10.12.6 Sierra 上的 VSCode 1.24.1 中有一些奇怪的东西.

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.

我尝试关闭并重新打开文件资源管理器中的目录,重新启动 VSCode 本身并将文件夹移动到单独的目录.无所事事.

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.

除了在 React 项目的清单文件中没有正确配置的 Typescript 文件中工作的人之外,我无法找到太多关于这个问题的信息.这些主要是 HTML/CSS/Sass/JS/MySQL.

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.

推荐答案

当我之前在未定义的工作区(VSCode 的默认工作区)上创建不同的项目时,我在 Windows 上遇到了同样的问题.

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.

您必须编辑工作区配置文件,更改文件夹路径,然后重新启动 VSCode.

You have to edit your workspace config file, change the path of your folders and then restart VSCode.

在 VSCode 命令面板上,输入:workspace config - 然后选择打开工作区配置文件".你应该有这样的东西:

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": {}

}

你想要的是这样的:

{
"folders": [
    {
        "path": "C:/Somewhere/OneProject"
    },
    {
        "path": "C:/Somewhere/AnotherProject"
    }
],
"settings": {}

}

这是一个已知问题,已在此处修复 - https://github.com/Microsoft/vscode/issues/50866

It's a known issue, it was fixed here - https://github.com/Microsoft/vscode/issues/50866

从 1.24.1 版本开始,它还不可用.但是上面列出的修复程序应该可以解决您遇到的问题.

As of the 1.24.1 version it's not yet available. But the fix listed above should correct the problem you are having.

这篇关于VS Code“无法解析工作区文件夹"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆