Sign in to follow this  
JR10

Notepad++ Syntax Highlighting & Auto Completion

Recommended Posts

N++ is highly customizable, you can add your own languages with syntax highlighting and auto completion.

I had some free time last night so I decided to make it. I wrote a script that retrieves a list of all the available functions then exclude the deprecated ones, then made the language file with those functions. I also made a script to retrieve all the functions, get their wiki page content (fetchRemote) and extract the function signature from the page, then parse it into the MTA-Lua.xml file which adds auto completion. I might release the scripts later.

I've created a repo for it on GitHub, it has 2 files for the users:

  • mtalua-lang-import.xml > The file to import in the user defined language page to get the syntax highlighting
  • MTA-Lua.xml > The auto completion file

The repo contains the resource used to generate the function list and the node app used to retrieve the functions' syntax from the wiki.

Repo: https://github.com/JR10/mta-npp

THIS IS WHAT YOU WANT: Download the user files (MTA-Lua.xml and mtalua-lang-import.xml): https://github.com/JR10/mta-npp/release ... ta-npp.zip

Steps:

1. Open Notepad++ > Language > Define your language...

2. Import > Select mtalua-lang-import.xml (Make sure from now on that the MTA-Lua language is always selected for Lua files)

3. Copy MTA-Lua.xml to your Notepad++ directory "Notepad++/plugins/APIs" (Usually in C:/Program Files)

For questions, bug reports, suggestions or anything, just post here. Download: https://github.com/JR10/mta-npp/archive/master.zip

  • Like 3
  • Thanks 2

Share this post


Link to post

Thank you, i installed it directly and it's very helpful.

EDIT: i found a small error, when pressing CTRL + Space and writing xml, you will find a function called xmlNodeFindChild, but the function is called xmlFindChild.

Edited by Guest

Share this post


Link to post
Thank you, i installed it directly and it's very helpful.

EDIT: i found a small error, when pressing CTRL + Space and writing xml, you will find a function called xmlNodeFindChild, but the function is called xmlFindChild.

The function list is made automatically using a script, so I have no idea why there is an xmlNodeFindChild function in _G.

Share this post


Link to post

Good Job! Wating now for the auto completion script :D

Share this post


Link to post
Good Job! Wating now for the auto completion script :D

