Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get parameter hints for my own PHP functions in Notepad++

Tags:

php

notepad++

After enabling "Function parameters hint on input" in Preferences->Backup/Auto-Completion, I get helpful tips for native PHP functions like this:

string|false substr (string str, int start, [int length])

Is there a plugin or something that would make Notepad++ do this for my own functions, much like Dreamweaver does?

like image 698
hamburgerly Avatar asked Sep 18 '12 01:09

hamburgerly


3 Answers

Settings -> Preferences -> Backup/Auto-Completion -> Function parameters hint on input [CHECK]

Is this what you're talking about? Works for me.

like image 69
Paul Statezny Avatar answered Nov 13 '22 09:11

Paul Statezny


I have accomplished this by doing the following:

  1. Edit API XML file used by Notepad++ for the desired language.
  2. Add custom names in Settings > Style Configurator to get highlighting you desire.

Editing the API XML file

The API XML files are located in your installation directory \plugins\APIs. I believe there is a file for each language that has a parser. That parser will determine which pieces of the XML file are required or ignored.

These files are very fragile so here are some tips:

  • All entries MUST be in alphabetically order by KeyWord or it will silently fail.
  • Watch out for text that makes your XML invalid in descriptions. From what I can tell Notepad++ doesn't have a schema to tell it that attributes are of type string so all kinds of characters will break the XML and your tips.
  • Any problems with the XML file will silently fail the tips.

I have used this technique to support a custom API used by a game engine I am working with and it works great. I have an excel spreadsheet to manage entries and create properly formatted XML to be pasted into the correct section of the file, but obviously there are many ways that managing that could be done.

I figured all this out based on these sources:

  1. http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Editing_Configuration_Files#API_files
  2. http://retroaffect.com/blog/190/A_Lua_Language_File_for_Notepad__/#b
    • (The API file here you can download has the Environment tag in the wrong place, it should be within the AutoComplete tag instead, but it helped me understand the usage.)

Editing the Style Configurator

Screen adding new key word: myNewKeyword

Screen adding new key word: myNewKeyword

Final result after adding math.tanh with highlighting

Screen showing tool tip and highlighting for math.tanh in lua

like image 35
Brooke Jackson Avatar answered Nov 13 '22 07:11

Brooke Jackson


I'm not too familiar with Notepad++, however I think unless there is some sort of IDE plugin it would not be possible.

In my opinion, you should use Aptana Studio, it's based off of the Eclipse IDE, and is specifically made for web development/PHP. Although there are plenty of other IDEs out there, here's a few.

Here's a link to Aptana: http://www.aptana.com

like image 26
Darren Avatar answered Nov 13 '22 07:11

Darren