I have a bigger C++ Project. I use the Micrsoft C++ Extension with the default settings.
Intellisense takes sometimes over 1 minute to catch up with suggestions.
In order to solve the problem, I went through the settings. I've seen it is possible to set the Intellisense engine to "Tag Parser", it solves all the performance problems as expected, but unfortunately, it deactivates Error Squiggles.
Is it possible to combine Tag Parser Intellisense with the default error checking, if the error checking takes a minute it wouldnt be a such a problem?
Or do you have other ideas to solve the performance problem?
Depends on what compiler your running. I'm using Visual Studio Build Tools. For my UE4 project, source file Intellisense is pretty snappy but header files are really slow. Sadly I believe headers will always be slow on large project's using the default Intellisense. This is because VSCode recalculates Intellisense with every line of a header file you write.
Off topic info:
This is also why you should disable Auto PCH with “C_Cpp.intelliSenseCacheSize” set to 0. Let's say you have a class with a large AutoPCH cache file of 1 Gigabyte (not uncommon with Unreal Engine). VSCode is now deleting and writing this cache with every line you type in a header file. This won't help with Intellisense speed unfortunately.
Back to topic:
Make sure to custom tailor your "C_Cpp.default.includePath" and only include the paths you need. This is used for Default Intellisense but will also be used for Tag Parser if you don't specify any Tag Parser path with "C_Cpp.default.browse.path". Also note that any path in "C_Cpp.default.includePath" is NOT recursively searched for subfolders. You can override this behavior by adding /** to the end of the path. But use it wisely.
For a large project, a better way than using the includePath settings is to use compile commands (compilation database). "C_Cpp.default.compileCommands" lets you use a json file to custom tailor every include path for every header and source file you have. So now default Intellisense is only using the include files it needs for a particular file. You'll have to research on how to create a compile commands json file. There are tools that can auto create this. Unreal Engine actually moved to compile commands for 4.26 but there were no speedups because they still include everything for every file. I believe they have to do it this way based on how UE4 header includes are setup but I'd have to research.
Another way is to limit the #includes in header files and use forward declarations. Put your #includes in source files. This is probably one of the main reasons Unreal Engine header Intellisense is so slow. When creating a class it auto includes header files in the classes header file. Those included headers also include other headers and so on. So when VSCode recalculates header file Intellisense it's very slow. Source files don't seem to care though.
More info:
I forgot to mention about Tag Parser Intellisense. Tag parser info relies on "C_Cpp.default.browse.path" for include files. If you don't specify anything in "C_Cpp.default.browse.path" then:
Anything in "C_Cpp.default.includePath" will be use for tag parser Intellisense.
Your project's path will automatically be added (see Note below on why this might be bad)
Note: Any path used for the browse path that doesn't have /* at the end will be searched recursively for any subfolders that also have header files to cache.
Note: For multifolder projects, all folder project directories(recursive) will also be added to the tag parser includes for one big Tag Parser cache file.
The Tag Parser is still used when using Default Intellisense. It's used for switching between header and source (Alt+O) and for finding symbols. So you should still tweak the Tag Parser paths to your liking.
For large projects the Tag Parser can take 20+ minutes to finish creating it's cache file when you first open the project. You wont get Tag Parser Intellisense until it's finished. For Unreal Engine 4.26 this file is around 1.5 Gigabytes. Good thing though is that is doesn't get deleted and recreated like the Default Intellisense cache files.
You may need to tweak your "C_Cpp.default.browse.path" instead of not specifying one and and letting VSCode do what it wants.
I will say for source files you will miss having Default (Context Aware) Intellisense. But you can try Tag Parser Intellisense if you can get it to work.
Note: You can see when Intellisense is working. Default Intellisense is a fire symbol and Tag Parser Intellisense is a cylinder found on the bottom bar.
Related
In my project, I want to get rid of tons of empty and pointless cpp files for interfaces in IBM Rational Rhapsody.
Setting CPP_CG:File:Generate to Specification yields only header file generation of a class, which is almost what I want. But, the makefile (gpj) still looks for the *Ifc.cpp file. Is there a straight way to exclude these cpp files from makefile?
There is an option CG::File::AddToMakefile which does only work for component files. I found some info that it was working before but with Rhapsody 8, it stopped working.
You should be able to force the suppression of the either header or implementation file of the interface using those properties. However!
Rhapsody expects to find the cpp file of the interface and suppressing it will cause problems with roundtrip function - Roundtrip doesn't just occur explicitly, it will also trigger implicitly by default when you save the project or change focus from code editor to model browser.
During this roundtrip, Rhapsody will try to "fix" the model by replacing the missing cpp file. This will be followed by roundtrip error messages. Disregarding the errors and continuing with roundtrip will probably cause duplicate elements and all sorts of mess.
In other words, what you're trying to do is not really supported and is a bad idea.
We have a web project with Angular, jquery and Telerik Kendo.
When searching for any text Ctrl+Shift+F that is then found in any of their *.min.js or *.js.map files, the VS (both 2013 and now 2015) will become unresponsive for 30-60s. Also when later I scroll the Find Result 1 window, it will momentarily become unresponsive when long line becomes visible. Everything becomes smooth again if I clear the search results from Find Result 1.
We have the *.min.js and *.js.map files included in project itself. Is this wrong approach?
This is a well known problem, the Connect feedback article is here. These files are poison pills to an IDE, compare to this Q+A.
Little to add, beyond not adding them to your project, the proposed workaround in the article is the obvious one. And as long as you need to search through these files you surely want to work with the non-minimized versions of them.
In the Find options, expand "Result options" (Alt+S) and enable "Display file names only". The contents of the files will not be displayed in the find results and everything will be a lot faster. You can still double click a file name in the find results to go to the exact location of the match in that file.
Does this problem happen for everyone, or only on particular machines? Are there any Visual Studio extensions that may be slowing down the search? You could try and temporarily disable all extensions and see if you have the same problem.
Otherwise, I would agree that including the .min.js and .map files in the solution / project is not ideal anyway.
My recommendation is to use Bower to manage your 3rd party client-side library dependencies. They say use the right tool for the job, and in this case, it's currently Bower.
Bower support is baked in to Visual Studio 2015. Here's some Microsoft docs on using Bower in Visual Studio 2015:
http://docs.asp.net/en/latest/client-side/bower.html
Docs for installing Kendo using Bower: http://docs.telerik.com/kendo-ui/install/bower
Now, this by default will put those vendor libraries in a bower_components folder under the project root. You would then not include this folder in your project, or in source control (but bower.json and optional .bowerrc would go into source control).
This should alleviate your problem in VS2013, but in 2015, Find in Files will still search bower_components. So your best bet is to try and narrow down the source of the slow-down.
Using Bower potentially impacts your development and build process, so you might want to avoid that if that's going to force your hand to make other changes you're not positioned for yet.
One thing you can check to try and help solve this issues, is in your gruntfile's minify task, make sure the mangle property is set to false. Mangle changes the variable names to really short names, so sometimes that can mess up your other files that use variables from those minified files, and other errors can occur. I'm not sure why visual studio crashes or wouldn't be able to handle searching for a string that doesn't exist, but it's something to consider.
I am new to ANTLR. I wanted to learning start by setting up a project so that lexers\parsers would be automatically generated by the build. So I downloaded antlr-dotnet-tool package, modified a project file to include antlr targets. I also installed some VS extension that add syntax highlighting and new item types for grammar files.
Now, generation seems to works, but it puts output files into obj/${Configuration} folder. And I don't really know what I am supposed to do with them there. Surely, you don't want me to manually copy them to proper locations (supposedly next to grammar files), do you?
It would be great if you could shed some light on it.
If you followed my blog post, you will see that you need to do nothing else,
http://www.lextm.com/2012/07/how-to-use-antlr-on-net-part-v/ (note that at the beginning you will see links to the previous 4 parts)
At compile time the generated files are automatically linked to the output assembly, and the debugger is capable of loading them when you debug the program.
I am getting a strange Intellisense error in VS 2010. I searched the Internet with no luck. It seem that no one else got this error before.
IntelliSense: PCH warning: header stop needs to be at global scope.
An intellisense PCH file was not generated.
Following this many other errors as it stops indexing. This happens to the recent files that I have added. I have many files in my project (278) and this happens to the most recent 5-6 of them. May be I did something it doesn't like or may be there is a limitation.
Since I couldn't found this error even in the documentation, I would like to learn the reason as well as a possible solution. Note that, I have tried to delete ipch folder and sdf file to get them generated a new. The error is given to the last line of a file. My code heavily uses templates.
EDIT:
I noticed my ipch folder is mostly empty. This probably means that entire precompiled header generation fails, rather for those files. Still, intellisense partially works, but not for those files.
This error is generated when you forget a ";" after a class declaration, for example:
#ifndef _MYCLASS_H
class MyClass {
...
public:
...
}
#endif <--- VS2010 report here the error PCH: warning...
If you put a ";" after the closing "}" the error go away. I'm not saying this is the only cause, I'm just saying that I found that error with the missing ";" in the mentioned place.
PCH stand for "pre-compiled header" - you'll need to make sure you have these configured correctly.
The error message seems to be saying that the header configured as the 'stop' for precompiled headers is being included in a nested fashion (ie., some other header is including it). By default, a solution will use stdafx.h as the 'stop' header and the idiom is that stdafx.h will be the first header included in any .cpp or .c file. Don't include stdafx.h in any other header.
The best information about how Intellisense works and how to troubleshoot it come from the Visual C++ Team Blog.
A few articles that might be helpful:
Troubleshooting Tips for IntelliSense Slowness
Precompiled Header Files in Visual Studio 2010
IntelliSense History, Part 1
IntelliSense, Part 2 (The Future)
My initial feeling is that it could be a file encoding problem, but anyway here's how I would approach figuring it out...
Create a brand new solution, does the intellisense work? If not then a VS reinstall might be in order.
If intellisense works in a different solution then there are 2 possibilities: something in your solution is screwy, or something in your folder hierarchy is screwy (permissions maybe?)
I'd delete the entire solution folder and get the latest from source control.
If it still occurs after that and you really want to find the cause, then you could remove a load of files from the project, see if the intellisense now works, remove some more... until a) you run out of files or b) you find the file that causes the error.
If a) then make a brand new solution and add your files and projects to it. If that works then compare your new solution/project files with the old ones to see what's different.
If b) then add the files back in and start pruning until you find the offending line.
Sorry for what seems like a silly question: But I've never, ever worked with boost, until tonight, and I'm finding that getting it configured seems to be harder to use than it should be.
I wanted experiment with it tonight. So I downloaded the zip file, and unzipped it to a directory here:
F:/boost_1_44_0
Then I created an empty c++ project in visual studio 2010 (not using pch either). So all I wanted to do was to include a header file. But not even a silly thing like that seems to work. Now I've been using visual studio for years, though at work we are still stuck on vs 2008 (That is another story). So usually what you do is set an include directory, and then you can include files in at will right?
So I set the global include directory to include the boost root. i.e. Property Manager -> My configuration (debug|win32) -> Microsoft.Cpp.Win32.user -> Common Properties -> C++ Directories -> Include Directories. There I added my path to f:/boost_1_44_0.
I also went to the project properties and set the C++ include directory for the project to point to the boost root like in vs 2008.
I then added a silly include declaration like so:
#include <boost/lambda/lambda.hpp>
But, amazingly it fails to compile!!! with the following error:
Error 1 error C1083: Cannot open include file: 'boost/type_traits/transform_traits.hpp': No such file or directory f:\boost_1_44_0\boost\lambda\core.hpp 25 1 test_boost
Which when I double click it, it opens up in f:\boost_1_44_0\boost\lambda\core.hpp, and takes me to this line:
#include "boost/type_traits/transform_traits.hpp"
So I have no idea what's happening. Is visual studio just not delivering up my global include paths that I set? It seems also that the include directive in core.hpp should be using angle brackets and not quotes.
If I'm doing something wrong what?
EDIT:
!! SOLVED !!
Before I didn't have all the files unzipped. I don't know what happened. So I re-downloaded the zip file, and unzipped it again. This time the zip file took much longer to unzip, and it extracted much more files: Including the missing files.
Problem solved, my hello world app compiles just fine now.
The behaviour of compilers in locating header files is implementation defined for both the <> and "" variants.
However, based on this page for VC2010, it appears the quoted form searches a superset of the angle bracket form so I'm not sure that's the problem.
I suppose it would be a silly question to ask if the following file actually existed?
f:\boost_1_44_0\boost\type_traits\transform_traits.hpp
So, a couple of investigative jobs:
Make sure that f:\boost_1_44_0\boost\type_traits\transform_traits.hpp exists.
Try changing your top-level include to use quotes.
Try changing the include in f:\boost_1_44_0\boost\lambda\core.hpp to use angle brackets.
Make sure you try all four possibilities for those last two.
Is f: a network-mounted drive? What happens if you put it all on c:?
That last one is just in case Windows is doing some shenanigans under the covers :-)
While it's a bit overkill for this, learning to use SysInternals' Process Monitor will pay off over time. It will show you what files are actually opened, and which attempts failed. Look where Visual Studio tries to read transform_traits.hpp from, and you'll probably have the answer.