[PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
-
- CodeLite Curious
- Posts: 7
- Joined: Tue Nov 25, 2008 2:51 am
- Contact:
[PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Hi,
I am new to CodeLite but I really like it. I've been missing an editor feature which I promptly reported and implemented (because I really love this feature in Visual Studio's Visual Assist X Plugin)
The feature is for auto closing brackets if you type any of (, [, or { it will add the corresponding counter part on the same line and keeps the caret infront of it. So you edit in-between
Is the corresponding feature request:
https://sourceforge.net/tracker/index.p ... tid=979963
The patch I have attached is also adding an option to the editor menu in the misc tab which is by default disabled. So it's possible to turn it on and off (if it sucks for example )
Regards,
Vinzenz
I am new to CodeLite but I really like it. I've been missing an editor feature which I promptly reported and implemented (because I really love this feature in Visual Studio's Visual Assist X Plugin)
The feature is for auto closing brackets if you type any of (, [, or { it will add the corresponding counter part on the same line and keeps the caret infront of it. So you edit in-between
Is the corresponding feature request:
https://sourceforge.net/tracker/index.p ... tid=979963
The patch I have attached is also adding an option to the editor menu in the misc tab which is by default disabled. So it's possible to turn it on and off (if it sucks for example )
Regards,
Vinzenz
You do not have the required permissions to view the files attached to this post.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Thanks for the patch, however I did not accept it for the below reasons, (but I did use your idea):evilissimo wrote:Hi,
I am new to CodeLite but I really like it. I've been missing an editor feature which I promptly reported and implemented (because I really love this feature in Visual Studio's Visual Assist X Plugin)
The feature is for auto closing brackets if you type any of (, [, or { it will add the corresponding counter part on the same line and keeps the caret infront of it. So you edit in-between
Is the corresponding feature request:
https://sourceforge.net/tracker/index.p ... tid=979963
The patch I have attached is also adding an option to the editor menu in the misc tab which is by default disabled. So it's possible to turn it on and off (if it sucks for example )
Regards,
Vinzenz
1) Since this is more of an editor feature and not something which is only relevant to C++ (for example it is useful for XML editing as well), I added the implementation at the editor level and not the context level (i.e. instead of context_cpp.cpp I added the insertion code at cl_editor.cpp)
2) The settings -> editor -> misc is not the correct place for it, so I moved it to settings -> editor -> general under Guides section
3) using EditorConfigST::Get()->GetLongValue() is an expensive operation which I prefer not to call it every time user types ([{ (since it involves querying the XML which is quite large), so:
- I moved the settings to OptionsConfig (since this is the correct place for options of type settings -> editor -> general
- It is being kept as member of LEditor class, and been initialized at SetProperties() which is called whenever the 'Settings' dialog is dismissed
4) I made the code a bit more smart: If the counter part already exist, dont add another one
But as you can guess, I liked the idea so I took the liberty of implementing it myself (hope you don't mind )
Committed in SVN trunk.
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 7
- Joined: Tue Nov 25, 2008 2:51 am
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Hi,
no I don't mind of course I just did a quick implementation for it without really knowing the code, design or any idea behind it. I just missed this feature so I modified my version
And a good move to optimize it right away Also I like that you added the check for the counter part
I just started using this editor on Saturday and did not really spend much time with the code I just wanted to have this done for me
Thanks for your quick response
Regards,
no I don't mind of course I just did a quick implementation for it without really knowing the code, design or any idea behind it. I just missed this feature so I modified my version
And a good move to optimize it right away Also I like that you added the check for the counter part
I just started using this editor on Saturday and did not really spend much time with the code I just wanted to have this done for me
Thanks for your quick response
Regards,
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Another thing that we both missed:
- CodeLite will now ignore this feature while in comment or string
in SVN trunk
Eran
- CodeLite will now ignore this feature while in comment or string
in SVN trunk
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 7
- Joined: Tue Nov 25, 2008 2:51 am
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Hi,
I've improved the whole thing a bit to the behavior I'd expect/like to see. Have a try if you like it
I removed the check for the counter part because you cannot do them nested with the same behaviour however have a try
Regards,
Vinzenz 'evilissimo' Feenstra
I've improved the whole thing a bit to the behavior I'd expect/like to see. Have a try if you like it
I removed the check for the counter part because you cannot do them nested with the same behaviour however have a try
Regards,
Vinzenz 'evilissimo' Feenstra
You do not have the required permissions to view the files attached to this post.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Applied in SVN trunk
Eran
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 16
- Joined: Mon Oct 13, 2008 6:20 pm
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Hi Eran,
I believe the general tab needs a scrollbar
I found some (very usefull) options that where new for me when I made the settings window greater.
should I post a feature request?
denk_mal
I believe the general tab needs a scrollbar
I found some (very usefull) options that where new for me when I made the settings window greater.
should I post a feature request?
denk_mal
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
No... since resizing the dialog will solve this (when installing clean codelite, the dialog will show all items, you can remove the file C:\Program Files\CodeLite\config\codelite.xml to get "clean" state")denk_mal wrote:should I post a feature request?
@evilissimo
You might want to update SVN and give your feature a try: Scott (sdolim) improved it significantly!
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 7
- Joined: Tue Nov 25, 2008 2:51 am
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
Now this is awesome
It's even better than with Visual Assist X
Thanks a lot
It's even better than with Visual Assist X
Thanks a lot
-
- CodeLite Veteran
- Posts: 69
- Joined: Fri Oct 24, 2008 10:29 pm
- Contact:
Re: [PATCH] Auto Closing Brackets (Opt-in feature) [2340288]
I have a problem with the size of the settings dialog. My Windows box is a Fujitsu Lifebook P1610, with a screen resolution of 1280x768.
The dialog has grown so big now that it goes off the bottom of the screen. I can't reach the bottom few settings on the General tab, nor can I get to the OK/Cancel buttons -- I use Tab/Enter/ESC (blindly) to close the dialog.
I think that with some rearrangement of the options the dialog could be made smaller. Or, there's that scrollbar idea.
What do you think Eran? I'm willing to work on it if you approve the idea.
Scott
The dialog has grown so big now that it goes off the bottom of the screen. I can't reach the bottom few settings on the General tab, nor can I get to the OK/Cancel buttons -- I use Tab/Enter/ESC (blindly) to close the dialog.
I think that with some rearrangement of the options the dialog could be made smaller. Or, there's that scrollbar idea.
What do you think Eran? I'm willing to work on it if you approve the idea.
Scott