Clang Intellisense out of whack

Sysprogs forums Forums VisualGDB Clang Intellisense out of whack

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #10512
    parsec67
    Participant

    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?

    #10513
    parsec67
    Participant

    Update: 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.

    • This reply was modified 7 years, 10 months ago by parsec67.
    • This reply was modified 7 years, 10 months ago by parsec67. Reason: clarification
    #10517
    support
    Keymaster

    Hi,

    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.

    #10524
    parsec67
    Participant

    Yes, 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?

    #10526
    support
    Keymaster

    Please send it to sysprogs at sysprogs dot com.

    #10554
    parsec67
    Participant

    Hi,

    Just curious if you were able to replicate the issue? I emailed a project last Friday.

    #10560
    support
    Keymaster

    Hi,

    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.

    #10563
    parsec67
    Participant

    Hi,

    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.

    #10564
    support
    Keymaster

    Hi,

    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.

    #23563
    jona
    Spectator

    I’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?

    #23564
    support
    Keymaster

    Does 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.

    #23565
    MystikReasons
    Participant

    I 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.

    #23566
    support
    Keymaster

    Please 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.

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Clang Intellisense out of whack’ is closed to new replies.