Recent

Author Topic: [forget it] A request or maybe its already there?  (Read 2635 times)

mas steindorff

  • Hero Member
  • *****
  • Posts: 553
Re: A request or maybe its already there?
« Reply #15 on: October 31, 2024, 11:51:41 pm »
what key strokes are you using? alt O,R,D do not work with my v3.4   
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: A request or maybe its already there?
« Reply #16 on: October 31, 2024, 11:54:07 pm »
what key strokes are you using? alt O,R,D do not work with my v3.4

I use Ctrl+U

mas steindorff

  • Hero Member
  • *****
  • Posts: 553
Re: A request or maybe its already there?
« Reply #17 on: November 01, 2024, 12:07:29 am »
I see that ctrl +U is used for indents stuff.  I'll need to poke around a bit to find this in my windows version of the IDE.
thanks
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: A request or maybe its already there?
« Reply #18 on: November 01, 2024, 12:09:19 am »
I see that ctrl +U is used for indents stuff.  I'll need to poke around a bit to find this in my windows version of the IDE.
thanks

Make a backup and override it all, you dont use 99% of the hotkeys :D

n7800

  • Full Member
  • ***
  • Posts: 175
Re: A request or maybe its already there?
« Reply #19 on: November 01, 2024, 04:50:17 am »
At least Refactoring -> Declare variable should detect the variable name in the current line, without having to place the cursor on the specific word you want as a variable name

How about that?

...

Congratulations, you invented [Ctrl+Shift+C] ))))



Unfortunately, programming languages ​​are too complex for such simple parsing, so you need to use CodeTools to implement it correctly. Your patch in this example it tries to create a variable declaration from a string constant:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   func('i := 123'); s := 'text';
  4. end;
  5.  

and in this it does not work at all:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   func('i :=:= 123'); s := 'text';
  4. end;
  5.  

EDITED: Fixed typo.
« Last Edit: November 01, 2024, 08:08:16 am by n7800 »

Fibonacci

  • Hero Member
  • *****
  • Posts: 613
  • Internal Error Hunter
Re: A request or maybe its already there?
« Reply #20 on: November 01, 2024, 04:56:49 am »
Congratulations, you invented [Ctrl+Shift+C] ))))

Wow it does work :o

Unfortunately, programming languages ​​are too complex for such simple parsing

Obviously. It was quick test-fix for personal use.

n7800

  • Full Member
  • ***
  • Posts: 175
Re: A request or maybe its already there?
« Reply #21 on: November 01, 2024, 08:01:49 am »
Obviously. It was quick test-fix for personal use.

Sure, I understand )) However, such an addition to "Declare variable" would really be nice. Maybe someone will look at the code [Ctrl+Shift+C] and pull out this part from there.
« Last Edit: November 02, 2024, 01:41:28 pm by n7800 »

LV

  • Full Member
  • ***
  • Posts: 157
Re: A request or maybe its already there?
« Reply #22 on: November 01, 2024, 03:37:56 pm »
A straightforward way to do what the OP wants is to use Jump History (Ctrl+Alt+J).
With just one click in the Jump History window, we can go from declaring a variable to using it in a procedure far down in the code and back again. Variables can be added or removed.
Updated: Based on my research and tests, @440bx suggests the best approach.
« Last Edit: November 01, 2024, 04:39:04 pm by LV »

n7800

  • Full Member
  • ***
  • Posts: 175
Re: A request or maybe its already there?
« Reply #23 on: November 02, 2024, 02:08:59 am »
A straightforward way to do what the OP wants is to use Jump History (Ctrl+Alt+J).
With just one click in the Jump History window, we can go from declaring a variable to using it in a procedure far down in the code and back again. Variables can be added or removed.
Updated: Based on my research and tests, @440bx suggests the best approach.

I already mentioned the jump history feature [Alt+Left]:

