Recent

Author Topic: Letter casing correction  (Read 5566 times)

Old_Dog

  • New Member
  • *
  • Posts: 28
Letter casing correction
« on: November 01, 2015, 01:45:57 pm »
Code: Pascal  [Select][+][-]
  1.  var myInt as integer;
  2.  begin
  3.  
  4.    myint := 0;
  5.  
  6.  

In VB6 the IDE will change the casing of myvar on line 4 to match its declaration, once the line is completed.
Is this available in Lazarus IDE?

I find it helpful there as it provides a visual clue that you have typed the identifier correctly.
« Last Edit: November 01, 2015, 01:48:44 pm by Old_Dog »

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: Letter casing correction
« Reply #1 on: November 01, 2015, 02:04:48 pm »
press ctrl+space at the end of the variable or in the middle to select it from a number of similar variables.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Letter casing correction
« Reply #2 on: November 01, 2015, 03:19:55 pm »
press ctrl+space at the end of the variable or in the middle to select it from a number of similar variables.

That's a good feature and is superior in ways in that you can select from a list.
Maybe because I am new to lazarus and a lot more familiar with vb, as of now I
still prefer that. Hopefully I'll change my mind!

rvk

  • Hero Member
  • *****
  • Posts: 4329
Re: Letter casing correction
« Reply #3 on: November 01, 2015, 04:09:49 pm »
If you have installed the package jcfidelazarus you can use Ctrl+D to format your source according to certain guidelines (spacing, capitalization of certain keywords etc.). In Lazarus, however, the source needs to be correct (In Delphi this can even be done with errors in the source). Unfortunately the JEDI Code Formatter does not correct variable names to be like the first instance it encounters. (If I remember correctly it does do this in Delphi.)

So maybe this could be a feature for the JEDI Code Formatter.

Unfortunately it won't help you during coding because the code formatter is something you run afterwards.
« Last Edit: November 01, 2015, 04:11:48 pm by rvk »

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: Letter casing correction
« Reply #4 on: November 01, 2015, 04:52:23 pm »
press ctrl+space at the end of the variable or in the middle to select it from a number of similar variables.

That's a good feature and is superior in ways in that you can select from a list.
Maybe because I am new to lazarus and a lot more familiar with vb, as of now I
still prefer that. Hopefully I'll change my mind!
yeah Its a fast way to check that you haven't typed the variable wrong isn't it? I used to rely on that too, I got used on the ctrl+space thing after a while but now I press it compulsively after each word trying to emulate the vb feature as close as possible. The wrong variable name is just an unwarranted need that has no value in pascal I think that this was important in vb because the first versions where case sensitive and you could define in the code new variables, or something along those (don't quote me on that I'm really not very sure about the fact of the statement), both of those are impossible in lazarus making the insecurity unwarranted but I still have it from those days.
« Last Edit: November 01, 2015, 04:54:17 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Letter casing correction
« Reply #5 on: November 01, 2015, 05:51:05 pm »
If you have installed the package jcfidelazarus you can use Ctrl+D to format your source according to certain guidelines (spacing, capitalization of certain keywords etc.). In Lazarus, however, the source needs to be correct (In Delphi this can even be done with errors in the source). Unfortunately the JEDI Code Formatter does not correct variable names to be like the first instance it encounters. (If I remember correctly it does do this in Delphi.)

So maybe this could be a feature for the JEDI Code Formatter.

Unfortunately it won't help you during coding because the code formatter is something you run afterwards.

I have the bare bones install so I don't think that I have that.
Even if it's only something to run afterwards it would still help and at the very least pretty things up.
If you go to Tools->Options->Codetools->words, there's a section there called Identifier Policy with various options like uppercase, lowercase etc.
This sounds like the same thing but it doesn't seem to affect the casing of code so far as I can see?

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Letter casing correction
« Reply #6 on: November 01, 2015, 06:05:27 pm »
Its a fast way to check that you haven't typed the variable wrong isn't it? I used to rely on that too, I got used on the ctrl+space thing after a while but now I press it compulsively after each word trying to emulate the vb feature as close as possible. The wrong variable name is just an unwarranted need that has no value in pascal I think that this was important in vb because the first versions where case sensitive and you could define in the code new variables, or something along those (don't quote me on that I'm really not very sure about the fact of the statement), both of those are impossible in lazarus making the insecurity unwarranted but I still have it from those days.

