Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code Hinting custom functions/objects/constants, and on chaining, commentary in Adobe Dreamweaver CS5

In Dreamweaver CS5 there's something called Code Hinting (let's call it CH for short).

CH has a bunch of information about functions, constants and objects built in the core library. When you press CTRL+SPACEBAR or begin structuring a statement starting with $, a window with lots of information pops up, giving me the information about it without having to look it up myself. If I press ENTER while the CH is up and something is selected, it will automatically fill in the rest for me.

I love this feature, I really do. Reminds me a little of Intellisense.
It saves me lots of time. Code hinting example, showing mysql_connect code hint

The issues I face, and haven't found any solutions to, are straightforward.


Issue #1 Chained methods do not display a code hint

Since PHP implemented the Classes and Objects, I've been able to chain my methods within classes/objects. Chaining is actually easy, by returning $this (the instance of that class), you can have a continuous chain of calls

class Object_Factory{
    public function foo(){
        echo "foo";
        return $this;
    }
    public function bar(){
        echo "bar";
        return $this;
    }
}        

$objf = new Object_Factory;
//chaining
$objf->foo()
     ->bar();

Calling them separately shows the CH.

$objf->foo();
$objf->bar();

The problem is that after the first method has been called and I try to chain another method, there's no CH to display the next calls information.

Code hinting failure when chaining methods

So, here's my first question:
Is there a way, in Dreamweaver CS5, to make the code hints appear on chaining?
Plugins, some settings I haven't found, anything?

if("no") "Could you explain why?";

Issue #2 Code hinting for custom functions, objects and constants

As shown in the first picture, there's a lot of information popping up. In fact, there's a document just like it on the online library. Constants usually have a very small piece of information, such as a number. Code hinting a constant, with the number 3 in the information window
In this image, MYSQL_BOTH represents 3.

Here's my second question:
Is it possible to get some information to the CH window for custom functions, objects and constants?

For example, with Intellisense you can use a setup with HTML tags and three slashes ///

///<summary>
///This is test function
///</summary>

public void TestFunction(){
    //Do something...
}

Can something similar be done here?
Changing some settings, a plugin, anything?


Update

I thought I'd found something that might be the answer to at least issue #1, but it costs money, and I'm not going to pay for anything until I know it actually does what I want.
Has anyone tried it, or know it won't solve any of the issues?

The search continues...


In case none of these are possible to fix, here's hoping one of the developers notices this question and implements it in an update/new release.

like image 205
ShadowScripter Avatar asked Jan 04 '12 00:01

ShadowScripter


1 Answers

I just switched to NetBeans after 10 years of using Dreamweaver. My impressions may help you. (I'll call them NB and DW respectively from now on)

Code Hints / Documentation

PHP built-in functions

Both DW and NB show all of the built-in PHP functions and constants. A nice feature is that they also provide with a link that opens the related PHP documentation page.

DW is much slower to update the definitions (through sporadic Adobe updates or on the next release) and updating them doesn't look easy (on the other hand, I quickly found the .zip files that NB uses for the PHP/HTML/CSS reference, in case I wanted to manually edit/update them).

However, since documentation can be opened so easily, I do not consider this to be a problem.

Custom functions/classes

This is where NB is clearly better; it instantly learns from your project's code. Hints for function parameters are smart in many cases, suggesting the most likely variable first.

Method chaining works wonderfully, as seen here: PHP method chaining on NetBeans (This would address question #1)

PHPDoc Support

I was greatly impressed with this feature. Take for example the above screenshot. I just typed /** followed by Enter and NB automatically completed the comment with the return type hint (also function parameters if present).

<?php

    /**
     * 
     * @return \Object_Factory 
     */
    public function foo(){
        echo "foo";
        return $this;
    }

?>

Another example: PHPDoc support in NetBeans (This would address question #2)

You can include HTML code as well as some special @ tags to your PHPDoc comments to include external links, references, examples, etc.

Debugging tools

Also noteworthy IMHO are the debugging tools included with NB. You can trace all variables (also superglobals!) while you advance step-by-step.

NetBeans PHP xDedbug support

Configuring xDebug is very easy, just uncomment some lines in your php.ini and that's it!

Other stuff

The refactoring (i.e. renaming or safely deleting functions/variables) in NB is really nice. It gives you a very graphically detailed preview of the changes before committing them.

However, the search/replace functions of DW are vastly better. I miss a lot the "search for specific tag with attribute..." function. NB only provides a RegEx search/replace.

NB has a nice color chooser but it almost never suggests it; I thought for a while there wasn't one until I accidentally discovered it. Now I know how to invoke it (CTRL+SPACE, start typing Color chooser and Enter). Very cumbersome, indeed.

I haven't used FTP a lot since I moved to NB, but I have the feeling that DW was also much better, specially for syncing local/remote folders.

NB has really good native support for SVN, Mercurial and Git. When you activate versioning support, you can see every change next to the line number (the green part on my screenshots means those lines are new). I can click on a block and compare/revert those changes, see who originally committed every line (and when), etc.

Even when [team] versioning is deactivated, NB has a built-in local history that helps you recover previous versions as well as deleted files.

Conclusion

Starting with Macromedia Dreamweaver and seeing how it slowly stayed behind the Internet as Adobe struggled to integrate and adapt their products is a painful process. (To this day DW still doesn't render correctly, even with LiveView. To be fair, NB doesn't have a built-in renderer)

Certainly, the Adobe-ization of DW has had its advantages, but this humble programmer was having a hard time justifying a $399 USD ~400MB IDE vs a very comparable free 49MB multi-platform IDE.

After the initial learning curve, I'm very comfortable with NetBeans and I don't think I'll be returning to Dreamweaver any time soon.

I know this doesn't directly answer your questions regarding DW, but I hope it helps anyway.

like image 162
MrFusion Avatar answered Oct 21 '22 10:10

MrFusion