Skip to content

raziEiL/SourceMod-Npp-Docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docs screenshot

SourceMod-Npp-Docs

GitHub release Donate
Here the new API docs with all (I hope) function, define, enum, methodmap and fixed xml structure. Docs were generated by reworked generator plugin.

Plugin

Features:

  • Generate auto-completion files.
  • Generate inline docs (sourcemod.xml).
  • Supports SourceMod 1.7 API specifics.

Changes:

  • Added better way to detect commentary.
  • Added methods docs.
  • Added more console stats.
  • Added xml filter.
  • Code optimization.
  • Detects all function params.
  • Detects enum & define correctly.
  • Detects methodmap selection.
  • Detects typeset.
  • Makes keywords to pop up correctly.

Server command:

sm_makedocs - starts to parse SourceMod includes and generates output files.

Notepad++

SourceMod docs files are located in the plugins\NPP\ subfolder of sourcemod folder.
Notepad++ API files are located in the plugins\APIs\ subfolder of the Notepad++ installation folder.
Notepad++ API v7.6+ files are located in the autoCompletion\ subfolder of the Notepad++ installation folder.

Note: Use sm_makedocs command to generate docs or get them from the latest release).

Highlights

Use preset

A preset has all the setting ready to developing your plugin. To load preset go to Notepd++ -> Lanuguage -> Define your language -> Import and select userDefineLang.xml from SourceMod docs or copy userDefineLang.xml to <USER_NAME>\AppData\Roaming\Notepad++\

Define you own preset

If you want to configurate user defined languge or update keywords, check plugins\NPP\ folder for NPP_STYLE files. These files contain defining the keyword lists for the SourcePawn language. Open one of those files, select keywords and copy. Go to Notepd++ -> Lanuguage -> Define your language... Select you own language or create new and past keywords to the Keywords Lists group. Do it for other groups too. More information here: UDL 2.0. Docs screenshot

Note: It's important to define your language as sourcemod

Autocompletion

Copy sourcemod.xml file from SourceMod docs folder to Notepad++ API folder. Done! Due to Notepad++ Issues I highly recommend using 3P plugin for autocompletion feature. Otherwise, you can use default Notepad++ autocompletion feature (don't forget to read about Issues). The completion list can be triggered automatically as you type, via settings in Settings -> Preferences -> Auto-Completion: Auto-Completion is enabled by a checkbox. Additionally there is a setting "From X th character", accepting a the minimum length of a prefix needed before the completion list is shown (some people like 2, some 3, some 4...); and, there is a setting to specify which candidates should be used: words, functions, or both.

Note: Press TAB to fast autocompletion.
Note: To watch docs again place the cursor between ( ) characters and press CTRL+SHIFT+SPACE hotkeys

Useful URLs

NppExec Script and Console Hightlight

Methodmap notes

Docs screenshot
These strings are not actual SourceMod functions. The purpose of these strings is to provide access to documentation showing the methodmap structure. Notepad++ don't reacts on dots in names (exp: fileArray.GetString) and docs not shown, so . were separated with _ symbol.

Note: If you want to use string as code you must remove prefix and separate _ with .
Note: If you want to watch docs you must do the vice versa.

Prefix structure:

MM (Methodmap) type With tag Without tag
C (Constructor) MM_%1_%2_C_%3 MM_%1_C_%3
M (Method) MM_%1_%2_M_%3 MM_%1_M_%3
P (Property) MM_%1_%2_P_%3 MM_%1_P_%3

Where: %1 - Class name, %2 - Tag name, %3 - Real method/property/constructor name.

Note: Prefix - a string before %3 param (e.g., MM_ArrayList_Handle_M_GetArray).

Examples:

MM (Methodmap) type With tag Without tag
C (Constructor) MM_Menu_Handle_C_Menu Always has the tag
M (Method) MM_Menu_Handle_M_ToPanel MM_AdminId_M_BindIdentity
P (Property) MM_Menu_Handle_P_ItemCount MM_AdminId_P_ImmunityLevel

Editing string to watch docs:
Method: ToPanel()
Prefix: MM_Menu_Handle_M_
Result: MM_Menu_Handle_M_ToPanel

Editing string to use as code:
Docs string: MM_AdminId_P_ImmunityLevel
Removes prefix: MM_AdminId_M_
Result: my_code.ImmunityLevel()

Issues

The following Issues were reported on notepad-plus-plus repository.

  1. Code-complete-file defined with ignoreCase="yes" input makes autocomplete work incorrectly.
  2. Code-complete-file defined with ignoreCase="no" input makes pop up docs work incorrectly for functions with a similar names (e.g., ReplaceStringEx hint docs from ReplaceString).

By deafault code-complete-file defined withignoreCase="yes" input, because it did less harm. So, keep in mind about issues #1.

Note: For changing ignoreCase attribute edit sourcemod.xml file.

Credits:

  • Thanks @MCPAN for original plugin.

Donation

My cat wants a new toy! I try to make quality and beautiful toys for my beloved cat. I create toys in my spare time but sometimes I can step into a tangle and get confused! Oops! It takes time to get out! When the toy is ready I give it to the cat, the GitHub cat and the community can also play with it. So if you enjoy my toys and want to thank me for my work, you can send any amount. All money will be spent on milk! Donate 🐾