Recent

Author Topic: Code completion items  (Read 1467 times)

440bx

  • Hero Member
  • *****
  • Posts: 4471
Code completion items
« on: March 18, 2024, 04:20:46 pm »
Hello,

The trunk version of Lazarus is showing a number of items in the code completion box that are not record fields.

What I'd like is: only record fields and nothing else in the code completion box.

I've been playing with all kinds of settings but, I don't seem to get the right ones.

What are the settings to get the above and nothing else ?

Thank you for your help.

PS: attached is a screenshot of what I'm getting at this time and none of the items in the box are fields in the record pointed to by the InoutBuffer variable.  (I'd like to see the fields instead of the stuff that's currently showing.)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10222
  • Debugger - SynEdit - and more
    • wiki
Re: Code completion items
« Reply #1 on: March 18, 2024, 05:06:21 pm »
That setting has been around a while:

Tools > Options
Page "Codetools" > "Identifier Completion"
Section "Contents"

Combobox "Include Words"  => set to "don't include"


440bx

  • Hero Member
  • *****
  • Posts: 4471
Re: Code completion items
« Reply #2 on: March 18, 2024, 05:22:20 pm »
Wonderful... thank you Martin.

Normally I rarely use Lazarus to edit source code, which means I have a hard time remembering all the settings I changed over time.  Until very recently I was using Lazarus v1.8.2 which, over the years, I got to work as I like but, I don't remember all the settings I changed in it.

The reason I am now using the editor more is because of FpDebug.

On that note, I'd like to mention that, when I first started using FPC and Lazarus, I thought the ability to edit the source while debugging was a bad idea.  Now, I think it's one of the best features I've come across and, TTBOMK, Lazarus/FpDebug is the only environment that can keep track of executable lines after code and/or comments have been added to the source.  What a great feature! :)

thanks again.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 4471
Re: Code completion items
« Reply #3 on: March 18, 2024, 06:33:42 pm »
I'm still not getting what I'd like.

Again, what I'd like in the little pop up box is a list of fields that belong to the record I'm referencing.

So far, the only way I get those fields is by getting a whole lot of other fields that have nothing to do with the record. 

I attached a screenshot of my settings.  I've tried everything I could think of except what gets the job done the way I want... <chuckle>

Thank you for your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10222
  • Debugger - SynEdit - and more
    • wiki
Re: Code completion items
« Reply #4 on: March 18, 2024, 06:47:32 pm »
The important question then is what else is in the list?

Or, what is the definition of your record?
I attached what I get for TPoint. And it is more than x,y. But, there are typehelpers. So "a.Angle(a)" will be valid code. There is no way to suppress those completions.

But what you most likely want to change is the sort order. Sort by "Definition (Scoped".
That will bring the identifiers declared directly in the record to the top of the list. And then as it works it way out of the record to other declarations, those got sorted lower down.

And then decide, if you want recently used to be pulled up to the top (you currently have that enabled)

My List is sorted alphabetical... Not sure why. I usually use "Definition (Scoped)". I must have changed it at some point while testing stuff....

« Last Edit: March 18, 2024, 06:51:18 pm by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10222
  • Debugger - SynEdit - and more
    • wiki
Re: Code completion items
« Reply #5 on: March 18, 2024, 06:58:04 pm »
IIRC "items CONTAINING" prefix, means to match proposals in the middle to.

So TFoo.x  will have "extend" in the list, because an "x" is contained..
Otherwise the prefix must match from the start of each item.

WooBean

  • Sr. Member
  • ****
  • Posts: 266
Re: Code completion items
« Reply #6 on: March 18, 2024, 07:11:44 pm »
Maybe Martin wanted this?

 
Platforms: Win7/64, Linux Mint Ulyssa/64

440bx

  • Hero Member
  • *****
  • Posts: 4471
Re: Code completion items
« Reply #7 on: March 18, 2024, 08:00:53 pm »
I'm going backwards....

Now I don't get the little popup window and I don't even get the popup window that used to popup with the parameters of a function which I was writing a call to.

At this point, I'm going to compare the settings I've got in this trunk installation with the settings I have in other working installations... hopefully, that will be enough to figure out why I'm not getting what I want.

I'm going to put this in the back burner... I need to finish the code I'm working on before I lose track of what I'm doing.

Thank you for the help... I'm sure I'll have more questions/comments later.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10222
  • Debugger - SynEdit - and more
    • wiki
Re: Code completion items
« Reply #8 on: March 18, 2024, 08:26:17 pm »
The yellow hint with the parameter declarations:
   Editor > Completion and hints. "Auto display function prototypes"
Also Ctrl-Shift-Space

The drop down "code completion window" also has settings on
   Editor > Completion and hints.
Mainly the delay timer. "completion box delay"

So if (in codetools > identifier completion) you have it "automatically on typing" then that only applies if you also checked "use completion delay"
(Which BOTH are on in your image)


The other thing is, if codetools has issues reading your code. Then they stop working (as no content can be delivered).

Then also jump to declaration may stop working.

Afaik, certain generic constructs (especially generic procedures) may cause that.

 

TinyPortal © 2005-2018