Highlight debug functions - debugging

I use PhpStorm for a while now, and it's code inspection and syntax highlighting is great! To further extend this feature, I am looking for a way to alert myself of 'debug functions'. I frequently use functions like var_dump(), exit() or echo '<pre>',print($var),'</pre>'. Unfortunately, I also frequently forget these when deploying some code.
Is it possible to add custom highlighting in PhpStorm for some defined functions with the Inspection-feature, so I am visually notified that some debugging-code is still present? Or a plugin or other feature to accomplish something like that?

Install and use Php Inspections (EA Extended) plugin
Once installed -- Settings/Preferences | Editor | Inspections
One of the inspections this plugin provides called Forgotten debug statements -- find it there (hint: there is a search field -- use it)
This inspection will highlight some standard debug related functions + you can add your own function names.
P.S.
This inspection works with PHP functions only -- it will not find constructions like echo '<pre>',print($var),'</pre>'.
BTW -- why don't you try Xdebug/Zend Debugger for a proper debug experience?

Related

How to get Visual Studio Code intellisense to complete methods and set cursor inside ( ) after hitting tab

Packages and methods in Visual Studio Code all auto complete after hitting tab (Golang), which is great, but I want it to complete the method and then put the cursor inside the ( ). I had it working like this on another machine but I can't seem to find setting/extension that does this.
Example:
// before hitting tab
fmt.Pri
// after hitting tab
fmt.Println
// would like this after hitting tab (with cursor inside parenthesis)
fmt.Println()
Any help is appreciated.
I finally found it. Inside your settings.json you need the following line.
{
"go.useCodeSnippetsOnFunctionSuggest": true,
}
I have the Go ms-vscode.go extension enabled, not sure if this is relevant but just in case.
There's a few issues about this on Github. Seems they don't want to implement it as standard because it would interfere when you want to type a function reference instead of a function call.
VSCode extensions can provide "snippets", which insert code based on a prefix and include the concept of tab stops. This is not really what you're looking for but I'll draw your attention to it anyway.
You can implement more advanced functionality with a language server that listens for events in the document. If you wanted to write it yourself, I think you would need to create a language server extension.

Xcode, see where a method is used

I have a method in some class and i would like to see exactly where it is being used. Compared to Java and Eclipse you can simply tell it to show all the references and even a call hierarchy of a method. Is there anything similar in Xcode?
I know that Objective-C does not follow the same ways of identifying method signature as Java does (i.e. there is no method to a class, just a bunch of selectors mapped to an id at runtime), so i'm having a hard time trying to figure out how Xcode could even accomplish this.
Look here:
There is no equivalent menu or context menu.
In addition to callers you can access callees, superclasses, etc.
If you don't use Ctrl-1 for Spaces you can access that menu with it.
Note that you need to use the Standard or Assistant Editor:
Callers and callees are not shown if the Version Editor is selected:
Your best bet is likely string searching, but realize that you can use patterns (click the little magnifying glass in the search bar in the file browser pane).
You've hinted at one of the reasons it's so hard to do otherwise. Objective-C's runtime allows many different ways of finding and executing code.

Xcode Documentation Generator

I've looked at Headerdoc and Doxygen for documenting source code, but they both seem to need the developer to do most of the leg-work first. In Visual Studio, typing \\\ generates the skeleton for documentation including the parameters expected by a method. There's also Ghostdoc which guesses what the method does based on its name and parameters. Is there anything similar for Xcode?
There is also Appledoc, which creates a variety of documentation from comments in your source, docsets, html that looks just like the Apple docs.
You can use VVDocumenter plugin, it's a very handy plugin for XCode documentation.
After that you can find the method (or any code) you want to document to, and type in ///, the document will be generated for you and all params and return will be extracted into a Javadoc style, which is compatible with Appledoc, Doxygen and HeaderDoc. You can just fill the inline placeholder tokens to finish your document.
Download the XCode package manager: Alcatraz which can be done easily with the following command:
curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh
Restart XCode and you will find a new option in the Window toolbar menu labed 'Package Manager'. You can then install VVDocumenter from there.
Once you install VVDocumenter you'll need to restart XCode again, but after you reload Xcode you can then type /// to get help writing comments which will later be used to write your documentation.

PhpStorm configuration for automatic creation of the class namespace use statement like in ZendStudio

I like ZendStudio feature when after typing class name and pressing "Enter" it automatically adds namespace use statement into the head of the script file.
Is it possible to do the same in the PhpStorm IDE?
Not sure if this has been there all the time, or if it a new addition but it can be done already.
On my case, you get on top of the class that you want the use imported and you press alt+Enter. A popup allowing you to select which namespace you want to import pops up.
You can see a more graphical explanation here:
PHP Storm Tricks: Add your USE Statements Automatically!
I just wanted to disable it (it's native and enabled by default now) and found this SO thread.
For people like me, here's where the setting:
Editor > Auto-import > PHP - Enable auto-import in namespace scope
Please vote http://youtrack.jetbrains.net/issue/WI-1362
In PHPStorm 6.0.3 on Mac (and presumably other platforms) you should follow the advice given by #Savageman. It worked for me.
Go to "Settings" (Ctrl+Alt+S) > "Code Style > PHP" (I'm assuming you're using PS 3.0)

How do you stop the XCode debugger from autocompleting without options?

The debugger is really (de)bugging me. Every time I try to type a po ... command, it autocompletes (without giving me any options) and I end up typing stuff like po [selfelf and so on until I go mad. Is there any way of stopping this, or of always giving me the autocomplete popup like in the standard editor?
This answer applied to the GDB debugger which is no longer the standard debugger used with Xcode
This is achieved by adding the following line to the "readline init file" (which, by default, I think does not exist). I created the file ~/.inputrc and put the following text in it:
set disable-completions 'On'
Hmm, the accepted answer is kind of overkill.
How about the answer provided to this question:
The closest I've come to solving this incredibly annoying problem is
to turn off automatic code completion in general (Preferences > Text
Editing > Suggest Completions While Typing) and then hit esc whenever
I actually do want code completion.

Resources