GithubHelp home page GithubHelp logo

Comments (24)

dizcza avatar dizcza commented on September 25, 2024 2

Well, I must say I have experienced pleasure of coding ever since I switched to your custom CDT indexer. It was hard to set up but with your help, it seems to be functioning properly. I like function argument name expansion, suggestions as you type, better C++ support (I don't need to delete the project and import it again) but most of all I no longer need to delete an extra prefix space that was added previously in situations like

#ifdef __cplusplus
 extern "C" {
#endif

 // note the space before the function
 void my_func();

#ifdef __cplusplus
}
#endif

such a negligible thing but I feel relief not fixing each line manually now...

Just fix those minor issues and go with it.

I hope you guys make it stable and it'll become the standard.

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Previously, I had such problems mostly in C++ files (ESP_LOGX were always highlighted, includes, static const char *TAG has always been rendered as unused, etc.) but now I see these warnings even in C files.

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Tried installing ESP-IDF again after the plugin was updated - didn't help.

from idf-eclipse-plugin.

kolipakakondal avatar kolipakakondal commented on September 25, 2024

Hi @dizcza Could you share a sample application which I download and try?

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Oh, when I deleted the project and imported it again, everything was resolved. Perhaps, I ignored the warning after Eclipse update about the old workspace directory and clicked continue.

Now what is being highlighted are atomics (have always been, I remember you said it's not on your side) and esp_logs (only for C++ files). C++ files are resolved much better now compared to v2.2, where I had plenty of highlights.

You can test the esp_log yourself:

#include "esp_log.h"

static const char *TAG = "main";

extern "C" { void app_main(); }

void app_main(void)
{
    ESP_LOGI(TAG, "main init");
    while (1) {
        ;
    }
}

Both TAG and ESP_LOGI are highlighted as unused and a syntax error respectively - it's triggered only in C++ sources, C files don't exhibit such a behavior.


While I was happy writing it, I still hit the same issue with a completely new project. Steps to reproduce:

  1. Create a new ESP-IDF project from samples and choose sample_project, rename it to test_espidf_plugin.
  2. Move main.c to main.cpp and update the cmake accordingly.
  3. Write the code to main.cpp.
  4. Build. (At this point, everything was resolved correctly - no highlighting errors save for esp_logs)
  5. Import another ESP-IDF project, select it from the drop-down build configuration, click build.
  6. Now the imported project is resolved OK.
  7. Switch back to the test_espidf_plugin project and you'll see highlighted errors again. Clean and rebuild didn't help.

Screenshot from 2024-03-13 09-37-56

I needed to re-import test_espidf_plugin again to resolve the problem though it was created a minute ago.

P.S. Funny, among a huge list of syntax errors in the screenshot above, the TAG is not highlighted :)

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

Hi @dizcza,

Switch back to the test_espidf_plugin project and you'll see highlighted errors again. Clean and rebuild didn't help.

Have you tried closing/reopening or closing/reopening/building the project as a workaround? Usually switching projects in the launch bar causes the indexer to rerun, after the indexer's job is finished, it should be fine, but I'm facing the same issue sometimes, not sure why it happens and what confuses the indexer, but closing and reopening the project helps me in such scenarios.

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Have you tried closing/reopening or closing/reopening/building the project as a workaround?

I tried both and none of them helped. Only deleting the project and importing it again did the job.

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

Hi @dizcza,

I forgot to mention, that we are working on LSP integration right now, since Eclipse CDT Indexer is not actively maintained, and doesn't support C/C++ 20 (which is used in ESP-IDF 5.0) I think Clangd indexer should work better. It's easy to set by following this guide: https://github.com/espressif/idf-eclipse-plugin/blob/master/docs/clangd_cdt_support.md

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Well, I don't have the Editor (LSP) option in C/C++ preferences once I installed the Eclipse CDT-LSP...

Reboot does not help.

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

Well, I don't have the Editor (LSP) option in C/C++ preferences once I installed the Eclipse CDT-LSP...

Reboot does not help.

hm, that's strange. Are you using the same IDE listed in your log? Your Eclipse, Eclipse CDT, and IDF Eclipse Plugin versions look ok for using the Eclipse LSP plugin. I have similar versions on Mac and Windows (I will try on Linux as well). Have you faced any issues during installation? Could you provide an error log after installing Eclipse LSP, please?

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Ah, it wasn't installed properly. After I installed it again (somehow, in the previous attempt, the "accept source" window didn't even pop up), I set the paths as suggested. However, I often change the esp-idf version - I pull source code from the master branch, sometimes need to reinstall esp-idf, which creates a new python env and hence I need to repeat the same steps in the eclipse plugin. Previously, I needed to provide only one path - the python path. But now I need to provide three paths:

  1. Path to python
  2. Path to clang
  3. Path to xtensa-gcc

