• 🏆 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

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
Hm and if you put back the old tesh.dll in exactly the same folder it does work?

Yep, I just put tesh.bak folder -> tesh and remove your version and it works again as before.

Do you maybe have multiple versions of newgen installed?

I'm not sure, but does it matter? I for sure only have one version of newgen within my wc3 folder.

If not could you try to start the WE with the NewGen WE.exe directly (should be one folder-level below the tesh.dll)?

Yes, I tried this as well as we.bat. No go.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hm, then I'm not sure what could cause that problem...

I'm not sure, but does it matter? I for sure only have one version of newgen within my wc3 folder.

It should not matter, however as the dll is not loaded at all it seems to be some newgen problem... I will build in some more error checking just to be sure and upload it then :(
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
LOL. your dll search is fucked up.
it searches even further away now xD
C\users\myusername\downloads\imports\model\tesh\SciLexer.dll
seems legit

as I get it.
When I want to open a map it looks for the DLL whereever I try to open a map. So if I last opened a map at my desktop it will look at desktop\tesh\name.dll
I am almost sure this is the issue

this is when I click the import manager,
zur1c3.png

and thats the path of my last imported skin

and this is when I tried to open a map
332p7p5.png

the path of my latest opened map
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
I'm sad, it doesn't work as installation says. I'm in Windows 7 shitty...., I mean, starter edition. Obviously 32 bits.

I'm pretty sure I have .net because it's windows 7. Installing in JNGP 2.0.6

Do you get any error messages? If yes, which?

moyack, do you see vanilla jass editor with no warnings? that's what I get. Windows 7 x64 jngp5d

Just to be sure, you installed the Redist Packages for x86, right?
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Feedback: Can you make it so that after I type an entire term like endfunction or loop, pressing enter will make a line break instead of closing the autocomplete list.

I hope that makes sense

You mean when you finished the word already and then press enter? Yes, I can add that with the next update, thats actually a good idea.

This is great!
Can you open the source code?

Thanks :)
I will open the source code, but not yet because without a proper documentation its not really usable. But I will publish it once I finished the static part.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
You mean when you finished the word already and then press enter?

Right, maybe just close the list whenever a term is finished, because there are other annoying things for example loop then press up arrow

Also, another suggestion:

The old tesh suppressed this warning:

qvbjsja.png


can you do the same?
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Right, maybe just close the list whenever a term is finished, because there are other annoying things for example loop then press up arrow

Hm, I don't understand... what do you mean with "loop then press up arrow"? If I have loop selected and press up arrow it selects the entry above it, why is that annoying?

Also, another suggestion:

The old tesh suppressed this warning:

can you do the same?

Thx, added to my Todo list.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
Hm, I don't understand... what do you mean with "loop then press up arrow"? If I have loop selected and press up arrow it selects the entry above it, why is that annoying?

if you type loop, you've finished writing the term, but the term list doesn't go away, so pressing up arrow goes to LockGuardPosition when I really just want to go up one line. It's sort of the same problem as needing to press enter twice. Hope that makes sense.

Last thing for now:

YKAFVE9.png


local unit FogEnable() doesn't make any sense. In fact, the only thing expected after local unit is a variable name, so maybe hide the list depending on the lexer
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
if you type loop, you've finished writing the term, but the term list doesn't go away, so pressing up arrow goes to LockGuardPosition when I really just want to go up one line.

Well that won't be so easy. Not because its technically difficult to implement (actually its trivial), but because of the logic behind it.

Lets say you want the autocomplete list to close if you entered a term completly by hand, for example Player. Of course I could close the list now, because Player is a full term, but maybe the user meant PlayerGetLeaderboard?

The list could of course kept open until there is no further extension available, but then the list will in most cases only auto-close on very long keywords, because for example for UnitAddItem there still exists the extension UnitAddItemByIdSwapped, so it wouldn't auto-close on that one as the parser can't know which one you want.

It's sort of the same problem as needing to press enter twice. Hope that makes sense.

Well in most cases that can be avoided like loop = l - o - o - tab - enter equals five keystrokes, while typing it normal would be l - o - o - p - enter which are also five keystrokes.

I see your point, but it is hard to think of a universal solution. I guess I will just implement different autocomplete policies so that the user can choose the one he likes most.

local unit FogEnable() doesn't make any sense. In fact, the only thing expected after local unit is a variable name, so maybe hide the list depending on the lexer