it's already existing:

  
<NotepadPlus>
    <AutoComplete language="Lua">
        <Environment startFunc="(" endFunc=")" paramSeparator="," terminal=";" additionalWordChar = "."/>
        <KeyWord name="aclCreate"/>
        <KeyWord name="aclCreateGroup"/>
        <KeyWord name="aclDestroy"/>
        <KeyWord name="aclDestroyGroup"/>
        <KeyWord name="aclGet"/>
        <KeyWord name="aclGetGroup"/>
        <KeyWord name="aclGetName"/>
        <KeyWord name="aclGetRight"/>
        <KeyWord name="aclGroupAddACL"/>
        <KeyWord name="aclGroupAddObject"/>
        <KeyWord name="aclGroupGetName"/>
        <KeyWord name="aclGroupList"/>
        <KeyWord name="aclGroupListACL"/>
        <KeyWord name="aclGroupListObjects"/>
        <KeyWord name="aclGroupRemoveACL"/>
        <KeyWord name="aclGroupRemoveObject"/>
        <KeyWord name="aclList"/>
        <KeyWord name="aclListRights"/>
        <KeyWord name="aclReload"/>
        <KeyWord name="aclRemoveRight"/>
        <KeyWord name="aclSave"/>
        <KeyWord name="aclSetRight"/>
        <KeyWord name="addAccount"/>
        <KeyWord name="addBan"/>
        <KeyWord name="addCommandHandler"/>
        <KeyWord name="addDebugHook"/>
        <KeyWord name="addEvent"/>
        <KeyWord name="addEventHandler"/>
        <KeyWord name="addPedClothes"/>
        <KeyWord name="addResourceConfig"/>
        <KeyWord name="addResourceMap"/>
        <KeyWord name="addVehicleSirens"/>
        <KeyWord name="addVehicleUpgrade"/>
        <KeyWord name="areTrafficLightsLocked"/>
        <KeyWord name="assert"/>
        <KeyWord name="attachElements"/>
        <KeyWord name="attachTrailerToVehicle"/>
        <KeyWord name="banPlayer"/>
        <KeyWord name="base64Decode"/>
        <KeyWord name="base64Encode"/>
        <KeyWord name="bindKey"/>
        <KeyWord name="bitAnd"/>
        <KeyWord name="bitArShift"/>
        <KeyWord name="bitExtract"/>
        <KeyWord name="bitLRotate"/>
        <KeyWord name="bitLShift"/>
        <KeyWord name="bitNot"/>
        <KeyWord name="bitOr"/>
        <KeyWord name="bitRRotate"/>
        <KeyWord name="bitRShift"/>
        <KeyWord name="bitReplace"/>
        <KeyWord name="bitTest"/>
        <KeyWord name="bitXor"/>
        <KeyWord name="blowVehicle"/>
        <KeyWord name="breakObject"/>
        <KeyWord name="call"/>
        <KeyWord name="callRemote"/>
        <KeyWord name="canPedBeKnockedOffBike"/>
        <KeyWord name="cancelEvent"/>
        <KeyWord name="cancelLatentEvent"/>
        <KeyWord name="clearElementVisibleTo"/>
        <KeyWord name="cloneElement"/>
        <KeyWord name="collectgarbage"/>
        <KeyWord name="copyAccountData"/>
        <KeyWord name="copyResource"/>
        <KeyWord name="coroutine.create"/>
        <KeyWord name="coroutine.resume"/>
        <KeyWord name="coroutine.running"/>
        <KeyWord name="coroutine.status"/>
        <KeyWord name="coroutine.wrap"/>
        <KeyWord name="coroutine.yield"/>
        <KeyWord name="countPlayersInTeam"/>
        <KeyWord name="createBlip"/>
        <KeyWord name="createBlipAttachedTo"/>
        <KeyWord name="createColCircle"/>
        <KeyWord name="createColCuboid"/>
        <KeyWord name="createColPolygon"/>
        <KeyWord name="createColRectangle"/>
        <KeyWord name="createColSphere"/>
        <KeyWord name="createColTube"/>
        <KeyWord name="createElement"/>
        <KeyWord name="createExplosion"/>
        <KeyWord name="createFire"/>
        <KeyWord name="createMarker"/>
        <KeyWord name="createObject"/>
        <KeyWord name="createPed"/>
        <KeyWord name="createPickup"/>
        <KeyWord name="createProjectile"/>
        <KeyWord name="createRadarArea"/>
        <KeyWord name="createResource"/>
        <KeyWord name="createSWATRope"/>
        <KeyWord name="createTeam"/>
        <KeyWord name="createVehicle"/>
        <KeyWord name="createWater"/>
        <KeyWord name="createWeapon"/>
        <KeyWord name="dbConnect"/>
        <KeyWord name="dbExec"/>
        <KeyWord name="dbFree"/>
        <KeyWord name="dbPoll"/>
        <KeyWord name="dbQuery"/>
        <KeyWord name="debug.debug"/>
        <KeyWord name="debug.getfenv"/>
        <KeyWord name="debug.gethook"/>
        <KeyWord name="debug.getinfo"/>
        <KeyWord name="debug.getlocal"/>
        <KeyWord name="debug.getmetatable"/>
        <KeyWord name="debug.getregistry"/>
        <KeyWord name="debug.getupvalue"/>
        <KeyWord name="debug.setfenv"/>
        <KeyWord name="debug.sethook"/>
        <KeyWord name="debug.setlocal"/>
        <KeyWord name="debug.setmetatable"/>
        <KeyWord name="debug.setupvalue"/>
        <KeyWord name="debug.traceback"/>
        <KeyWord name="deleteResource"/>
        <KeyWord name="deref"/>
        <KeyWord name="destroyElement"/>
        <KeyWord name="detachElements"/>
        <KeyWord name="detachTrailerFromVehicle"/>
        <KeyWord name="detonateSatchels"/>
        <KeyWord name="doesPedHaveJetPack"/>
        <KeyWord name="dofile"/>
        <KeyWord name="dxConvertPixels"/>
        <KeyWord name="dxCreateFont"/>
        <KeyWord name="dxCreateRenderTarget"/>
        <KeyWord name="dxCreateScreenSource"/>
        <KeyWord name="dxCreateShader"/>
        <KeyWord name="dxCreateTexture"/>
        <KeyWord name="dxDrawImage"/>
        <KeyWord name="dxDrawImageSection"/>
        <KeyWord name="dxDrawLine"/>
        <KeyWord name="dxDrawLine3D"/>
        <KeyWord name="dxDrawMaterialLine3D"/>
        <KeyWord name="dxDrawMaterialSectionLine3D"/>
        <KeyWord name="dxDrawRectangle"/>
        <KeyWord name="dxDrawText"/>
        <KeyWord name="dxGetBlendMode"/>
        <KeyWord name="dxGetFontHeight"/>
        <KeyWord name="dxGetMaterialSize"/>
        <KeyWord name="dxGetPixelColor"/>
        <KeyWord name="dxGetPixelsFormat"/>
        <KeyWord name="dxGetPixelsSize"/>
        <KeyWord name="dxGetStatus"/>
        <KeyWord name="dxGetTextWidth"/>
        <KeyWord name="dxGetTexturePixels"/>
        <KeyWord name="dxIsAspectRatioAdjustmentEnabled"/>
        <KeyWord name="dxSetAspectRatioAdjustmentEnabled"/>
        <KeyWord name="dxSetBlendMode"/>
        <KeyWord name="dxSetPixelColor"/>
        <KeyWord name="dxSetRenderTarget"/>
        <KeyWord name="dxSetShaderTessellation"/>
        <KeyWord name="dxSetShaderTransform"/>
        <KeyWord name="dxSetShaderValue"/>
        <KeyWord name="dxSetTestMode"/>
        <KeyWord name="dxSetTextureEdge"/>
        <KeyWord name="dxSetTexturePixels"/>
        <KeyWord name="dxUpdateScreenSource"/>
        <KeyWord name="engineApplyShaderToWorldTexture"/>
        <KeyWord name="engineGetModelIDFromName"/>
        <KeyWord name="engineGetModelLODDistance"/>
        <KeyWord name="engineGetModelNameFromID"/>
        <KeyWord name="engineGetModelTextureNames"/>
        <KeyWord name="engineGetVisibleTextureNames"/>
        <KeyWord name="engineImportTXD"/>
        <KeyWord name="engineLoadCOL"/>
        <KeyWord name="engineLoadDFF"/>
        <KeyWord name="engineLoadTXD"/>
        <KeyWord name="engineRemoveShaderFromWorldTexture"/>
        <KeyWord name="engineReplaceCOL"/>
        <KeyWord name="engineReplaceModel"/>
        <KeyWord name="engineRestoreCOL"/>
        <KeyWord name="engineRestoreModel"/>
        <KeyWord name="engineSetAsynchronousLoading"/>
        <KeyWord name="engineSetModelLODDistance"/>
        <KeyWord name="error"/>
        <KeyWord name="executeCommandHandler"/>
        <KeyWord name="executeSQLCreateTable"/>
        <KeyWord name="executeSQLDelete"/>
        <KeyWord name="executeSQLDropTable"/>
        <KeyWord name="executeSQLInsert"/>
        <KeyWord name="executeSQLQuery"/>
        <KeyWord name="executeSQLSelect"/>
        <KeyWord name="executeSQLUpdate"/>
        <KeyWord name="fadeCamera"/>
        <KeyWord name="fetchRemote"/>
        <KeyWord name="fileClose"/>
        <KeyWord name="fileCopy"/>
        <KeyWord name="fileCreate"/>
        <KeyWord name="fileDelete"/>
        <KeyWord name="fileExists"/>
        <KeyWord name="fileFlush"/>
        <KeyWord name="fileGetPos"/>
        <KeyWord name="fileGetSize"/>
        <KeyWord name="fileIsEOF"/>
        <KeyWord name="fileOpen"/>
        <KeyWord name="fileRead"/>
        <KeyWord name="fileRename"/>
        <KeyWord name="fileSetPos"/>
        <KeyWord name="fileWrite"/>
        <KeyWord name="findInTable"/>
        <KeyWord name="fireWeapon"/>
        <KeyWord name="fixVehicle"/>
        <KeyWord name="forcePlayerMap"/>
        <KeyWord name="fromJSON"/>
        <KeyWord name="fxAddBlood"/>
        <KeyWord name="fxAddBulletImpact"/>
        <KeyWord name="fxAddBulletSplash"/>
        <KeyWord name="fxAddDebris"/>
        <KeyWord name="fxAddFootSplash"/>
        <KeyWord name="fxAddGlass"/>
        <KeyWord name="fxAddGunshot"/>
        <KeyWord name="fxAddPunchImpact"/>
        <KeyWord name="fxAddSparks"/>
        <KeyWord name="fxAddTankFire"/>
        <KeyWord name="fxAddTyreBurst"/>
        <KeyWord name="fxAddWaterHydrant"/>
        <KeyWord name="fxAddWaterSplash"/>
        <KeyWord name="fxAddWood"/>
        <KeyWord name="gcinfo"/>
        <KeyWord name="generateACCommand"/>
        <KeyWord name="get"/>
        <KeyWord name="getAccount"/>
        <KeyWord name="getAccountData"/>
        <KeyWord name="getAccountName"/>
        <KeyWord name="getAccountPlayer"/>
        <KeyWord name="getAccounts"/>
        <KeyWord name="getAircraftMaxHeight"/>
        <KeyWord name="getAircraftMaxVelocity"/>
        <KeyWord name="getAlivePlayers"/>
        <KeyWord name="getAllAccountData"/>
        <KeyWord name="getAllElementData"/>
        <KeyWord name="getAnalogControlState"/>
        <KeyWord name="getAttachedElements"/>
        <KeyWord name="getBanAdmin"/>
        <KeyWord name="getBanIP"/>
        <KeyWord name="getBanNick"/>
        <KeyWord name="getBanReason"/>
        <KeyWord name="getBanSerial"/>
        <KeyWord name="getBanTime"/>
        <KeyWord name="getBanUsername"/>
        <KeyWord name="getBans"/>
        <KeyWord name="getBirdsEnabled"/>
        <KeyWord name="getBlipColor"/>
        <KeyWord name="getBlipIcon"/>
        <KeyWord name="getBlipOrdering"/>
        <KeyWord name="getBlipSize"/>
       

