Home » Language IDEs » PHP Development Tools (PDT) » Bad Habbits(several small problems, bothering me the whole day)
Bad Habbits [message #676594] |
Sun, 05 June 2011 14:57 |
SaHiB Messages: 5 Registered: May 2011 |
Junior Member |
|
|
Hi everbody,
i hope, you can help me with some of my "problems". I tried asking in the Newcomer Board, but I was told to try to get answers here, so: here I am
I recently changed from an other editor to eclipse, but there are some of it's habbits which bother me.
I'm using the current Helios version for programming php/html/css/js
- is there any posibility to bind code-templates to a key?
- can I teach eclipse to insert a '<br />' when I'm hitting ctrl+return in html-mode, instead of a linebreak?
- when mixing html and php, I usually use short tags for outputs. When I start typing <? it auto inserts a <?php ?>, so if i want to use shorttags <?=$foo?> this habbit costs a lot of time - can I deactivate it?
- where is the definition list for php keywords stored? I like to have AND/OR also in the keywordlist for syntax highlighting, but don't know where to add it.
- really bothering is that the eclipse viewport jumps, when undoing something. If I hit strg+z, it the last step is undone, but the viewport also jumps, so the line where the undoing action happend "jumps" to line 26 of the visible lines. How can i stop this from happening?
- when I have an IF in php, followed by a single command, I dont use brackets, but intend the command with one tab in the next line. ctrl+i dont recognize this dependency between the command and the IF, so it dont intend the code, that is only executet if the condition is true (same problem with loops)
Example:
if(true)
foo();
//ctrl+i changes it to
if(true)
foo();
- another problem with ctrl+i and with shift-tab, is removing indenting. It works fine, as long a there are tabs used for intending. But as soon as you'll get a file, that uses 4 whitespace instead of one tab (or even mixes whitespace and tabs), it fails. How can I make eclipse, to treat 4 white spaces as one tab, when shifting code to the left?
- when double clicking on code to select a word, some of the selecting habbits of eclipse are not that productiv for me.
Example: foo.class.php - double click on foo should select only foo, but in eclipse the whole string foo.class.php is selected. Same problem with foo/bar. Is there any file where I can edit those "stop selecting" characters ?
- A last thing: I'd like to make some small text-manipulating-custom-scripts running over my Code, like removing whitespaces, changing some chars against others and stuff like that - is there an easy to use interface for userdefinded scripts, where I can access the content of the current editor and modify it, or do I need to programm a whole plugin for those simple tasks?
thats all so far, a lot of questions and I know, my english isn't the best, but I hope you'll understand it anyways. I also searched for all topics with google, but either I use the wrong keywords, or I am the only one, that is bothered by these things.
btw: even a "that is impossible to do" for one ore more of the above questions would be an answer that helps me, so I can stop searching for a solution!
Anyway: thanks for your help and your patience
greetings
SaHiB
|
|
|
Re: Bad Habbits [message #676783 is a reply to message #676594] |
Mon, 06 June 2011 14:03 |
dominik Messages: 122 Registered: July 2009 |
Senior Member |
|
|
On 2011-06-05 16:57, SaHiB wrote:
> is there any posibility to bind code-templates to a key?
Yes, but You need additional plugin, browse eclipse marketplace for some with
keystroke snippets support.
> can I teach eclipse to insert a '<br />' when I'm hitting ctrl+return in
> html-mode, instead of a linebreak?
With additional plugin this should be possible.
> when mixing html and php, I usually use short tags for outputs. When I start
> typing <? it auto inserts a <?php ?>, so if i want to use shorttags <?=$foo?>
> this habbit costs a lot of time - can I deactivate it?
preferences -> php -> editor -> typing -> add "php" after PHP start tag
Yes, You can turn off this feature, but it's really bad idea, because You will
get errors from xml declaration etc. I always turn off short tags.
You can assign new template to PHP like "=" what will evaluate to <?=${}?> ->
then single char + ctrl + space and enter will fill this template. It can fill
<?php echo ${} ?> also :)
> where is the definition list for php keywords stored? I like to have AND/OR also
> in the keywordlist for syntax highlighting, but don't know where to add it.
Somewhere in resources directory. Try to grep for some php function and You will
find that.
> really bothering is that the eclipse viewport jumps, when undoing something. If
> I hit strg+z, it the last step is undone, but the viewport also jumps, so the
> line where the undoing action happend "jumps" to line 26 of the visible lines.
> How can i stop this from happening?
I can't understand how You would like this to work.
> when I have an IF in php, followed by a single command, I dont use brackets, but
> intend the command with one tab in the next line. ctrl+i dont recognize this
> dependency between the command and the IF, so it dont intend the code, that is
> only executet if the condition is true (same problem with loops)
> Example:
>
> if(true)
> foo();
> //ctrl+i changes it to
> if(true)
> foo();
Just edit "if" template and use it or add something similar to this.
Short notation is great but only for short things:
if (...) ...();
else ..();
Why You want to use short version and waist two lines?
> another problem with ctrl+i and with shift-tab, is removing indenting. It works
> fine, as long a there are tabs used for intending. But as soon as you'll get a
> file, that uses 4 whitespace instead of one tab (or even mixes whitespace and
> tabs), it fails. How can I make eclipse, to treat 4 white spaces as one tab,
> when shifting code to the left?
formatters -> indent as tabs, width: 1, text editors -> displayed tab size: 4
BTW: there are plugins to convert mixed content to tabs, also it's great to use
built in formatter (ctrl-shift-f)
> when double clicking on code to select a word, some of the selecting habbits of
> eclipse are not that productiv for me.
> Example: foo.class.php - double click on foo should select only foo, but in
> eclipse the whole string foo.class.php is selected. Same problem with foo/bar.
> Is there any file where I can edit those "stop selecting" characters ?
Sorry but I never seen any other behavior for this, moreover this can be system
related setting.
> A last thing: I'd like to make some small text-manipulating-custom-scripts
> running over my Code, like removing whitespaces, changing some chars against
> others and stuff like that - is there an easy to use interface for userdefinded
> scripts, where I can access the content of the current editor and modify it, or
> do I need to programm a whole plugin for those simple tasks?
Yes, there is plenty of features that can do this trick. I have somewhere code
beautifier that changes whole file on keystroke. You can launch external program
or make small changes.
/dmc
|
|
|
Re: Bad Habbits [message #677136 is a reply to message #676783] |
Tue, 07 June 2011 16:47 |
SaHiB Messages: 5 Registered: May 2011 |
Junior Member |
|
|
thx dominic, you are my Hero - thx for a such detailed answer!
but i wouldn't be a noob if I wouldn't have any further questions
If searched the marketplace bevor with several keywords (also for "keystroke snippet") but didn't find anything. Do you have a name of such a plugin for me? The Plugindescriptions in the marketplace are mostly cryptical to me so most of the time I don't understand, what a plugin is really for...
shorttags are usually no problem in my projects and beside the fact, that they are very short, I like the clean look of them. If you get Problems with them a simple earch&replace can solve the problem in the whole project...
Anyway, your hint solved my Problem THX!
I still havent managed to get AND / OR highlighted as a keyword. In the resources I can find all classes ans methods for PHP, but I dont see a way, how that could help me, telling the syntaxhighlighter to treat AND/OR as a keyword.
ctrl-shift-f - yeahh! that's great - it works!
Quote:>Sorry but I never seen any other behavior for this, moreover this can be system
>related setting.
I don't think so. It is depending on the current syntax-highlighter.
PHP Example:
I'm using firePHP to debug like this:
FB::info($bar,'$foo'); doubleclick on $foo selects just foo instead of $foo which it makes harder to relpace it by something else.
Other (HTML) Example:
if I like to replace the files name I doubleClick on foo, but instead of selecting 'foo' it selects upload/gfx/foo.png.
<img src="upload/gfx/foo.png" alt="bar" />
Same situation, but within PHP Code will select foo.png which is much better.
echo '<img src="upload/gfx/foo.png" alt="bar" />';
Anyway: there seems to be a definition of "stop characters" for each language and I like to know, where I can find these definitions
Thy angain for your detailed post bevore, it has been already a great help!
|
|
|
Re: Bad Habbits [message #683781 is a reply to message #677136] |
Tue, 14 June 2011 12:17 |
dominik Messages: 122 Registered: July 2009 |
Senior Member |
|
|
On 2011-06-07 18:47, SaHiB wrote:
> If searched the marketplace bevor with several keywords (also for "keystroke
> snippet") but didn't find anything. Do you have a name of such a plugin for me?
> The Plugindescriptions in the marketplace are mostly cryptical to me so most of
> the time I don't understand, what a plugin is really for...
First plugin by snippets keyword:
http://market.eclipsesource.com/yoxos/node/AfaeFeature.feature.group?mpc=true&mpc_state=
Afae stands for Another Freebooter's All-purpose Editor. It is
a group of plugins for Eclipse that do the following:
- Syntax highlighting for many types of files.
- MetaWeblog plugin for posting to your blog
- Keystroke comments
- An image viewer and basic re-sizer for GIF, JPG, ICO, and PNG
- Snippets inserter with trigger text and variable replacement.
- A while-you-edit XML DTD and XML Schema validator
- Much more...
Try it, it should be what You are looking for.
> shorttags are usually no problem in my projects and beside the fact, that they
> are very short, I like the clean look of them. If you get Problems with them a
> simple earch&replace can solve the problem in the whole project...
> Anyway, your hint solved my Problem THX!
Short tags are always problematic, but it's Your choice.
I used that few years ago when all I have was simple notepad and before xml like
files were commonly used.
> I still havent managed to get AND / OR highlighted as a keyword. In the
> resources I can find all classes ans methods for PHP, but I dont see a way, how
> that could help me, telling the syntaxhighlighter to treat AND/OR as a keyword.
Ok, just try plugin mentioned. It have: Syntax highlighting for many types of
files. - maybe this will work for You, if not I'm sure that You can find more
plugins with this.
> ctrl-shift-f - yeahh! that's great - it works!
Yes, this is nice, particularly for very old code that need refactoring. You can
customize every construction how it's changed.
>> Sorry but I never seen any other behavior for this, moreover this can be system
>> related setting.
> I don't think so. It is depending on the current syntax-highlighter.
> PHP Example:
> I'm using firePHP to debug like this:
> FB::info($bar,'$foo'); doubleclick on $foo selects just foo instead of $foo
> which it makes harder to relpace it by something else.
>
> Other (HTML) Example:
> if I like to replace the files name I doubleClick on foo, but instead of
> selecting 'foo' it selects upload/gfx/foo.png.
> <img src="upload/gfx/foo.png" alt="bar" />
>
> Same situation, but within PHP Code will select foo.png which is much better.
> echo '<img src="upload/gfx/foo.png" alt="bar" />'; Anyway: there seems to be a
> definition of "stop characters" for each language and I like to know, where I
> can find these definitions
I really never paid much attention for this behavior but sure, eclipse allows to
change double click strategy, even for each type of file. Here You can read more
about that:
http://wiki.eclipse.org/FAQ_How_do_I_change_the_selection_on_a_double-click_in_my_editor%3F
best regards
/dmc
|
|
|
Goto Forum:
Current Time: Sat Apr 27 00:53:56 GMT 2024
Powered by FUDForum. Page generated in 0.02903 seconds
|