Visual Studio 2019,"Show all files" 没有 Intellisense
Visual Studio 2019, no Intellisense with "Show all files"
我从 Visual Studio 2019 年开始学习 C++,并注意到一个奇怪的行为。当您创建一个空项目时,您会看到 "Filter" 个文件。现在,如果我激活 "Show All Files",我就可以创建目录。我创建了以下结构:
/Core/
/Engine/
Main.cpp
现在,如果我创建一个 "class",默认情况下,它会在 Main.cpp
旁边创建。然后我会将 Class.h
和 Class.cpp
移动到 /Core/
。
现在,如果我开始编辑新创建的文件,我就会失去 Intellisense。如果我取消选中 "Show All Files" 我会把它取回来。还有其他人有同样的问题吗?
我想问的另一个问题是关于过滤器文件和项目文件夹结构。我应该使用过滤器文件来组织我的项目还是实际的文件夹结构?由于 Intellisense 问题,我有点困惑,这就是我问的原因。
如果我应该创建一个文件夹结构,我应该如何处理这样的包含 #include "..\..\... \FileUpInTree.h"
。在 Javascript 和 Webpack 中,您可以定义 "Alias" 目录来消除这种情况。我想知道 Visual Studio 是否也存在类似的东西。也许命名空间?
Now if I start editing the newly created files I loose Intellisense.
If I uncheck "Show All Files" I get it back. Does anyone else have the
same problem?
我遇到了与您描述的相同的问题,当我将文件迁移到 Show All Files 过滤器下的另一个文件夹时,Intellisense 不起作用,这真是奇怪。当我没有迁移文件时,Intellisense 在默认地址运行良好。
我有 reported this issue on our DC Forum,你可以添加任何关于该问题的详细信息 link,任何对这个问题感兴趣的人都会投票,这样它将 Microsoft 非常重视。
解决方法是您应该取消选中显示所有文件,然后再次单击它。之后Intellisense回头就可以正常工作了
Another question I wanted to ask was about filter files and project
folder structure. Should I use the filter files to organize my project
or an actual folder structure? I'm slightly confused because of the
Intellisense problem, that's why I'm asking.
Actually,当你在c++工程中使用默认工程类型时(不是点击Show All Files),这个结构会自动识别项目中的每个文件并将其分类到自己的过滤文件夹中。这时候intellisense就完美了,因为细分各种文件不会冲突
但是在这种格式下,您无法创建文件夹结构。
此外,使用过滤文件或实际文件夹结构都是一样的效果。如果您在 Windows Explorer 中使用实际项目结构,它将自动显示在解决方案资源管理器下(单击 Show All Files)。
建议
只要不想随意迁移文件,都可以在这个过滤器下使用Intellisense。
或
1) 在 Show All Files 下创建文件夹结构,然后取消选中 Show All Files获取 Intellisense。
And if I should create a folder structure, how should I handle
includes like this #include "....... \FileUpInTree.h". In Javascript
and Webpack you could define "Alias" Directories to eliminate this. I
was wondering if something like this exists for Visual Studio aswell.
Maybe namespaces?
我觉得你不用太担心这个。
当你想使用项目文件夹结构下的文件时,直接使用#include"xxx.h"
即可,Intellisense会自动抓取项目中的头文件
和如果你想引用一个c++class,你可以直接使用namespace <the c++ class namespace>
.
我从 Visual Studio 2019 年开始学习 C++,并注意到一个奇怪的行为。当您创建一个空项目时,您会看到 "Filter" 个文件。现在,如果我激活 "Show All Files",我就可以创建目录。我创建了以下结构:
/Core/
/Engine/
Main.cpp
现在,如果我创建一个 "class",默认情况下,它会在 Main.cpp
旁边创建。然后我会将 Class.h
和 Class.cpp
移动到 /Core/
。
现在,如果我开始编辑新创建的文件,我就会失去 Intellisense。如果我取消选中 "Show All Files" 我会把它取回来。还有其他人有同样的问题吗?
我想问的另一个问题是关于过滤器文件和项目文件夹结构。我应该使用过滤器文件来组织我的项目还是实际的文件夹结构?由于 Intellisense 问题,我有点困惑,这就是我问的原因。
如果我应该创建一个文件夹结构,我应该如何处理这样的包含 #include "..\..\... \FileUpInTree.h"
。在 Javascript 和 Webpack 中,您可以定义 "Alias" 目录来消除这种情况。我想知道 Visual Studio 是否也存在类似的东西。也许命名空间?
Now if I start editing the newly created files I loose Intellisense. If I uncheck "Show All Files" I get it back. Does anyone else have the same problem?
我遇到了与您描述的相同的问题,当我将文件迁移到 Show All Files 过滤器下的另一个文件夹时,Intellisense 不起作用,这真是奇怪。当我没有迁移文件时,Intellisense 在默认地址运行良好。
我有 reported this issue on our DC Forum,你可以添加任何关于该问题的详细信息 link,任何对这个问题感兴趣的人都会投票,这样它将 Microsoft 非常重视。
解决方法是您应该取消选中显示所有文件,然后再次单击它。之后Intellisense回头就可以正常工作了
Another question I wanted to ask was about filter files and project folder structure. Should I use the filter files to organize my project or an actual folder structure? I'm slightly confused because of the Intellisense problem, that's why I'm asking.
Actually,当你在c++工程中使用默认工程类型时(不是点击Show All Files),这个结构会自动识别项目中的每个文件并将其分类到自己的过滤文件夹中。这时候intellisense就完美了,因为细分各种文件不会冲突
但是在这种格式下,您无法创建文件夹结构。
此外,使用过滤文件或实际文件夹结构都是一样的效果。如果您在 Windows Explorer 中使用实际项目结构,它将自动显示在解决方案资源管理器下(单击 Show All Files)。
建议
只要不想随意迁移文件,都可以在这个过滤器下使用Intellisense。
或
1) 在 Show All Files 下创建文件夹结构,然后取消选中 Show All Files获取 Intellisense。
And if I should create a folder structure, how should I handle includes like this #include "....... \FileUpInTree.h". In Javascript and Webpack you could define "Alias" Directories to eliminate this. I was wondering if something like this exists for Visual Studio aswell. Maybe namespaces?
我觉得你不用太担心这个。
当你想使用项目文件夹结构下的文件时,直接使用#include"xxx.h"
即可,Intellisense会自动抓取项目中的头文件
和如果你想引用一个c++class,你可以直接使用namespace <the c++ class namespace>
.