That's quite a headache for me.

Also, after I followed the instructions and set the paths correctly, deleted the project, imported it again, built, but again I'm hitting the same problem I outlined in the first comment: too many highlights, indexer cannot resolve almost anything. Tried re-index, didn't help.

Attaching the logs, if it helps.

errClang.log

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

However, I often change the esp-idf version

We are working on new tools manager that will allow you to switch between esp-idf versions quicker #908

Previously, I needed to provide only one path - the python path. But now I need to provide three paths

If you have multiple projects and each of them requires different esp-idf version, for now you can create different workspaces for different esp-idf versions, or you can configure LSP settings on project level, so you don't have to change path to clang and path to xtensa-gcc each time you are changing your esp-idf (right click on project ->Properties -> Editor LST -> "Enable project-specific settings". We will make this process smoother with futher integration of CDT LSP plugin

I'm hitting the same problem I outlined in the first comment: too many highlights, indexer cannot resolve almost anything

Do you have the same problem even with the clangd enabled?

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

If you have multiple projects and each of them requires different esp-idf version, for now you can create different workspaces for different esp-idf versions, or you can configure LSP settings on project level, so you don't have to change path to clang and path to xtensa-gcc each time you are changing your esp-idf (right click on project ->Properties -> Editor LST -> "Enable project-specific settings". We will make this process smoother with futher integration of CDT LSP plugin

I set only one esp-idf version for all of my projects, it's just I update it often. And if I afterwards don't re-install esp-idf inside the eclipse plugin, then code navigation leads to a wrong line.

Do you have the same problem even with the clangd enabled?

Yes. For instance, "Could not find symbol 'esp_err_t' in index"

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

Sorry, it seems the LST wasn't properly enabled. I remember hitting Apply and close once I provided LST paths but next time when I opened the LST preferences, the "Prefer C/C++ LST" checkbox wasn't ticked and when I enabled it, the paths were there - how is this even possible?...

Anyhow, I reimported the project, and now all C files are displayed as text. And C++ files still have indexer issues

Screenshot from 2024-03-14 19-32-41
Screenshot from 2024-03-14 19-33-10

errClang.log

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

The default CDT indexer is off.

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

Hi @dizcza,

The first screenshot appears to show highlights from the regular indexer (LSP colors are different). Perhaps this issue will be resolved by addressing the case related to the second screenshot. From the error log you provided, it seems that the absence of the tm4e dependency is causing the second screenshot (no syntax highlights). Could you please try to obtain this dependency from the following update site: https://download.eclipse.org/tm4e/releases/latest/? To do so, navigate to Help -> Install New Software -> Work with (provide update site here), and then select Batik CSS engine.
image

Also, in the error logs, there are numerous methods that couldn't be loaded for some reason. For example:
'com.espressif.idf.ui.handlers.DeleteResourceHandler' could not be loaded. At present, I'm uncertain about the cause of this. I will update you on this later.

If updating the tm4e dependency doesn't resolve this issue, would you be open to connecting so we can address these issues together? Please feel free to contact us via email at [email protected]. In your email, mention the time that suits you best, and we will send you an invitation to the meeting on Teams.

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