Well, thats out of scope for now because that would require a dynamic parser. For now I will only focus on the static part until it works flawless. The old TESH behaves equally here, so its no deficit compared to it.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
Well that won't be so easy. Not because its technically difficult to implement (actually its trivial), but because of the logic behind it.

Lets say you want the autocomplete list to close if you entered a term completly by hand, for example Player. Of course I could close the list now, because Player is a full term, but maybe the user meant PlayerGetLeaderboard?

The list could of course kept open until there is no further extension available, but then the list will in most cases only auto-close on very long keywords, because for example for UnitAddItem there still exists the extension UnitAddItemByIdSwapped, so it wouldn't auto-close on that one as the parser can't know which one you want.

There are lots of keywords typed much more often than Player that this will help for - loop for example.

Well in most cases that can be avoided like loop = l - o - o - tab - enter equals five keystrokes, while typing it normal would be l - o - o - p - enter which are also five keystrokes.

I see your point, but it is hard to think of a universal solution. I guess I will just implement different autocomplete policies so that the user can choose the one he likes most.

It's not about the number of keystrokes, its about ease of use and comfort I'll absolutely never type l o o tab over l o o p - one of those is a word and one of them is a hack.

Well, thats out of scope for now because that would require a dynamic parser. For now I will only focus on the static part until it works flawless. The old TESH behaves equally here, so its no deficit compared to it.

Actually, the old tesh was case sensitive and at least closed the list if I typed FoG.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
There are lots of keywords typed much more often than Player that this will help for - loop for example.

Yes, I may make this optionally configurable. The problem with this is how do you decide to close the list? The behaviour should be somehow consistent for all keywords.


It's not about the number of keystrokes, its about ease of use and comfort I'll absolutely never type l o o tab over l o o p - one of those is a word and one of them is a hack.

Why a hack? Thats actually how all modern IDEs behave, typing "for" in Visual Studio is exactly the same thing.


Actually, the old tesh was case sensitive and at least closed the list if I typed FoG.

That's not true. The old tesh can't be context sensitive. I know its source code, it has no dynamic parser. Just tried it, FoG just opens the list independent of the caret position.


EDIT:

I think the best is to make such things configurable by the user. Possible options would be:

  • Keep the behaviour as it is now, because thats more or less a standardized behaviour.
  • Remove operator keywords like loop from the autocomplete list. If this is a benefit is questionable, because right now you safe a lot time during coding due to the operators beeing available in the list. Actually the list behaves like the old TESH, just that you have more keywords listed there and that it gets triggered earlier.
  • Disable the autocomplete list and only let it show up if you hit CTRL-SPACE.
  • Add a newline on enter if the keyword was fully writen out by hand.

Those are the ones I can think of. With those, there should be an option for everyone.
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
That's not what i'm saying, i mean the autocompletion should care about the case sensitivity of what the user has written.
Just as an example if i type 'tr' it shouldn't provide me Tr... suggestions, in the first post it shouldn't pop up any Get, since it's "get", and so one.
And for me that makes sense since jass is case sensitive anyway.

To be clear, i have not tested it at all, just seen screenshots. And when you will implement dynamic completion (such as with variables) it should be an improvement, a natural filter.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Oh you mean this, I see.

Well at the moment it is searching for the best match. If you type "un" it selects "unit", if you type "Un" it selects "UnitAddAbility". Thats btw just like the old tesh works if you turn case-sensivity off.

But this will be configurable within the options menu in the future, just like in the old tesh.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
Why a hack? Thats actually how all modern IDEs behave, typing "for" in Visual Studio is exactly the same thing.

I apologize, I realize hack makes it sound negative.

If you want to talk about modern IDEs, let's take a look and talk about some semantics as well.

For what it's worth, python is similar to jass for a few reasons - they both have a lot of short keywords, JASS has loop, exitwhen; python has for, in; They both have not - etc.

I'm using pydev in this example:

Let's say I have a method called forgery and below it I want to type a for loop:

TQzGd66.png


The autocomplete list doesn't pop up automatically because it reacts to character sequences and breaks the flow of writing in some cases. "fo" is a very short sequence and little useful data can be derived by the lexer - so it gives me nothing until I press cntrl+space:

OenhUZB.png


When it does, for is the default option because keywords are displayed first - but forgery is there as well. This is highly unobtrusive because nothing popped up and suggested forgery - with your parser, typing for and hitting space would put forgery! (assuming forgery was a native)

But what if I type the full keyword for? - It makes no suggestion at all, and if I cntrl+space now, it recognizes that for is not what I want and suggests For (class):