Yes with 'Option Explicit'  turned off in vb (the default) you can create variables inadvertently with a mis-spelling.

There is one other feature of the vb6 ide that I quite like that was abandoned in vb.net. In vb6 you had the option to
view code in both procedure and module view. Do you miss that one? I found it great because for one thing, it meant I could scroll
with over-running the end of a method.
I have been told that means my methods are probably too long, which could well be true!
I also liked it though because it meant I could look at a method without being distracted by other code.

rvk

  • Hero Member
  • *****
  • Posts: 4329
Re: Letter casing correction
« Reply #7 on: November 01, 2015, 06:07:08 pm »
I have the bare bones install so I don't think that I have that.
Even if it's only something to run afterwards it would still help and at the very least pretty things up.
If you go to Tools->Options->Codetools->words, there's a section there called Identifier Policy with various options like uppercase, lowercase etc.
This sounds like the same thing but it doesn't seem to affect the casing of code so far as I can see?
If you type this I := 1; in code without declaring I, you can press Ctrl+Shift+C to declare I automatically. That option (Identifier Policy) will put the type in the capitalization you set for it. (I'm not sure if it also does anything other than that)

For instance if you set First letter caps.
Code: Pascal  [Select][+][-]
  1. procedure MyProc;
  2. begin
  3.   I := 1; // you press Ctrl+Shift+C at the beginning of this line
  4. end;
you'll get this:
Code: Pascal  [Select][+][-]
  1. procedure MyProc;
  2. var
  3.   I: Integer; // this will be automatically added
  4. begin
  5.   I := 1;
  6. end;


B.T.W. If it is a standard installation of Lazarus you can install jcledilazarus via Packages > Install Packages. Choose jclidelazarus in the windows at the right and choose Install selection. Choose Save and rebuild IDE and Continue. After the rebuilding of the IDE you have the JEDI Code Formatter installed.

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Letter casing correction
« Reply #8 on: November 01, 2015, 06:17:28 pm »
I have the bare bones install so I don't think that I have that.
Even if it's only something to run afterwards it would still help and at the very least pretty things up.
If you go to Tools->Options->Codetools->words, there's a section there called Identifier Policy with various options like uppercase, lowercase etc.
This sounds like the same thing but it doesn't seem to affect the casing of code so far as I can see?
If you type this I := 1; in code without declaring I, you can press Ctrl+Shift+C to declare I automatically. That option (Identifier Policy) will put the type in the capitalization you set for it. (I'm not sure if it also does anything other than that)

For instance if you set First letter caps.
Code: Pascal  [Select][+][-]
  1. procedure MyProc;
  2. begin
  3.   I := 1; // you press Ctrl+Shift+C at the beginning of this line
  4. end;
you'll get this:
Code: Pascal  [Select][+][-]
  1. procedure MyProc;
  2. var
  3.   I: Integer; // this will be automatically added
  4. begin
  5.   I := 1;
  6. end;


B.T.W. If it is a standard installation of Lazarus you can install jcledilazarus via Packages > Install Packages. Choose jclidelazarus in the windows at the right and choose Install selection. Choose Save and rebuild IDE and Continue. After the rebuilding of the IDE you have the JEDI Code Formatter installed.

I didn't know you could do that, thanks!
I will go ahead and install the JEDI code formatter also.

rvk

  • Hero Member
  • *****
  • Posts: 4329
Re: Letter casing correction
« Reply #9 on: November 01, 2015, 06:22:28 pm »
I didn't know you could do that, thanks!
I will go ahead and install the JEDI code formatter also.
There are lots of little goodies in the Lazarus IDE.
For instance:
If your cursor is on a variable or function you can press Alt+Upkey to go to the declaration of that variable/function. If it is a function and you are at the declaration (at the top of a unit, in a class for example) you can press Ctrl+Shift+Downkey to go to the implementation. This is a very handy way to jump through the code and even explore the source of Lazarus and FPC itself.

There are lots of other goodies (which even I haven't all found yet :))

taazz

  • Hero Member
  • *****
  • Posts: 5365
Re: Letter casing correction
« Reply #10 on: November 01, 2015, 06:30:10 pm »
Its a fast way to check that you haven't typed the variable wrong isn't it? I used to rely on that too, I got used on the ctrl+space thing after a while but now I press it compulsively after each word trying to emulate the vb feature as close as possible. The wrong variable name is just an unwarranted need that has no value in pascal I think that this was important in vb because the first versions where case sensitive and you could define in the code new variables, or something along those (don't quote me on that I'm really not very sure about the fact of the statement), both of those are impossible in lazarus making the insecurity unwarranted but I still have it from those days.

Yes with 'Option Explicit'  turned off in vb (the default) you can create variables inadvertently with a mis-spelling.

There is one other feature of the vb6 ide that I quite like that was abandoned in vb.net. In vb6 you had the option to
view code in both procedure and module view. Do you miss that one? I found it great because for one thing, it meant I could scroll
with over-running the end of a method.
I have been told that means my methods are probably too long, which could well be true!
I also liked it though because it meant I could look at a method without being distracted by other code.
:D. Yeah I remember the feature its not something I liked that much though. I usually write procedures of a couple of lines long if it gets to complicated or it requires multiple loops I usually break it in smaller subroutines having usually sub routines of max 20 or 25 lines (empty lines not included). As such The method/procedure view made me fill disconnected from the rest of the code, like standing on an invisible bridge able to see only the spot you stand on. You know that the bridge is there you know there is no way you can fall, yet you can't shake that nauseating feeling. Not my favorite feature but then again if I was used to it I might not had this obsession with small routines ;)
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Letter casing correction
« Reply #11 on: November 01, 2015, 06:38:28 pm »
I didn't know you could do that, thanks!
I will go ahead and install the JEDI code formatter also.
There are lots of little goodies in the Lazarus IDE.
For instance:
If your cursor is on a variable or function you can press Alt+Upkey to go to the declaration of that variable/function. If it is a function and you are at the declaration (at the top of a unit, in a class for example) you can press Ctrl+Shift+Downkey to go to the implementation. This is a very handy way to jump through the code and even explore the source of Lazarus and FPC itself.


There are lots of other goodies (which even I haven't all found yet :))

And all of this huge amount of work carried out for free and the resulting project free to use. It's incredible when you think about it.

Old_Dog

  • New Member
  • *
  • Posts: 28
Re: Letter casing correction
« Reply #12 on: November 01, 2015, 06:41:25 pm »
Its a fast way to check that you haven't typed the variable wrong isn't it? I used to rely on that too, I got used on the ctrl+space thing after a while but now I press it compulsively after each word trying to emulate the vb feature as close as possible. The wrong variable name is just an unwarranted need that has no value in pascal I think that this was important in vb because the first versions where case sensitive and you could define in the code new variables, or something along those (don't quote me on that I'm really not very sure about the fact of the statement), both of those are impossible in lazarus making the insecurity unwarranted but I still have it from those days.

Yes with 'Option Explicit'  turned off in vb (the default) you can create variables inadvertently with a mis-spelling.

There is one other feature of the vb6 ide that I quite like that was abandoned in vb.net. In vb6 you had the option to
view code in both procedure and module view. Do you miss that one? I found it great because for one thing, it meant I could scroll
with over-running the end of a method.
I have been told that means my methods are probably too long, which could well be true!
I also liked it though because it meant I could look at a method without being distracted by other code.
:D. Yeah I remember the feature its not something I liked that much though. I usually write procedures of a couple of lines long if it gets to complicated or it requires multiple loops I usually break it in smaller subroutines having usually sub routines of max 20 or 25 lines (empty lines not included). As such The method/procedure view made me fill disconnected from the rest of the code, like standing on an invisible bridge able to see only the spot you stand on. You know that the bridge is there you know there is no way you can fall, yet you can't shake that nauseating feeling. Not my favorite feature but then again if I was used to it I might not had this obsession with small routines ;)

Well it's a good obsession to have I believe! I would not like to tell how long some of mine are.   :'(

 

TinyPortal © 2005-2018