HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

vJASS Syntax Highlighter for notepad++

05-10-2007, 02:48 AM#1
moyack
Hi guys:

Probably there are people asking... what is Notepad++?? well, this program is a very enhanced notepad, with many (but many) interesting functions to edit, and visualize text. Its features are impressive and they can be seen here.

This program is free and it can be downloaded here.

In the recent versions of this program, they offer the possibility to create a custom Syntax Highlighting and Syntax Folding. After testing and learning about it, I decided to make one for vJASS because I love the highlighting. I think the result is good enough and uses the last JASSHelper syntax, so you will have highlighting for libraries, structs, methods, etc.

How to install it??:
First download and install Notepad++ in your PC.
  1. Type %APPDATA%\Notepad++ in Run box, then Enter, there will be a opened folder appears.
  2. in the 7z file, you'll find out a file named "userDefineLang.xml".
  3. Extract "userDefineLang.xml" into the opened folder.
  4. Launch Notepad++ and it's ready :)

In order to test it, open a new file, select the menu Language > vJASS. You should see highlighted the code in vJASS.

Screenshot
Zoom (requires log in)

.:
IMPORTANT UPDATE: Now you can use auto completion for vJASS. Select the vJASS.xml file contained in the 7z file, and extract it to Your_Notepad++_Installation_Dir\plugins\APIs (Example: C:\Program Files\Notepad++\plugins\APIs\). Now you can use the auto completion by pressing CTRL+SPACE and you will see the list of functions. Press ENTER to autocomplete the desired text.

This list includes all the commands from common.j, common.ai and Blizzard.j

I hope this can be useful for people new with vJASS. Comments and suggestions are always welcome.

Changelog

(16/05/2007):
* Minor improvement. Added the debug as a keyword, sorry if it doesn't look as something different, but the api auto completion is more useful :P


(15/05/2007):

* Added vJASS.api file, so you can use auto completion in Notepad++
* Removed the constants differentiation to enable common.j and common.ai function highlighting. With this you will now if you are using a function from any of this libraries.


(11/05/2007):

* Added more constants definitions to the highlighter (Thanks Purplepoot)
* Removed the function and method folding so it doesn't generate bugs in notepad++.


(27/03/2009):
* Current version of Notepad++ has changed the API format, so it's mandatory to use this update for the current version of this program (Thanks Flame_Phoenix for the API list)
* Improved a little bit the highlighting and added new keywords.

Attached Images
File type: jpgClip_2.jpg (47.4 KB)
Attached Files
File type: 7zvJass highlighter for N++.7z (14.8 KB)
05-10-2007, 04:05 AM#2
Ammorth
Sexy! Pluse repo!

Btw, you should include a comment that it requires saving the file as .j or .ai before the settings take effect.

Edit: There is an error... (it happens with JassCraft aswell, except notepad wraps the error) using call SetTableReal("(MCS-UC)" , "\"", 0.404) will cause the string highlight to wrap.
Attached Images
File type: jpgerror.jpg (254.1 KB)
05-10-2007, 04:23 AM#3
Vexorian
I once dropped notepad++ because it didn't let me pick a different highlighting for //! over //
Also, I thought you needed a plugin for auto complete? Or have they added a way to do it without plugins?
05-10-2007, 12:19 PM#4
moyack
No, there is not neccesary to make a plugin for that, they've added the API files, (*.api) where you put in list all the most common functions. In this case I'll do a file called vJASS.API with all the common.j and common.ai function and variable names, and you just have to do CTRL+SPACE to access the list.
05-10-2007, 10:31 PM#5
1337D00D
Awesome.

Can it also correct function capitalization like JassCraft does? (Turns getunitx into GetUnitX upon typing the "(" )

EDIT: found a bug, if you use function in a code callback like in a timer, it creates a [+] fold button.
05-10-2007, 11:03 PM#6
moyack
In theory it doesn't, but I'm planning to add autocompletion functionality by adding a command list, so in some way, you can do what are you asking. Thanks for your comments, I'll see how to fix them.
05-11-2007, 11:44 PM#7
PurplePoot
Nice, but lacking a few things, in my opinion --

<Keywords name="Words4">debug SCOPE_PREFIX SCOPE_PRIVATE bj_ EVENT_ UNIT_ ITEM_ EFFECT_ SOUND_ CAMERA_ DAMAGE_ ATTACK_ GAME_ MAP_ PLAYER_ RACE_ TEXTMAP_ VERSION_ WEAPON_</Keywords>