oxYQwEP.png


Indeed, this built in class is comparable to a jass native.

Let's switch gears and look at android development in Eclipse. Android has a Log class which is used for logging messages. Say we have a method called Logarithm, but we want to use Log.w():

SsYLvn5.jpg


Once again, Lo is too ambiguous to show any useful suggestions so the autocomplete list doesn't pop up until I hit cntrl+space:

abZ9pID.png


I hope this all makes sense. Perhaps we should take away from this that the autocomplete list should simply not *always* pop up by default.

That's not true. The old tesh can't be context sensitive. I know its source code, it has no dynamic parser. Just tried it, FoG just opens the list independent of the caret position.

It's an option in my tesh... And I'm pretty sure every sane person uses the case-sensitive version:

SGfZvT4.png


3ASNJlz.png


1TDWZRs.png


Keep the behaviour as it is now, because thats more or less a standardized behaviour.

I disagree. It's not the standard behavior (it's not even the standard behavior of the old tesh)

Remove operator keywords like loop from the autocomplete list. If this is a benefit is questionable, because right now you safe a lot time during coding due to the operators beeing available in the list. Actually the list behaves like the old TESH, just that you have more keywords listed there and that it gets triggered earlier.

I disagree. Having these keywords in the list are helpful for beginners - but only show the list if people use cntrl+space

Disable the autocomplete list and only let it show up if you hit CTRL-SPACE.

It should at least show up in some cases - after typing a certain number of characters for example.

Add a newline on enter if the keyword was fully writen out by hand.

All non-alphanumeric character pressed should have this behaviour. Up/down arrows, home, end keys, enter, space, etc.

Thats btw just like the old tesh works if you turn case-sensivity off.

How do you know? The old TESH didn't autocomplete types like unit...
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Ok, I'm a little short on time now, so we will most likely not finish this discussion now, but let me answer some of your points.

I hope this all makes sense. Perhaps we should take away from this that the autocomplete list should simply not *always* pop up by default.

Well, that certainly makes sense and is quite easy to realize. I will just add the possibility in the options menu that you can specify after how many chars the autocomplete list should popup. Because all in all, there is no absolute "correct" way to do this, because it depends on subjective preferences.

I for example like the VS 2013 style, where the list pops up on every single char, but if you can configure it (so you would take for example the option "don't pop-up before 4 chars or if I hit CTRL-Space"), everybody should be happy.

It's an option in my tesh... And I'm pretty sure every sane person uses the case-sensitive version:

Yes, but I thought you were talking about not showing the list if the previous keyword was a type, but I think I misunderstood you. Sorry if so. Btw I prefer the case-insensitive version :D


I disagree. It's not the standard behavior (it's not even the standard behavior of the old tesh)

Well, the selection of keywords is the same (if you turn case-sensitivity off). I thought everybody uses the case-insensitive option, why should I have to press more keys than neccessary? But again there is no right or wrong, so lets make it configurable.

I disagree. Having these keywords in the list are helpful for beginners - but only show the list if people use cntrl+space

-> Configurable.


All non-alphanumeric character pressed should have this behaviour. Up/down arrows, home, end keys, enter, space, etc.

Well, usually you use the arrow keys to navigate through the list... At least its like that in every IDE I used so far (including JassHelper).
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
@LFH I typed a long response to you and submitted it but it disappeared... I'll try and re-write it:

Well, the selection of keywords is the same (if you turn case-sensitivity off). I thought everybody uses the case-insensitive option, why should I have to press more keys than neccessary? But again there is no right or wrong, so lets make it configurable.

To summarize my previous post, jass uses a lot of keywords that are actual words like loop and exitwhen - these things can be typed really fast because fast typists type words rather than characters. I can type exitwhen true much faster than i can type exitw enter tru enter

Well, usually you use the arrow keys to navigate through the list... At least its like that in every IDE I used so far (including JassHelper).

What about the case where you type:

JASS:
(empty line)
private function i takes nothing returns nothing
(empty line)

after typing nothing, down arrow changes nothing to NOT_EQUAL - but I just want to go down.

@moyack: Download the redist package - http://www.microsoft.com/en-us/download/details.aspx?id=40784 fixed it for me
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Still not working, this app requires a specific .net framework??

Hi, did you install the x86 version of the Redistributable Packages for Visual Studio 2013? You need the x86 one, even if you have a 64 bit Windows.

