• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

A new TESH Syntax Highlighter for Warcraft 3

Level 23
Joined
Apr 16, 2012
Messages
4,041
yea, but working with old tesh for more than year now, Im really really used to, and I "optimized" myself for typing things like function onInit takes nothing returns nothing, which I can type very qucikly, and Im just used for full typing

also if I load a we without map pre-made and open trigger editor, the box doesnt appear very nicely :D(everything but the line that the caret is at is like not rendered)
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
yea, but working with old tesh for more than year now, Im really really used to, and I "optimized" myself for typing things like function onInit takes nothing returns nothing, which I can type very qucikly, and Im just used for full typing

Yes, breaking with old habits is sometimes difficult.

Talking only from my experience, it would be worth to give it try. When I started with programming back then there was no autocompletion at all (and hardly any highlighting), so I was used to type such things very quickly too. However, once one got used to it, the full usage autocomplete for everything just outperforms the full writing of terms.

But this is just my opinion, one of the next updates will make this configurable :)

also if I load a we without map pre-made and open trigger editor, the box doesnt appear very nicely :D(everything but the line that the caret is at is like not rendered)

Yes, redrawing with cross-process comunication is a nasty thing to handle (the old tesh had also various redrawing issues). I'm already working on this, but it may take some time.

Thanks for the feedback btw :)
 
Level 10
Joined
Sep 19, 2011
Messages
527
great job!

suggestion: characters like (, " and ' should close automatically. but careful, if user writes it again, it shouldn't add two character (ex: closing ", type again ", and i should get opening->"closing->", not """)

suggestion: blocks like if should close automatically, write a break line, add tabulation and close block.

example: i write if ( condition ) then hit enter, and a break line with a tabulation is added (and ofc endif).