There is also a function "Search > Find start of Code Block" [Ctrl+Q, M]. It is enough to press several times to end up at the main "begin" at the beginning of the function, before which the "var" section is usually located. To go back, you can use the cursor history ("Jump back") by pressing [Alt+Left] several times.

LV

  • Full Member
  • ***
  • Posts: 157
Re: A request or maybe its already there?
« Reply #24 on: November 02, 2024, 08:05:33 am »
A straightforward way to do what the OP wants is to use Jump History (Ctrl+Alt+J).
With just one click in the Jump History window, we can go from declaring a variable to using it in a procedure far down in the code and back again. Variables can be added or removed.
Updated: Based on my research and tests, @440bx suggests the best approach.

I already mentioned the jump history feature [Alt+Left]:

There is also a function "Search > Find start of Code Block" [Ctrl+Q, M]. It is enough to press several times to end up at the main "begin" at the beginning of the function, before which the "var" section is usually located. To go back, you can use the cursor history ("Jump back") by pressing [Alt+Left] several times.

OK, You have made 33 jumps so far. To return to step 23, you need to press (Alt+Left) 10 times. Wouldn’t it be easier to open the jump history window by pressing (Ctrl+Alt+J) and selecting the desired jump with just one click?
However, as mentioned earlier, Lazarus provides several options for the user.

n7800

  • Full Member
  • ***
  • Posts: 175
Re: A request or maybe its already there?
« Reply #25 on: November 02, 2024, 01:31:43 pm »
Well, after a large number of jumps, it is easier to open the unit again ([Ctrl+Tab] or [Alt+F12]) and go to the procedure [Alt+G]...

Of course, everyone chooses for themselves. And for me, pressing [Alt+Left] 10 times (or pressing and holding) is much easier than opening a window, picking up the mouse, scrolling the window, looking for the necessary line, clicking the mouse and putting my hands on the keyboard again.

I generally do not like taking my hands off the keyboard ))

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: A request or maybe its already there?
« Reply #26 on: November 02, 2024, 06:13:21 pm »
I would be happy if the CODE EXPLORER would show the local variables, which currently does not seem to work that way.
 And while we are using the code explorer, I could insert the variable there and then?

A note on using the shift+Ctrl+C, that only works with very simple types, if I want to locally declare a RECORD type I know exists or a non-Standard type like a BYTE, WORD etc. It does not seem to have a way to detect the type I want without issues.

The only true wisdom is knowing you know nothing

n7800

  • Full Member
  • ***
  • Posts: 175
Re: A request or maybe its already there?
« Reply #27 on: November 02, 2024, 06:46:29 pm »
I would be happy if the CODE EXPLORER would show the local variables, which currently does not seem to work that way.
 And while we are using the code explorer, I could insert the variable there and then?

A note on using the shift+Ctrl+C, that only works with very simple types, if I want to locally declare a RECORD type I know exists or a non-Standard type like a BYTE, WORD etc. It does not seem to have a way to detect the type I want without issues.

Yes, telepathic abilities are not included there, that's why Refactoring > Declare variable exists )) And I think that this window is more convenient than pasting through Code Explorer (if it were made), especially if you assign a keyboard shortcut to it.

jamie

  • Hero Member
  • *****
  • Posts: 6735
Re: A request or maybe its already there?
« Reply #28 on: November 05, 2024, 12:19:43 am »
I would be happy if the CODE EXPLORER would show the local variables, which currently does not seem to work that way.
 And while we are using the code explorer, I could insert the variable there and then?

A note on using the shift+Ctrl+C, that only works with very simple types, if I want to locally declare a RECORD type I know exists or a non-Standard type like a BYTE, WORD etc. It does not seem to have a way to detect the type I want without issues.

Yes, telepathic abilities are not included there, that's why Refactoring > Declare variable exists )) And I think that this window is more convenient than pasting through Code Explorer (if it were made), especially if you assign a keyboard shortcut to it.

I'll come up with something myself. 
Don't worry, I won't let the door hit me in the xxxx on the way out.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018