Sysprogs forums › Forums › VisualGDB › Clang Intellisense out of whack
Tagged: clang intellisense
- This topic has 12 replies, 4 voices, and was last updated 5 years, 10 months ago by support.
-
AuthorPosts
-
February 21, 2017 at 17:44 #10512parsec67Participant
VisualGDB 5.2/VS 2015 Community.
After working fine for months Clang Intellisense has lost all bearings on my project’s main .C file.
My functions are forward declared at the beginning of the file. If I attempt “Go to definition” I get either an error message “The selected location does not refer to a C/C++ entity” or if it jumps into the code, it will jump to the incorrect line.
Similar thing will happen if I do “Go to declaration” from somewhere in the code. Either the message above shows or it will go to the declaration of a variable/function that is called a few lines down of the selected one, which may be a HAL function or something else completely unrelated to the variable in question.
Furthermore, syntax highlighting is broken in this particular source file. For example, I have some variables declared “__IO <type>” on several separate lines. For the first+second declarations “__IO” is colored pink, second line it is white and on the fourth line green. Total disarray.
In the other files in this project Clang Intellisense is still working fine. If I switch to VS Intellisense everything is fine in the main file too. I have tried restarting VS, rebooting the PC but nothing helps. Something looks to be corrupted and I don’t know what to do to fix it?
February 22, 2017 at 09:17 #10513parsec67ParticipantUpdate: Found what caused Clang Intellisense to bomb out. This type of conditional define will screw up everything below it as described in my first post;
#ifdef CONDITION #define MYDEF 20 #else #define MYDEF 10 #endif
This causes no problems for VS native Intellisense. Was able to reproduce issue in several independent projects.
February 22, 2017 at 18:20 #10517supportKeymasterHi,
This looks strange. Can you reproduce the same behavior on a basic “hello, world” project and send it to us? If yes, we should be able to fix it quickly.
February 23, 2017 at 15:23 #10524parsec67ParticipantYes, I can reproduce on a very basic project with a few variable declarations and functions added in order to see the problem more clearly. I have a project zipped up and ready to send, which e-mail address do you want it sent to?
February 23, 2017 at 18:08 #10526supportKeymasterPlease send it to sysprogs at sysprogs dot com.
February 28, 2017 at 15:55 #10554parsec67ParticipantHi,
Just curious if you were able to replicate the issue? I emailed a project last Friday.
March 3, 2017 at 05:49 #10560supportKeymasterHi,
Yes, reproduced the problem. Looks like one of the lines in the commented block uses ‘\r’ as the line ending (not ‘\n’ and not ‘\r\n’). This breaks synchronization between the line numbers as seen by Visual Studio and VisualGDB, so go-to-definition and other functionality starts using wrong line numbers and hence does not work.
Normally Visual Studio should warn you that the line endings in the file are out-of-sync and suggest normalizing them. Please proceed with the normalization and the problem will be resolved automatically.
March 3, 2017 at 15:13 #10563parsec67ParticipantHi,
Thanks for looking into this and good to know the reason/fix. I have this warning disabled intentionally since vanilla VS2015 is able to cope with inconsistent line endings. The issue looks to be isolated to Clang, VS Intellisense does not throw a tantrum for this specific project. I’ll switch the warning back on to avoid future complications.
March 3, 2017 at 17:29 #10564supportKeymasterHi,
Thanks, yes, this limitation is specific to Clang. As the ‘\r’ line endings are not really used on any of the modern systems, it indeed does not support them properly. Both ‘\n’ and ‘\r\n’ endings are supported correctly though.
January 24, 2019 at 23:19 #23563jonaSpectatorI’m having this same problem a lot lately in VS2017. Any ideas how to solve it permanently? Is it a VS bug that we just have to deal with?
January 24, 2019 at 23:23 #23564supportKeymasterDoes your project use the ‘\r’ line endings? If yes, VisualGDB should show a bar that allows automatically changing them to ‘\n’. If not, the problem is likely caused by something else. If you could create a separate topic providing a detailed description of the problem you are observing, we will be happy to investigate this and provide a hotfix.
January 25, 2019 at 00:04 #23565MystikReasonsParticipantI can confirm this problem (Clang Intellisense) in version 5.4 build 2737 with Visual Studio 2017 version 15.9.6
On some projects it just works fine and on others it won’t work at all so I had to switch to the regular VC++ Intellisense until this is “fixed”.
I only can confirm this problem on some Embedded Projects.
January 25, 2019 at 00:18 #23566supportKeymasterPlease provide an actual up-to-date description of the problem in a separate thread. Unfortunately we are not realistically able to pinpoint or fix the problem based on a generic description that Clang IntelliSense doesn’t work for some of the projects. We do have extensive tests covering various aspects of the IntelliSense functionality, so if you are experiencing inconsistencies, they are likely caused by the factors not covered by our tests. We will be happy to investigate and fix this, but we would need to be able to reproduce the problem on our side, or get a detailed description of it that will help us reconstruct the circumstances behind the problem.
-
AuthorPosts
- The topic ‘Clang Intellisense out of whack’ is closed to new replies.