* * *

Author Topic: Code/identifier completion  (Read 3222 times)

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Code/identifier completion
« on: December 12, 2017, 03:45:44 pm »
I just installed trunk (win 64), and I'm probably doing something wrong, but code and identifier completion stopped working.

I made a simple class, with only a constructor and destructor, pressed Shift+Ctrl+c and it worked as expected. I changed to {$mode delphi} for the generics, added a lot more stuff and it stopped working.

Ok, I had that last time as well: remove the generics and it'll work. But it didn't. It highlights the first line of the unit and gives the error: identifier not found: TObject. But it compiles and runs fine.

Does it only work in {$mode objfpc}, or am I doing something wrong?
« Last Edit: December 12, 2017, 03:47:30 pm by SymbolicFrank »

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Re: Code/identifier completion
« Reply #1 on: December 12, 2017, 04:25:10 pm »
Where is TObject defined? It is in objpas.inc, which seems to be included in system.inc:

Code: Pascal  [Select]
  1. {*****************************************************************************
  2.                         Object Pascal support
  3. *****************************************************************************}
  4.  
  5. {$ifdef FPC_HAS_FEATURE_CLASSES}
  6. {$i objpas.inc}
  7. {$endif FPC_HAS_FEATURE_CLASSES}

I don't understand what happens.

bytebites

  • Full Member
  • ***
  • Posts: 151
Re: Code/identifier completion
« Reply #2 on: December 12, 2017, 04:30:19 pm »
Here is bug report about the problem:
https://bugs.freepascal.org/view.php?id=32809

Pascal

  • Hero Member
  • *****
  • Posts: 665
Re: Code/identifier completion
« Reply #3 on: December 12, 2017, 04:36:21 pm »
Just apply the attached patch! And rebuild fpc.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Re: Code/identifier completion
« Reply #4 on: December 12, 2017, 04:47:45 pm »
Thanks!

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Re: Code/identifier completion
« Reply #5 on: December 12, 2017, 05:04:26 pm »
 :(

That didn't help, even after a clean and rebuild of Lazarus. But that isn't fpc, of course.

I have a bad experience with getting the source from trunk and building it (the configuration is a problem), so I use fpcupdeluxe.

This makes it hard to add controls to forms.

Thaddy

  • Hero Member
  • *****
  • Posts: 6377
Re: Code/identifier completion
« Reply #6 on: December 12, 2017, 05:43:10 pm »
The IDE and its tools are not fully prepared for generics yet.
I usually get around that - to some extend - by skipping the generics part, pressing ctrl-j, and add the generics parts as I go.
I am enjoining wine, not whine....

Pascal

  • Hero Member
  • *****
  • Posts: 665
Re: Code/identifier completion
« Reply #7 on: December 12, 2017, 08:12:37 pm »
Have a look in this thread http://forum.lazarus.freepascal.org/index.php/topic,39255.msg268905.html.
Especially the wiki entry and my adapted build script (ignore OPT parameter).
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 665
Re: Code/identifier completion
« Reply #8 on: December 13, 2017, 06:30:48 am »
The IDE and its tools are not fully prepared for generics yet.
I usually get around that - to some extend - by skipping the generics part, pressing ctrl-j, and add the generics parts as I go.

Thaddy, have you tried it lately? Mattias an i have done some bug fixing for generics in codetools. For me it works quite okay now, though it's not finished yet.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Thaddy

  • Hero Member
  • *****
  • Posts: 6377
Re: Code/identifier completion
« Reply #9 on: December 13, 2017, 08:45:09 am »
Thaddy, have you tried it lately? Mattias an i have done some bug fixing for generics in codetools. For me it works quite okay now, though it's not finished yet.

I have tried it in 1.9 and it is quite satisfactory. I only tested mode delphi. Very useful now.Thanks.
I am enjoining wine, not whine....

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Re: Code/identifier completion
« Reply #10 on: December 14, 2017, 08:48:12 am »
Have a look in this thread http://forum.lazarus.freepascal.org/index.php/topic,39255.msg268905.html.
Especially the wiki entry and my adapted build script (ignore OPT parameter).
Thanks, but with fpcdeluxe, the directory structure looks completely different.

Is it in SVN? Then I'll just reinstall it.

Well, I would prefer to be able to just build it myself, but I'm not going to spend a week figuring out how it all works.

Pascal

  • Hero Member
  • *****
  • Posts: 665
Re: Code/identifier completion
« Reply #11 on: December 14, 2017, 10:59:06 am »
I just updated the wiki http://wiki.freepascal.org/Installing_Lazarus#Compiling.2Finstalling_FPC_and_Lazarus_from_Sources_of_SVN_.28Win32.29.
You can use fpc 3.0.4 or trunk.

After getting the fpc trunk sources with TortoiseSVN apply the above patch.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 561
    • My "almost daily" development blog
Re: Code/identifier completion
« Reply #12 on: December 14, 2017, 07:32:21 pm »
Pascal, thanks a lot for the patch! Worked for me too  :D
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Re: Code/identifier completion
« Reply #13 on: December 19, 2017, 11:01:52 am »
After some testing it seems that it mostly works.

I did a full clean + build, and it compiles and runs fine. But as soon as you do Ctrl+Space and there is no identifier completion available (no member starting with those chars), everything breaks again. If you press Ctrl+Space+C at that point, even after you commented or fixed the line with the wrong identifier, all the members are regenerated. So, you have two of everything.

A clean + rebuild (after fixing the code) seems to make it work again.

And I'm not sure if the bug that owned components sometimes aren't created or destroyed is related to this, or that it is something else.


Edit: now it keeps giving: "Error: end of source not found."

Edit2: Restarting Lazarus fixed it.
« Last Edit: December 19, 2017, 11:13:42 am by SymbolicFrank »

SymbolicFrank

  • Sr. Member
  • ****
  • Posts: 392
Re: Code/identifier completion
« Reply #14 on: July 02, 2018, 05:24:25 pm »
This bug is still present in trunk.

If you remove all empty lines inside code blocks and restart Lazarus, it seems to go away.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus