Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

CodeCompletion gets confused with "dot"?

(1/2) > >>

MortenMacFly:
Dear all,
I am experiencing a very strange thing: In a project I instantiate a class in a method like this:

--- Code: ---SingularValueDecomp SVD(blah);

--- End code ---
The class has several methods. So I tried using CodeCompletion as: "SVD.[STRG+TAB]" and nothing happens. The parser output shows:

--- Code: ---[12:37:43.060]: Doing AI for '        SVD.':
[12:37:43.060]: Pos=10408
[12:37:43.060]: NS: 'Rapid', PROC: 'TrainPreModel'
[12:37:43.060]: tok='SVD'
[12:37:43.060]: Looking for SVD under Rapid
[12:37:43.070]: Looking for SVD under Unknown
[12:37:43.070]: Token found SVD, type 'std::vector'
[12:37:43.070]: actual type is std::vector
[12:37:43.070]: searching under std
[12:37:43.070]: Class 'unknown'
[12:37:43.070]: Bailing out: class not found

--- End code ---
Now if I try "SVD[STRG+TAB]" (without the dot) I see all methods and the output shows:

--- Code: ---[12:50:03.148]: Pos=10408
[12:50:03.148]: NS: 'Rapid', PROC: 'TrainPreModel'
[12:50:03.158]: Doing AI for '        SVD':
[12:50:03.158]: Pos=10408
[12:50:03.158]: NS: 'Rapid', PROC: 'TrainPreModel'
[12:50:03.158]: tok='SVD'
[12:50:03.158]: Scope='Rapid'
[12:50:03.158]: Procedure of class 'Rapid' (0x021b6324), name='TrainPreModel'
[12:50:03.168]: Checking inheritance of Rapid
[12:50:03.168]: - Has 0 ancestor(s)

--- End code ---
Of course in this case I have to add the "dot" afterwards to seperate the method from the class which is annoying. What am I doing wrong here?
Best regards, Morten.

mandrav:
I 've found and fixed a bug in codecompletion regarding this. Might wanna give it another try...

MortenMacFly:

--- Quote from: mandrav on January 20, 2006, 02:36:50 pm ---Might wanna give it another try...

--- End quote ---
I did (build 1823) now it works partially, but unfortunately for the class described it's the same. But: I have another information regarding this: It seems to happen only for this very single class. (I didn't realise this because currently I am only working on this specific one). I instantiated the class as SVD. Now this class has a member function with exactly the same name "SVD()" with a parameter and a return value (both std::vector<double>). I assume the plugin interprets this somehow as constructor because if you look at the log again there is:

--- Code: ---[12:37:43.070]: actual type is std::vector

--- End code ---
where I wonder where this comes from.
The class is as follows in detail:

--- Code: ---class SingularValueDecomp
{
public:
  SingularValueDecomp();
  SingularValueDecomp(unsigned int);
  ~SingularValueDecomp();
  void ReInit(unsigned int);

  std::vector<double> SVD(std::vector<double> &);
  std::vector<double> Variance();
  std::vector<double> SVDSingVals();
  // and some other methods...
private:
  bool DoSVD();
  bool SingularValueDecomposition(std::vector< std::vector<double> > &);
  // and dome more...
};

--- End code ---
Maybe this helps for now... I am doing further research on that topic tomorrow (I have to leave now, sorry).
Regards, Morten.

MortenMacFly:

--- Quote from: MortenMacFly on January 20, 2006, 03:38:51 pm ---I am doing further research on that topic tomorrow [...]

--- End quote ---
A bit late, but I hadn't have time until now. I have prepared an example that shows the strange behaviour. I narrowed it down as following: If I instantiate the class as a variable with the name of a (public?) member function CodeCompletion does not work.
Thus in the example CodeCompletion works for the instantiation of the class "MyClass" as "c" but not as "SVD". The instatiation of "MyDummy" works anyways. Maybe rickg22 should take a look at it, too. I've tried to understand the parsing some times ago but I see that there were many changes so I would start from scratch. Any help is appreciated.

Morten.

[attachment deleted by admin]

rickg22:
Code completion works by parsing the current file and trying to identify the token. Only then it searches in the tokens database.

The reason for this is that local variables are NOT identified in the main parsing. Functions and class methods are just scanned until the respective '}' is found.

Navigation

[0] Message Index

[#] Next page

Go to full version