suggestion: auto-block comments. if i type /** and hit enter, the next line should have the same amount of tabs and one more white-space. also, it should add * and another white space.

suggestion: auto-comments, if i type // and hit enter, the next line should have also // and one white-space.

suggestion: convert 4 spaces to 1 tab.
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
great job!

suggestion: characters like (, " and ' should close automatically. but careful, if user writes it again, it shouldn't add two character (ex: closing ", type again ", and i should get opening->"closing->", not """)

suggestion: blocks like if should close automatically, write a break line, add tabulation and close block.

example: i write if ( condition ) then hit enter, and a break line with a tabulation is added (and ofc endif).

suggestion: auto-block comments. if i type /** and hit enter, the next line should have the same amount of tabs and one more white-space. also, it should add * and another white space.

suggestion: auto-comments, if i type // and hit enter, the next line should have also // and one white-space.

but what if one wishes to type // enter but one doesnt one // on new line as well
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hi, thanks for your feedback :)

suggestion: characters like (, " and ' should close automatically. but careful, if user writes it again, it shouldn't add two character (ex: closing ", type again ", and i should get opening->"closing->", not """)

Well, at the moment you already get braces when you hit tab or enter with open autocomplete list. Maybe I will add that feature in some future release.

suggestion: blocks like if should close automatically, write a break line, add tabulation and close block.

example: i write if ( condition ) then hit enter, and a break line with a tabulation is added (and ofc endif).

That would be nice but is quite hard to do, because I guess you only want to autoaddd the endif if the if from which you were hitting enter was not already closed before. I guess before I have a dynamic parser, this is not possible, but I want that feature too. Maybe one day.

suggestion: auto-block comments. if i type /** and hit enter, the next line should have the same amount of tabs and one more white-space. also, it should add * and another white space.

suggestion: auto-comments, if i type // and hit enter, the next line should have also // and one white-space.

I dont really like that one to be honest, to create blank new line I have to type as much as someone, that would create new line with // in it

The problem with such stuff is, that it gets annyoying if it isn't behaving how you want it to. Maybe I will use ctrl-backspace to auto add the comments, while the normal backspace just creates a newline.

suggestion: convert 4 spaces to 1 tab.

Thats not always good... If you design an ascii art in your comment for example to have some basic visualisation, you don't want tabs but spaces. Also when copying code around, spaces are usually better than tabs. However it is faster to navigate through the code when having tabs.

So I guess I will make an option where you can configure that.
 
Level 10
Joined
Sep 19, 2011
Messages
527
That would be nice but is quite hard to do, because I guess you only want to autoaddd the endif if the if from which you were hitting enter was not already closed before. I guess before I have a dynamic parser, this is not possible, but I want that feature too. Maybe one day.

suggestion: auto-block comments. if i type /** and hit enter, the next line should have the same amount of tabs and one more white-space. also, it should add * and another white space.

suggestion: auto-comments, if i type // and hit enter, the next line should have also // and one white-space.

or only close/comment if you're pressing something like ctrl + enter.

So I guess I will make an option where you can configure that.

uhmm, or maybe when you enable the find/replace feature, the users could replace by themselves those characters.
 
Some more issues:

When you go to edit -> convert to custom text, the trigger window appears blank (until you select a different trigger and then select back). This disappearing issue also happens when you minimize the trigger editor and then unminimize it (while you have a JASS trigger in the window).
TESH0.png

Make a GUI trigger. Go to edit -> convert to custom text. Press OK. Click anywhere in the code. Then press the "Back"/Undo button in the trigger editor, and then it will still attempt to display the underlying code above the GUI trigger (until you select a different trigger and select back):
TESH1.png

I hope these won't be too difficult to fix. :)
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Make a GUI trigger. Go to edit -> convert to custom text. Press OK. Click anywhere in the code. Then press the "Back"/Undo button in the trigger editor, and then it will still attempt to display the underlying code above the GUI trigger (until you select a different trigger and select back):
View attachment 131848

Ups, nice find. I thought I fixed that problem already, but I forgot the undo function of the editor...

Thx for the feedback, I will update ASAP.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
How close is this to a stable release ^^ ?

Well, it is stable in the sense that it doesn't crash or something like this ;)

It's an Alpha, so there are still some small bugs, especially with the redrawing of the window. The next patch will hopefully fix all those issues, so to answer your question: quite close I think ;)


If I read right, this has autocomplete for user-defined functions and methods?

No, where did you read that? :D
It is planned to implement that feature in a future release though. Until now it just has several new features which, compared to the old tesh, make coding easier like:

- Full Autocomplete list with all existing keywords
- Autocomplete icons
- Autocomplete and calltips at the same time
- Nested calltips
- CTRL-Space hotkey for forcing autocompletion
- Context sensitive autocomplete in comments and strings
- Listing of attachment points in strings
- Autobraces
- Symetric brace highlighting
- And some more...
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
All the features will be flags right? So we can turn some off if we don't feel the need for them?

At the moment not, but thats because the Options dialog isn't finished yet. Once it is done you will be able to turn off some of the features.

There was a few annoying things with the TESH so I will wait a few more updates before I re-apply the tesh2.0 to my jngp

Where those things already posted in this thread or did you find new bugs/issues?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Besides eventually having autocomplete for user-defined functions, will this also highlight user defined types/structs/functions in some color (like the one in JNPG highlights natives in purple, variable types in blue)?
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Yes, that is planned at least. You can have a look at it by typing System in the trigger editor, it will get highlighted like user structs will get highlighted in the future (it is a left-over in the current version).

However, the priority for now is to provide all features from the old tesh and fix the remaining bugs. The next patch should be finished within the next weeks, so stay tuned ;)
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hi,

I'm very happy to finally declare the redrawing problem as solved. It was really hard to fix it but now the latest version of the new TESH should provide perfect redrawing behavior, much better than the old TESH.

While the old TESH has many redrawing issues when you try to resize the Trigger Editor Window (Resizing via the borders, maximizing, attaching to one half of the screen), these issues are now completly fixed:

ed1z.png



But thats not everything, this update also increases the performance of the new TESH dramatically, making it even faster than the old TESH. You can now select 1000 lines and hit tab to shift them by one indentation - on the old TESH this can take several seconds while now it happens instantaneous.

But there are also some new features. When forcing the autocomplete list inside of a string, not only attachment points but also order strings and animation strings get listed and completed. To make them better differentiable, new icons for the string-autocomplete list were introduced:

sag0.png


Also the same principle is now consequently applied to chars, which means that you can open the following list by hitting CTRL-Space inside a char:

lxso.png



Finally, a lot of bugs and problems were fixed:


Update to version 0.4
- Fixed all redrawing issues on moving and resizing
- Dramatically improved performance
- Added order strings and animation strings to the string-autocomplete list
- Introduced the char-autocomplete list which contains abilities, destructables, items, units, heros and techs
- Added new icons to the string-autocomplete list
- The warning when converting a GUI trigger to Jass is now supressed
- Escaped " inside a string like "test \" test" get now highlighted correctly
- Fixed a bug that could make the trigger and the GUI window overlap if the undo-button was pressed
- Fixed a bug that the calltip list stayed active although the caret was outside of a valid calltip position
- Added the DEBUG_MODE keyword to both the highlighter as well as to the autocomplete list
- Fold All button works now
- Added some tabs to the output of the Load Template button
- Fixed a bug that is also present in the old TESH namely that braces don't get highlighted when moving the indentation backwards using SHIFT-TAB
 
Level 17
Joined
Jul 17, 2011
Messages
1,864
why does it say "use at your own risk"? oO this wont crash my system will it D: well anyways this is rly nice and it works with jnpg 2.0 but it rly needs the function list ^^
also it would be super cool if you could make a struct list, struct member list, auto indent and it would be uber cool if you can get a list of the structs from say an imported library :D
 
Last edited:
Level 14
Joined
Dec 12, 2012
Messages
1,007
why does it say "use at your own risk"? oO this wont crash my system will it D:

Lol no, it won't :D

This is just to point out that it is still in Alpha status and that there might be some small bugs. But it won't crash or something like this. The last patch fixed many bugs and it should work quite good now.

well anyways this is rly nice and it works with jnpg 2.0 but it rly needs the function list ^^

Thx, I'm already working on the function list and I'm optimistic that the next patch will bring it back.
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
Lol no, it won't :D

This is just to point out that it is still in Alpha status and that there might be some small bugs. But it won't crash or something like this. The last patch fixed many bugs and it should work quite good now.

Don't listen to him, it's full of trojans and keyloggers, your PayPal accounts are not safe! (/jk)

Anyways, it's nice to see the annoying bugs being fixed, great job! If you manage to put together a global list (function/struct/methods from every trigger), this is gonna be an awesome tool (not that it wasn't awesome already)
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Don't listen to him, it's full of trojans and keyloggers, your PayPal accounts are not safe! (/jk)

Unfortunatly Wc3 mappers are poor, so it wasn't worth the effort :p

Anyways, it's nice to see the annoying bugs being fixed, great job! If you manage to put together a global list (function/struct/methods from every trigger), this is gonna be an awesome tool (not that it wasn't awesome already)

Thanks :)

Right now I'm working on a method to keep the folding state when switching triggers, because thats one of the things that makes folding nearly useless in the old tesh. But before that I will do the function list, as thats the "most-wanted" at the moment.
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
One thing I forgot to ask: I never really chacked where the features come from, but I assume that the search/replace functions are part of TESH too. So, will there be a way to change their hotkeys? I'm Hungarian, and with the appropriate keyboard settings trying to type a "[" will always pop up the search window, which is really damn annoying, as the only way to get around this is by CnP'ing that darn character.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
One thing I forgot to ask: I never really chacked where the features come from, but I assume that the search/replace functions are part of TESH too. So, will there be a way to change their hotkeys? I'm Hungarian, and with the appropriate keyboard settings trying to type a "[" will always pop up the search window, which is really damn annoying, as the only way to get around this is by CnP'ing that darn character.

Are you serious? Didn't know that, that sounds horrible :D

Yes, the search/replace function is also part of the TESH. At the moment I have registered the hotkeys CTRL-F and CTRL-H for the search/replace function. So although the feature is not yet implemented, you will get a message box that says "Feature is not yet implemented".

Does this message box pop up when you type a "[" ? Because if not then there also won't be any problems once the feature is implemented.
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
Does this message box pop up when you type a "[" ? Because if not then there also won't be any problems once the feature is implemented.

"[" is AltGr + F, which is equal to Ctrl + Alt + F, as AltGr is essentially just Ctrl + Alt. So I'm pretty sure this explains why it behaves like that :) And yea, it IS horrible - I wrote like a hundred thousands of lines for IID, with this annoying "bug", and there were times when it really pissed me off.

Most international editors that come in English have something registered to Ctrl+F too, and the first thing we do after installing them is change them/turn them off.
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
Hmm, I just gave it a try, and it seems to work properly. Cool :)

Well, that's the only combination that was buggy, or at least I do no recall seeing another one.

Will folding also support Zinc, BTW? I imagine it wouldn't take much, but would be quite useful for us, the Zinc users (well, okay, I'm not sure if I should call myself a "user" as I very rarely open up the world editor nowadays, but that's why I use Zinc when I do, I don't like the slow, pascalish syntax, I prefer the C one, that I'm used to).
 
Hmm, I just gave it a try, and it seems to work properly. Cool :)

Well, that's the only combination that was buggy, or at least I do no recall seeing another one.

Will folding also support Zinc, BTW? I imagine it wouldn't take much, but would be quite useful for us, the Zinc users.

Would be better to just fold//!so it supports all preprocessor features.

Unless you meant that folding doesn't work for Zinc syntax?
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
No, I don't mean it should support the "//! zinc" statement, but rather, the curly brackets. At the moment it doesn't really seem to care about them, it just looks for function/endfunction (and that's why it's buggy, because it doesn't check where it is in the line - but I'm kinda sure it's more like there to check the visuals on the left side, and not really for the functionality)

But of course it could/should "//!" statements too, that's also useful.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hmm, I just gave it a try, and it seems to work properly. Cool :)

Ok, thats great. Don't know why it happens at the old TESH, but one more good reason to switch.

Will folding also support Zinc, BTW?

Tbh I'm still not sure what to do with Zinc. Adding dynamic (!) folding support for both vJass and Zinc that works 100% reliable and has a good performance is a huge amount of work.

Maybe it could be done statically by switching manually between vJass and Zinc "Mode", buth then it would only work for either vJass or Zinc.

Don't know, this is quite a complex topic.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
is the folding all that important for Zinc? or is it that hard to implement? you know you could fold after function() keyword all the way to coresponding }, Imo I used folding a few times in vJass, never in Zinc, but I barely use zinc at all
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
Tbh I'm still not sure what to do with Zinc. Adding dynamic (!) folding support for both vJass and Zinc that works 100% reliable and has a good performance is a huge amount of work.

Maybe it could be done statically by switching manually between vJass and Zinc "Mode", buth then it would only work for either vJass or Zinc.

Don't know, this is quite a complex topic.

Well, Zinc functions and methods also start with the function/method keywords, so something needs to be done about them anyways.

Maybe making it so that triggers starting with the "//! zinc" statement are treated as zinc triggers, and others as vJASS could work - I don't see a point in mixing zinc/vJASS, so it might not be that bad of a solution.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I wonder if you parse the file when you make the folding available, because if you do, you could write a zinc folder which basically folds from function() line all the way to corresponding } (as mentioned before) and only does so in within //! zinc //! endzinc block
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
The trigger must be scanned once when you click on it, that's true. However, it can change dynamically, and keeping track of the zinc blocks and changing folding style according to them is a lot of work, as he already said. Especially since the difference between vJASS and zinc is not just a braces, but also:

- modules are also imported with the "module" keyword, so when used for importing, there's no need for folding;
- blocks in if-else statements are completely optional, so it might not need folding either;
- we also have for loops;
- we have anonymous functions too.

So yea, it needs a lot of extra things, and it's propably too much work for a few people - propably not worth the effort.
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
It would be interesting to know how many people actually use Zinc, because I hardly ever see any Zinc resources

That's most likely because with Zinc modules you can't do as fked up things as making half-implemented methods, for example. But overall, I think it's really underused, even though it's more powerful than plain vJASS (or at least faster to work with, and more convenient if you're used to Java/C).

What I suggested above, or simply folding curly bracket blocks should be enough for the most part, and it should do for a while.

Finishing the menu elements and vJASS folding seems much more important though :'D At first I naively thought parsing {} blocks is 100% enough, but after thinking it through, heck no.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hi,

I expect the next update to be released within the next days (probably the upcoming weekend). The update will definitly contain a completly new folding logic, reworked everything from the scratch. The old tesh has a lot flaws and bugs with folding (even with the HORUS update) which will be fixed with the next update. Also saving scroll position and folding state when switching a trigger will be supported, without causing the document to unsafe.

The function list however will still not be finished with the next update, because its more work than I thought. Especially the attaching functionality from the old tesh (attaching the function list window to the trigger editor window) is quite tricky. It was also quite buggy in the old tesh but I want to solve it reliable and this will take some more time.

However I'm confident that instead the Search/Replace functionality will find its way back with this update as it is also nearly finished.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
New update available.

This update adresses the Search and Replace functionality of the TESH as well as the folding functionality. Furthermore, various bugs were fixed with this update.

First of all, the new Search and Replace window works more compliant than the one from the old TESH as it allows the user to still select text from the trigger editor window. Also it shows no directly the line number were a search match occured. Finally the Replace-All functionality works much faster for many items than in the old TESH. Also the Search Window stays now open when performing a Search, making its behavior more like the Windows standard.

k45r.png


Furthermore this update provides a new lexer with full folding support of the vJass syntax. Several problems of the old TESH got fixed too, especially missing keywords or wrong fold header detections. Especially the debug statement or static ifs broke the folding of the old TESH completly, while now all keyword combinations that are potentially correct (and only those!) create a fold header. With that even on such crazy things like

debug private static stub constant method operator omg takes nothing returns integer

get their fold header correctly, as they are potentially valid vJass syntax. Also missing preprocessor keywords like inject were added and get fold headers now.

But not enough, both the scroll position (horizontal and vertical) as well as all folding states of a current trigger page are maintained throughout a session without modifying the document. So you can switch now between triggers and your folded functions will stay folded when switching back.

xcwj.png



Update to Version 0.5
- Added full folding support
- Added correct folding also on static ifs, stub methods and the debug keyword
- Added correct folding also on previous missing preproccesor keywords like inject
- Added full Search and Replace functionality
- Text can now be copied with the Search-Window open
- The Search and Replace window now stays open when performing searches
- The line of the found entry is now also displayed
- Search and Replace history now stores much more entries than the old tesh
- Drastically faster Replace-All functionality than the old tesh
- Fixed several bugs with the calltip window
- Fixed a bug that made the char autocomplete list jump
- Fixed a bug that made the autocomplete list apear outside the screen
- Fixed a bug with nested calltips of the same function
- Removed some wrong entries from the autocomplete list
- Removed some empty entries from the string autocomplete list
- Removed the warning on the load template button
- Added the main keyword to the autocomplete list
- Added the import keyword to the autocomplete list
- Added the library_once keyword to the autocomplete list and the highlighter
- Added highlighting for hex numbers
- Horizontal and Vertical scroll position are now maintained when switching a trigger
- Folding state is also maintained when switching between triggers
- Deleting a fold-flag now automatically expands it if it was folded before
- CTRL-SPACE scrolls now automatically into view if the caret was outside the screen
- Fixed several bugs with the autocomplete list at the end of the document
- Typing now triggers both the autocomplete list and the calltip list, if available
- Holding/releasing CTRL now directly activates /deactivates hotspots without having to move the mouse
- Changed the colors of fold headers to something less eye cancer-causing
- Slightly improved performance
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
Woot! Downloading now, will let you know if there are any problems.

Edit: It's not working. When I press edit -> convert to custom text on a trigger, the trigger functions area no longer has a textarea. If I change triggers and come back, the problem is not resolved. Opening a map with existing jass triggers also does not work.
 
Last edited:

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
I tested it twice yesterday and it didn't work. Just tested it twice now and it worked both times... I have no idea why that could be.

Also, I found a bug (now that it's working)

If you have the trigger editor open and close the (one) map, the trigger list goes away but the textarea remains with the trigger code
 
Top