I switched back to the default indexer for now, it works fine.
I'll consider using your custom indexer if I experience annoying problems again.

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

I'm switching again to your custom editor - the default one breaks often.
After I switch to LSP, how to change the theme? Clicking ThemeMate doesn't do anything. I cannot uncheck the default checkbox for a particular theme and save it - it does not get saved.

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

CTRL+/ does not comment/uncomment the line - expected?

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

Hi @dizcza,

CTRL+/ does not comment/uncomment the line - expected?

No, thank you for reporting this. Looks like some conflict with TM4 Language Configuration and C/C++ editor commands. To fix, please open Preferences -> General -> keys -> in filter type "tm4" -> select "Toggle Line Command" -> Click Copy and then set binding to Ctrl + / :
image

After I switch to LSP, how to change the theme? Clicking ThemeMate doesn't do anything. I cannot uncheck the default checkbox for a particular theme and save it - it does not get saved.

Do you mean some custom theme? I haven't checked custom themes yet, but the default ones that are available in this list work fine for me:
image

There is no need to uncheck the "Default" checkbox, I'm just selecting a new theme, then on the checkbox "Default" to make this theme the new default, and after applying my editor colors are updated immediately

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

There is no need to uncheck the "Default" checkbox, I'm just selecting a new theme, then on the checkbox "Default" to make this theme the new default, and after applying my editor colors are updated immediately

So that's the thing, "Apply" does not change the theme I'm selecting in TextMate themes

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

So I have both Solarized Light and Dark themes marked as Default. They cancel each other, and perhaps Solarized Light wins but I'd like to have Dark. Dark is already default, just as Solarized Light. Unchecking the default checkbox in Solarized Light doesn't anything, applying doesn't do anything.

from idf-eclipse-plugin.

sigmaaa avatar sigmaaa commented on September 25, 2024

So I have both Solarized Light and Dark themes marked as Default. They cancel each other, and perhaps Solarized Light wins but I'd like to have Dark. Dark is already default, just as Solarized Light. Unchecking the default checkbox in Solarized Light doesn't anything, applying doesn't do anything.

To switch the theme from light to dark you need to select the "Dark" theme in General -> Appearance -> Theme combo. So for a dark appearance only dark TextMate configs work and vice versa

from idf-eclipse-plugin.

dizcza avatar dizcza commented on September 25, 2024

To switch the theme from light to dark you need to select the "Dark" theme in General -> Appearance -> Theme combo. So for a dark appearance only dark TextMate configs work and vice versa

Ah, so that's how it works.

All right. So far so good.

A couple of minor issues:

1

In a header file

#include "freertos/FreeRTOS.h" gets highlighted with the message "__GLIBC_USE not defined (included in /usr/include/limits.h 145:5)"

This happens when the corresponding source file for this header is C++, not C. C files (sources and headers) don't show this error. Wrapping this include line with extern "C" does not help.

When I click and navigate to "FreeRTOS.h", in the first line (starting with a doc string) I get

  • Unknown argument -fno-tree-switch-conversion
  • Unknown argument -fstrict-volatile-bitfields

My .clangd:

CompileFlags:
  Remove: [-fno-tree-switch-conversion, -fstrict-volatile-bitfields]

2 int types

static int32_t m_task_global_id = 0;
ESP_LOGI(TAG, "loaded task global id: %ld", m_task_global_id);

"%ld" seems the correct way to go for a build: if I change it to "%d", the build fails with the message

error: format '%d' expects argument of type 'int', but argument 6 has type 'int32_t' {aka 'long int'} [-Werror=format=]
1717 | ESP_LOGI(TAG, "loaded task global id: %d", m_task_global_id);

But your indexer keeps it highlighted with "%ld":

Format specifies type long but the argument has type int32_t aka int

Same for %lu -> %u, etc. A bit annoying. The default indexer doesn't behave like that.

from idf-eclipse-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.