Share this post


Link to post

the text isnt greyed out with this highlighting thing in notepad++ when using --[[ ]]

--[[ 
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender. 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) ]] 

it doesnt look like this its still full of colors

Share this post


Link to post

I had some time last night and i created a small text generator app , so i generated the auto completion file including return type's and arguments.

The whole process was done automaticaly so maybe there are some mistake's but i don't found any one on a fast test.

Credit's: @JR10 for the functions.txt from where i generated the auto completion file. Fell free to take my file and release it with your other file's.

Copy and Paste it to: Notepad++/plugins/APIs/MTA-Lua.xml

I posted it on PasteBin bk the file was to big for the forum : http://pastebin.com/nnEMyHDU

Share this post


Link to post
the text isnt greyed out with this highlighting thing in notepad++ when using --[[ ]]

it doesnt look like this its still full of colors

Blame N++ for that as I tried several ways to accomplish that but to no avail.

I had some time last night and i created a small text generator app , so i generated the auto completion file including return type's and arguments.

How is that different from mine?

Share this post


Link to post

How is that different from mine?

My one include return type + argument's for every function.

Share this post


Link to post

Mine has the same.

There was a mistake on my half, I accidentally mixed the files in the last commit. Reverted it and should be working correctly now.

Share this post


Link to post

