Clang Intellisense not working

Sysprogs forums Forums VisualGDB Clang Intellisense not working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23696
    MystikReasons
    Participant

    I’ve created a new project with the CubeMX for STM32 devices.

    I used the Nucleo-L073RZ board and only enabled I2C1 and a GPIO pin as output (everything else is default).

    After that I imported the project via VisualGDB.

    First I opened the main.c and I noticed that every function was just white (always a indication for me that the intellisense is not working/refreshing).

    I tried to see the definition of one function (my example: MX_I2C1_Init()) but I get an error: The selected location does not refer to a C/C++ entity.

    The function is in my main.c file so I knew that the IntelliSense didn’t refresh.

    After that I changed the IntelliSense to VC++ to see if that works but I also got an error: Error while the Designtime-Build for the project “…” configuration Debug|VisualGDB. Set the environement variable TRACEDESIGNTIME to true.

    I decided to restart Visual Studio and reopened the project again and this time the VC++ IntelliSense worked without setting anything.

    So I switched back to the Clang IntelliSense and hoped it would work but it didn’t (again the same error).

    But it seems like the IntelliSense is doing something (see screenshot #2).

    Im using Visual Studio 2017 ver 15.9.6 with VisualGDB version 5.4 build 2737.

    You’ll find a screenshot of my IntelliSense settings in the attachment.

    Maybe this information is useful too: My company in which I work bought a new license today and I’m using this right now. In the window “About VisualGDB” the copy of the VisualGDB is licensed to Unknown.

    Attachments:
    You must be logged in to view attached files.
    #23714
    support
    Keymaster

    Hi,

    Thanks for renewing your license. The timing report on your screenshot does not mean that VisualGDB is running – instead it shows the timing of the last operation.

    The error you are describing might be caused by unsupported encoding (Clang IntelliSense only supports UTF-8). Please double-check the encoding used to save the files and ensure they are saved as UTF-8.

    #23715
    MystikReasons
    Participant

    I resaved the file (main.c) with UTF-8 encoding (see screenshot UTF-8)

    The IntelliSense is still not working correctly (again the same error: The selected location does not refer to a C/C++ entity.)

    But I get now an rather weird warning from the Clang IntelliSense (see screenshot clang intellisense message).

    Do you know how I can save the whole project for UTF-8? I only found the option for single files.

    Attachments:
    You must be logged in to view attached files.
    #23720
    support
    Keymaster

    Hi,

    Sorry about that. Please try the following procedure to narrow down the problem:

    1. At the beginning of the source file declare a simple function and check that its name is highlighted: void testfunc();
    2. Once you confirm that the name is shown in a different color, move the declaration to the place where IntelliSense doesn’t work. Save the file and confirm that the colors is now not shown.
    3. Move the declaration around the source file to find the location after which the highlighting breaks (most likely it will be caused by some special characters that are treated differently by VS and Clang in one of the comments).
    4. To fix the problem, simply remove the special character. You can also send us the file causing the problem (just one .c/.cpp file is sufficient) and we will add an automatic workaround for this.

    You can convert the encoding for multiple files in the same project using a simple C# program (ensure you backup your sources before):

                foreach (var fn in Directory.GetFiles(@"<dir>", "*.c", SearchOption.AllDirectories))
                {
                    var text = File.ReadAllText(fn, Encoding.GetEncoding(<CODEPAGE>));
                    File.WriteAllText(fn, text, Encoding.UTF8);
                }

     

    #23748
    MystikReasons
    Participant

    Hi

    Thanks for the steps to reproduce it.

    I found where the IntelliSense breaks. If I try to declare the function under my #include “main.h” it wont work but if I place it above the whole IntelliSense came to life again.

    But If I save the file and move the function again under the #include “main.h” the IntelliSense stops working again.

    See my screenshots and the main.c attached in the attachments.

    Attachments:
    You must be logged in to view attached files.
    #23769
    support
    Keymaster

    Thanks for the screenshots and the file, however unfortunately we could not reproduce the problem.

    If this is a simple test project anyway, would you be able to send us the entire project (you can use the support form to send the files). If not, please check the Clang IntelliSense Diagnostics Console for error messages or anything suspicious after you save the main source file (and trigger a reparse).

    #23770
    MystikReasons
    Participant

    I’ve sent you the project via the support but I had to upload it to a website because it was too big for your website (around 30MB).

    • This reply was modified 5 years, 10 months ago by MystikReasons.
    • This reply was modified 5 years, 10 months ago by MystikReasons.
    #23781
    support
    Keymaster

    Thanks, we have received the project. Unfortunately, we could not reproduce any issues – it got loaded correctly immediately:

    Please try deleting the ‘VisualGDB’ subdirectory in the solution directory that contains IntelliSense cache (ensure that the CodeDB folder gets deleted), and if it doesn’t help – try opening the project on a different machine, as the problem might be caused by a corrupt VS installation or a conflict with another VS extension. Please also ensure you are using the latest VisualGDB 5.4R2.

    Attachments:
    You must be logged in to view attached files.
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.