To summarize my previous post, jass uses a lot of keywords that are actual words like loop and exitwhen - these things can be typed really fast because fast typists type words rather than characters. I can type exitwhen true much faster than i can type exitw enter tru enter

after typing nothing, down arrow changes nothing to NOT_EQUAL - but I just want to go down.

Ok, the question is basically how do you want it to behave now? I mean exitwhen or nothing are already quite long, so if you don't want the autocomplete list pop up / use for them, when should it pop up at all? Because down arrow is for navigating through the list.

Or do you simply want the list to close when you typed nothing? Again, I can do this, but for things like Player this approach can't work. If thats ok for you, no problem I will make it an option. Or you remove operators and types from the list, because the old TESH has exactly the same behaviour for this case: Once you finished a keyword completly and press Enter you don't get a newline. Or if you press up key you navigate through the list. Its just you don't notice it, because it doesn't list operators and types.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
Or do you simply want the list to close when you typed nothing? Again, I can do this, but for things like Player this approach can't work.

That's fine, I just want the list to go away when I finish writing the term.

I'd like it to go away after Player, and only show PlayerGetLeaderBoard if I type PlayerG - but that's extra. The main thing is the keywords like exitwhen and loop. No I don't want keywords removed from the list because that's useful for beginners.

Another suggestion:

If I type UnitAddAb and hit enter or tab, maybe go to this:

UnitAddAbility(<carat>)

instead of this:

UnitAddAbility<carat>

Looking forward to the next update
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
That's fine, I just want the list to go away when I finish writing the term.

I'd like it to go away after Player, and only show PlayerGetLeaderBoard if I type PlayerG - but that's extra.

Alright, now I see. Yes, thats no problem, I will make that optional.

The main thing is the keywords like exitwhen and loop. No I don't want keywords removed from the list because that's useful for beginners.

Yes, I didn't meant to remove them, this will be only optionally. The autocomplete list will basically stay like it is now, but you will be able to configure it based on your likes.

Another suggestion:

If I type UnitAddAb and hit enter or tab, maybe go to this:

Hm yes, good idea.

Thanks for all those suggestions and discussion, I really appreciate your input :)
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
New update available. All installation issues should be fixed with this update, as all required runtime functions are now directly included to the tesh.dll. I also liked the suggestion by coke to auto-add braces when accepting a function from the autocomplete list, so I also added this feature (as well as some others). This works now like this:

6l7s.png


But even better, the algorithm also detects whether the function takes zero arguments (= nothing). If so, the caret is moved one position further, so that one can directly proceed with writing.


Update to Version 0.3

- All required runtime functions are npow included to the tesh.dll, so installation issues should be fixed now forever.
- Added all missing hotkeys like CTRL-F9 for testing the map
- Fixed a bug with CTRL-S that could cause the Editor to freeze
- Fixed a bug that made the autocomplete list disapear at the AbilityId2String keyword
- Removed some debug things like showing the type list when entering a dot
- Fixed a bug that could cause some delay when focusing the editor
- CTRL-SPACE now not only triggers the autocomplete list but also the calltip list, if there are calltips available
- Moving the caret with the left or right arrow keys now also updates the calltiplist, if it is active
- Accepting an entry from the autocomplete list now automatically adds braces to the keyword, if it was a function
- Added a filter for the //TESH.scrollpos=85 thing of the old tesh
 
Last edited:
Level 14
Joined
Dec 12, 2012
Messages
1,007
EDIT: It appears that it doesn't handle quote escape characters properly, e.g.:
JASS:
call BJDebugMsg("The cat says \"Hello World!\" to all of his friends.")

Ups, nice find. Will fix this in the next version.

Been using version 0.3 for a few hours now and haven't had any issues.

That is good to hear :)


Another suggestion though:

Hm, quite exotic behaviour but I will see what I can do.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
maybe aready suggeated, but it would be cool to make enter write new line after types, because it really got really annoying really quickly havong to press enter 2 timed while declaring function(function a takes nothin returns nothing)

The same applies for endfunction I think
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
Yes coke suggested that already and it will be configurable in the future.

However I have to say I wounder that this is a problem for some people as especially declaring a function like from your example works much faster with the current setting. I mean you just have to press:

fu tab space a space t tab space noth tab space ret tab s space noth tab

which are 26 keystrokes, while typing out the whole thing like in the old tesh takes 41 keystrokes. So even if you are used to writing out everything, the first method should be much faster as I think this is just a matter of getting used to it.

But if you really don't like it that way, it is already on my list and I will make it configurable in the future so you can choose the option you like most.
 
Top