i found something, don't know what is the reason, but:

  
----------------------------------------------------------- 
  
  
  
  
----------------------------------------------------------- 
  

this will be like a multi-line comment.

Share this post


Link to post

Are you sure you have the latest file? I've tried it and it's not multi-line.

Share this post


Link to post

Thank's JR , is there a way to debug the erros while writing functions in np ++

like mta script editor ?

Share this post


Link to post

Thanks JR10!!

Now I dont have to open the wiki again and again:-) :-) :-) :-) .

Really a big big thanks

Share this post


Link to post

It's up again, check the first post for the download link.

It might be slightly outdated and I lost the generator app. I will rewrite it and update this soon.

Share this post


Link to post
Thank's JR , is there a way to debug the erros while writing functions in np ++

like mta script editor ?

No, it's impossible without a new highly advanced np++ plugin.

Notepad++ is just an editor, not an IDE .. if you want to debug errors, use MTA script editor.

Share this post


Link to post
No, it's impossible without a new highly advanced np++ plugin.

Notepad++ is just an editor, not an IDE .. if you want to debug errors, use MTA script editor.

Actually there is, viewtopic.php?f=91&t=30077

MTA Script Editor is no longer in development.

Share this post


Link to post
No, it's impossible without a new highly advanced np++ plugin.

Notepad++ is just an editor, not an IDE .. if you want to debug errors, use MTA script editor.

Actually there is, viewtopic.php?f=91&t=30077

MTA Script Editor is no longer in development.

That's a syntax checker, not a fully-functional debugger.

6aSCb6k.png

However, it can be useful for some.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.