Replacing "Words4" with that would highlight warcraft's constants as well, what about adding that? (Or making constants have their own highlighting)

Also, you forgot 'elseif' in "Words2", and 'not' in "Words1"

Finally, what about moving 'interface' to "Folder+" and 'endinterface' to "Folder-"?

(though don't do that with methods unless there's a way to tell them not to try to fold when they're in an interface)
05-12-2007, 12:40 AM#8
moyack
Thanks for your comments :)

@Ammorth: I tried to fix it, but it's impossible, I think we have to live with it :(


@PurplePoot: About the Words4 section, I've added those, I think it's a good idea.

About interface, I've decided not to add it because you can use in vJASS function interfaces, which bugs with folding. Here's an example about this feature:

Collapse JASS:
function interface Arealfunction takes real x returns real 
// as you can see, this doesn't fold, but notepad++ will show it 
// as a fold keyword, closing all the code above that line :P

function double takes real x returns real
    return x*2.0
endfunction

function triple takes real x returns real
    return x*2.0
endfunction

function Test1 takes real x, Arealfunction F returns real
    return F.evaluate(F.evaluate(x)*F.evaluate(x))
endfunction

function Test2 takes nothing returns nothing
 local Arealfunction fun = Arealfunction.double //syntax to get pointer to function

   call BJDebugMsg( R2S(  Test1(1.2, fun) ))

   call BJDebugMsg( R2S(  Test1(1.2, Arealfunction.triple ) )) //also possible...
endfunction

And the same happens with function and method, when you call a callback code, for instance. Those keywords will have disabled the folding to avoid this kind of issues.
05-12-2007, 01:07 AM#9
Vexorian
you don't get to use method in callback, but it would still mess with interface.

you just get to wish notepad++ was more flexible.
05-12-2007, 01:15 AM#10
moyack
Quote:
Originally Posted by Vexorian
you don't get to use method in callback, but it would still mess with interface.

you just get to wish notepad++ was more flexible.
Yes, I agree with you :)

Updated the file.

@Vexorian: Probably this is offtopic, are you going to implement properties get and set?? so I can add it to the highlighter.
05-12-2007, 02:06 AM#11
PurplePoot
Note: You didn't need to add TEXTMAP_FLAG_, I already gave you TEXTMAP_ and you put that in too :p
05-12-2007, 02:26 AM#12
Vexorian
Quote:
Originally Posted by moyack
Yes, I agree with you :)

Updated the file.

@Vexorian: Probably this is offtopic, are you going to implement properties get and set?? so I can add it to the highlighter.
properties are going to get added, I am also planning to add /* */
05-16-2007, 02:51 AM#13
moyack
IMPORTANT UPDATE: Now you can use autocompletion for vJASS. You must add the vJASS.api file contained in the zip file, and extract it to Your_Notepad++_Dir\plugins\APIs. Now you can use the auto completion by pressing CTRL+SPACE and you will see the list of functions. Press ENTER to autocomplete the desired text.

Now the common.j and common.ai files will be highlighted, making more easier your coding process :)

Please check the first post and update your files :D
06-22-2007, 09:07 AM#14
Silvenon
I don't understand the highlighting procedure.

Quote:
3. Do the same procedure 1. to the PC destination. Copy the "userDefineLang.xml" into the opened folder.

Can you please explain this step?

Quote:
Now you can use the auto completion by pressing CTRL+SPACE and you will see the list of functions.

Press CTRL+SPACE where? Inside Notepad ++? Also does Notepad ++ indent after certain keywords?
06-23-2007, 11:15 PM#15
moyack
My apologies for my late response, I don't know why I didn't see this thread :P

The important part of this is:
  1. Install Notepad++
  2. Download the zip file
  3. in the run box, you type "%APPDATA%\Notepad++" (without the quotes)
  4. Open the zip file and copy the "userDefineLang.xml" file into that folder
  5. And voila!!

If you create a new file and you want to select the vJASS highlighting, click on the menu Language > vJASS, and it will highlight it for you :)

About the autocompletion functionality, it works when you are writing code, just write part of the command and press CTRL+SPACE and a list box will appear. If you write more in the command, the list box updates automatically narrowing the functions which begin with the word that you are writing. To select the word, just press ENTER or make double click with the mouse. tell me if it works now.

About the autoindent.... no, it doesn't do that, it only remember the last indent done I'm afraid.