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

4

10

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.

Growl answered 4/1, 2012 at 0:32 Comment(6)
For issue #2, try using /** then a * comment here on the next line. That is how Netbeans works anyways, and it is possible dreamweaver is the same... just guessing.Daryldaryle
@TimWithers Doesn't work. I tried it earlier, I've even tried it with three /***. I tried doing it as wordpress does their commenting as well.Growl
They must have some more complicated way of doing it... to make it simpler of course.Daryldaryle
offtopic: dump dreamweaver in favor of ZendStudio, PHPStorm or NetBeans. You will not be sorry ;)Dentilabial
@Dentilabial I've actually been looking at NetBeans for a while. It's just that I'm used to Dreamweaver, and learning a new IDE always take its time. Besides, these are only two issues I've had with the CS5 so far. Would NetBeans be able to do the things I want and already am used to doing in Dreamweaver? :3Growl
@Growl it depends, but most probably there would be some features that you wont see in it (like .DWT and being able to script ui in js), but overall - any of the IDE's i named are much better than DW, if you are programming. (For simple content editing in wysiwyg mode - DW is, possibly, the best choice, but who cares). NetBeans is free - you can try it whenever you have spare time.Dentilabial
P
4

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.

Premier answered 9/4, 2012 at 2:12 Comment(2)
Indeed, judging from what you've shown, NetBeans does all those things Dreamweaver currently can't, and it does it so much better. It's also free. I don't understand why Adobe tries to compete with software that is free and performs better. Maybe they should adopt the "open source" mentality.Growl
I work with DW for 5 years. because your advise, I download and install netbeans. it's greate. very nice and smart. thanksCapet
A
2

Use the Site-Specfic Code Hinting feature

Make your own structure, just add the files where your functions, classes, etc. are stored. Save the structure and your done, just worked for me!

Addams answered 12/9, 2013 at 15:50 Comment(0)
E
1

I know it is an older question and this is not the complete answer. But it will help someone for sure.

http://tv.adobe.com/watch/learn-dreamweaver-cs5/sitespecific-code-hinting-in-dreamweaver-cs5/

"Use Dreamweaver CS5 to view code hints related to content management system frameworks such as WordPress, Drupal, and Joomla. Learn how to set up site-specific code hinting for a CMS so you can easily work with your PHP website in Dreamweaver. "

Eskil answered 11/9, 2013 at 9:39 Comment(0)
G
0

for #1, The complication with a scripting language is its not strict typing. The function/method could return null, false, true, int, array, string... So the 'intellisense' has no type to base a hint off from unless it recompiles it and checks every possible return type.

for #2, the hinting is based off a clip definition file that exists for each version of PHP. With Microsoft products the currents projects (compiled) definitions are added. With PHP there is no compiling, checking or addition to the clip database (automatically). Some like PSPad will give you CodeExplorer that list each function and class in that file, but the only means I know of to get them to show up in hinting is to add it to the cips definition. I don't know where or if its possible in dreamweaver. Zend Studio and others do custom compiling and inclusion.

Granvillegranvillebarker answered 4/1, 2012 at 22:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.