Author Topic: Auto Complete offeres members from all libraries  (Read 8391 times)

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Auto Complete offeres members from all libraries
« on: November 18, 2016, 04:59:39 am »
Gents,
 i seemed to be unable to pinpoint the right combination of the options in the "Code Completion" plugin ( Settings-> Editor -> Code Completion ) to show the list of _only_ members of this selected object/variable.

Expected result
 after typing a dot (.) i expect  to see all member functions/data only for this specific object.

Current behavior:
 after typing a dot (.) i have a list of _all_ members functions/data  from all libraries/classes.

I'm attaching the snapshots of the current configuration.
Please advise.

 
« Last Edit: November 18, 2016, 05:14:54 am by AZ »
CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres options from all libraries
« Reply #1 on: November 18, 2016, 05:01:24 am »
and
CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Auto Complete offeres members from all libraries
« Reply #2 on: November 18, 2016, 06:38:00 am »
Do you have a minimal example that reproduces the problem?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres members from all libraries
« Reply #3 on: November 18, 2016, 06:47:29 am »
Do you have a minimal example that reproduces the problem?

Yes, sure:

1. Generate the Arduino project using your template.
2. Add https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home  - LiquidCrystal library into the "libraries" sub dir of the project.
3. Resulting code:
Code
#include <Arduino.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

/*
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
*/


LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7) ;


void setup() {
    // initialize the digital pin as an output.
    // Pin 13 has an LED connected on most Arduino boards:
    pinMode(13, OUTPUT);

lcd.

}

void loop() {
    digitalWrite(13, HIGH);   // set the LED on
    delay(1000);              // wait for a second
    digitalWrite(13, LOW);    // set the LED off
    delay(1000);              // wait for a second
}


I also added references to the library (absolute path ) in the project->build->Search Directories-> Linker and project->build->Search Directories->compiler.
I still can't build the project, but i'm not sure if these two issues are related.
« Last Edit: November 18, 2016, 06:58:28 am by AZ »
CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Auto Complete offeres members from all libraries
« Reply #4 on: November 18, 2016, 07:46:34 pm »
This is not minimal example.  ::)
Minimal example is a file that has no includes.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres members from all libraries
« Reply #5 on: November 18, 2016, 08:22:34 pm »
This is not minimal example.  ::)
Minimal example is a file that has no includes.

In case there are no 3rd party libs - autocomplete works fine. I hope you are not going to say "then it is a 3rd party problem", because in Atom's autocompletion with this same library works perfectly smooth "out of the box". :(
CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Auto Complete offeres members from all libraries
« Reply #6 on: November 19, 2016, 01:53:05 pm »
What do you mean by third-party libs?
It is probably a problem in the header of this third-party lib.
It uses something our parser doesn't understand.
My request is to trim down the source code and to find the code that breaks our parser.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres members from all libraries
« Reply #7 on: November 19, 2016, 04:09:47 pm »
What do you mean by third-party libs?
It is probably a problem in the header of this third-party lib.
It uses something our parser doesn't understand.
My request is to trim down the source code and to find the code that breaks our parser.

I meant to say that if I have includes only for "standard" libraries (io streams,  STD) the autocomplete works fine.
When I add this library - autocomplete becomes confused.

CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres members from all libraries
« Reply #8 on: November 20, 2016, 07:05:59 am »
i compared 2 projects - one regular console C++ and one created from (by) Arduino wizard with this library and both of them have (same) issue with autocompleting from this library.
Since the library is well established and works fine in Atom, i suspect my settings in the auto completion are not right.

CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Auto Complete offeres members from all libraries
« Reply #9 on: November 20, 2016, 01:48:59 pm »
Keep in mind that we use our own parser of c++, which is not fully complete and doesn't support all features of the language.
So if it works in another tool doesn't mean it will work in codeblocks.

To find which part of the library causes the problem:
Copy the text of the header file in the main.cpp and start removing code until you've found the problematic piece.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres members from all libraries
« Reply #10 on: November 20, 2016, 05:44:52 pm »
Keep in mind that we use our own parser of c++, which is not fully complete and doesn't support all features of the language.
So if it works in another tool doesn't mean it will work in codeblocks.

To find which part of the library causes the problem:
Copy the text of the header file in the main.cpp and start removing code until you've found the problematic piece.

Thank you for the instructions!

I think i do not know what is the proper workflow to add the libraries to the CB.
I thought that i add the path to library folder ( lets say  i have a "lib" subfolder in a project directory structure:
Prj1
 |
 |-> src
         | -> main.cpp
 |->lib
       |-> Lib1
               |-> superlib.cpp
               |-> superlib.h
)
 I need to add "lib" into "Search directories -> Linker/Compiler" and "reparse the project".
But it appears that i should restart the CB?


And here is the minimum code that somehow affects the autocomplete:
Code
#include <NewliquidCrystal/LCD.h>
//#include "NewliquidCrystal/LCD.h"


class LiquidCrystal_I2C : public LCD
{
   LiquidCrystal_I2C (uint8_t lcd_Addr);
   int  init();
};

LiquidCrystal_I2C abc(000);
abc.


once you type "abc." - no popups, no errors would show up. If i type "in" i'll get a nice and correct information about the "init()" method.

This behavior ( i have to type 2 symbols of the method to get a popup) is consistent with the original  LiquidCrystal_I2C class.
At the same time, if i were to declare a var of LCD ( LCD.h) the popup will shouw up with all available methods immediately after i put a "."

the only difference i see between these two classes is that one (crystal) is a child of LCD whereas LCD is a child of the PRINT - "standard" library.
« Last Edit: November 20, 2016, 06:39:06 pm by AZ »
CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Auto Complete offeres members from all libraries
« Reply #11 on: November 20, 2016, 07:43:49 pm »
You're missing the no includes part. To get to the minimal code you need to dig deeper into the libs headers and remove any #include in the code.

And first please make sure that the code builds fine.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline AZ

  • Almost regular
  • **
  • Posts: 151
Re: Auto Complete offeres members from all libraries
« Reply #12 on: November 22, 2016, 05:43:11 am »
after i restarted this laptop the autocompletion worked until i modified the class definition ( replaced  "LiquidCrystal_I2C" with the include "LiquidCrystal_I2C/LiquidCrystal_I2C.h" ). after the replacement , autocomplete broke again.

I hear what you are saying about removing all "#includes ". But this is very quickly becoming a very time consuming copy/paste/delete task.
Is there some option to enable additional logging instead?
CB: nightly build .
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)