Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Lexer and Folding For N++ (Finally!) - [Deprecated]


  • Please log in to reply
133 replies to this topic
flashkid
  • Members
  • 115 posts
  • Last active: Apr 12 2013 06:33 PM
  • Joined: 25 Aug 2007
Hi RaptorX ;)

I haven't been working very much with AHK in the last months, so I haven't looked further for a good solution.
I remember discussion on the SourceForge forum of NP++ about the lexer with you and love how great it is now :)

I have downloaded it a few minutes ago and I really like it. Now I'll try to get it working nicely with a dark layout. Thank you so much.

Greetings, flashkid

EDIT: Ok, looks great now. I've got a question: Is it supposed that the highlighting of a variable looks like
[color=brown]MsgBox %[/color][color=cyan]variable[/color][color=brown]%[/color]
and not like
[color=brown]MsgBox[/color] [color=cyan] %variable%[/color]

EDIT 2: I think It's the same as questioned before in the thread

I would recommend including [] as a SYNOPERATOR. Also, it would be nice if % wasn't grouped with the other SYNOPERATORs. IMO, it would be nice to have this colored the same as the variables, but different than the other SYNOPERATORS - like autoit variables. Plus, it would be nice if a single % was highlighted for forced expressions.

I hope this will be achieved some day :)

EDIT 3:

Since, this is going to be rewritten, could you add syntax highlighting for AutoHotkey_L? (#If, Until, etc)
I'm sure you saw the announcement that Chris is moving on, and since AutoHotkey_L is going to be the maintained version now, it seems like the syntax highlighting should support all of the new commands/directives.

I think the most of AHK_L syntax changes could be implemented in the AHKExternalLexer.xml in plugins\Config\AHKExternalLexer.xml folder. Adding things like Until and #If should work there, too, but I haven't tried it yet. I'm also moving to AHK_L, so maybe I will change the xml by myself when I'm working on a larger project again ;)

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
--
double posted
--

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010

EDIT: Ok, looks great now. I've got a question: Is it supposed that the highlighting of a variable looks like

[color=brown]MsgBox %[/color][color=cyan]variable[/color][color=brown]%[/color]
and not like
[color=brown]MsgBox[/color] [color=cyan] %variable%[/color]

EDIT 2: I think It's the same as questioned before in the thread

I would recommend including [] as a SYNOPERATOR. Also, it would be nice if % wasn't grouped with the other SYNOPERATORs. IMO, it would be nice to have this colored the same as the variables, but different than the other SYNOPERATORS - like autoit variables. Plus, it would be nice if a single % was highlighted for forced expressions.

I hope this will be achieved some day :)


Thats the way it is configured at the moment, I personally like to have the % colored diferent than variables, and as the original lexer had it grouped with syn operators i just left it that way.

I am not sure why you guys want it out of the group since the syn operators are simply:

{} curly braces
[] normal braces
() parentheses

I just followed the logic that everything that enclosed code was part of the syn operators thats the reason i left

%%

the other syn operators are:

+=
-=
*=
/=
:=

All those have the same color that can be changed from the "style configurator". I personally dont feel any need to change it but if is bothering i will try later on.

At the moment I am learning C++ which thanks to ahk is going quite smoothly, probably i will be able to create my own lexer from scratch, again no time promise since i am not a C++ coder yet. :)

I do think making the % to be highlighted on expressions is doable, i will give it a try.

EDIT 3:

Since, this is going to be rewritten, could you add syntax highlighting for AutoHotkey_L? (#If, Until, etc)
I'm sure you saw the announcement that Chris is moving on, and since AutoHotkey_L is going to be the maintained version now, it seems like the syntax highlighting should support all of the new commands/directives.

I think the most of AHK_L syntax changes could be implemented in the AHKExternalLexer.xml in plugins\Config\AHKExternalLexer.xml folder. Adding things like Until and #If should work there, too, but I haven't tried it yet. I'm also moving to AHK_L, so maybe I will change the xml by myself when I'm working on a larger project again ;)


That is correct. You can use the "style configurator" section to add keywords to whatever key list you want... #if would belong to the directives, but do not include the #

Posted Image

You can also edit the xml file directly but that is not recommended since the names there might differ a little, ex. instead of "directives" you will find that the xml file says "<Keywords name="3">" which is meaningless... so again go for it on the styler configurator, is easier.[/img]

flashkid
  • Members
  • 115 posts
  • Last active: Apr 12 2013 06:33 PM
  • Joined: 25 Aug 2007
I've worked on a bigger project the last few days and must say, that the folding bug really annoys me.
It's not the problem to hit alt+0 and alt+shift+0, the problem with this is, that I'm not on my currently editing line anymore, but anywhere in the script.
This is so annoying.

It would be great if you could look further into it ;)

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
update:

Bad news:
The new version of N++ breaks the lexer completely and even the work around that i posted will have issues (the folding is completely broken)

Good news:
I am feeling more comfortable with C++ to the point that I am confident that soon I will be writing my own External Lexer DLL in C++ which will have most of the problems fixed.

At the moment im held up with learning the SciLexer.dll functions which I am going to use in my main project: AutoHotkey Toolkit, and after I am fully confident on how to use SciLexer then I will proceed with the C++ Lexer.

I am sorry that this is taking so long but take in consideration that no c/c++ programmer wanted to help me so Im learning from 0.

You can still use the work around i posted if you dont mind much the folding issue.

Thanks for your patience guys.
AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

OpalMonkey
  • Members
  • 29 posts
  • Last active: Aug 07 2015 08:21 AM
  • Joined: 26 Sep 2009
Thanks for the update RaptorX!

Looks like it's nothing but good news for me, since folding still works (as much as it ever did) on Notepad++ 5.8.5 Unicode, using your workaround.

Good job on learning C++. I still find it strange that no C++ programmers wanted to help with this. Lucky for everyone using it, that didn't stop you.

I now eagerly await the new lexer!

flashkid
  • Members
  • 115 posts
  • Last active: Apr 12 2013 06:33 PM
  • Joined: 25 Aug 2007
Folding works for me in 5.8.5U, too.
Nevertheless I'm looking forward to your own Plugin, I hope this will fix all the folding issues ;)

OpalMonkey
  • Members
  • 29 posts
  • Last active: Aug 07 2015 08:21 AM
  • Joined: 26 Sep 2009
I was working on a new AHK_L project the last couple of days and it made me curious if there was any news concerning your revised lexer, RaptorX? So, I thought I would just pop in and ask.

Like I said, merely curious, since there hasn't been any activity here in awhile and I do so love your lexer :D

maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
Thanks a lot for this lexer! Awesome work :shock:
There's just 1 strange issue with it: I sometimes make line comments in my code to separate labels etc. This would look like this:
...
return
[color=green];****************************************
Label1:
return
;****************************************[/color]
Label2:
...
All the code between 2 lines is taken as comment. If the lines are like this:
;_****************...
it works fine. :?

Anyway, thanks again! Looking forward on future versions / your plugin. :D

Regards
maul.esel
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

RaptorX
  • Members
  • 751 posts
  • Last active: Feb 19 2015 02:47 AM
  • Joined: 19 Feb 2010
As i mentioned earlier on the thread, that is due to a request by several users that they wanted this to fold:

;***
; this is my comment
; this is a continuation of my comment
;*

So my lexer is treating anything between ;*** and ;* as a big comment which is not.

I will remove that on next version, if you want just put a space between the semi-colon and the asterisk so the lexer doesnt see it as a keyword anymore.


; ***  <--- a space
; this is my comment
; this is a continuation of my comment
; *

AutoHotkey Toolkit [Main Project]
Scintilla Wrapper
LexAHKL

LocalMan
  • Members
  • 6 posts
  • Last active: Jun 08 2011 09:23 AM
  • Joined: 02 Aug 2010
Putting AHKExternalLexer.dll in the Notepad++ plugins directory was fine with the previous version of Np++, which was 5.8.7, I believe.

But the new version, 5.9 crashes on startup with AHKExternalLexer.dll. The other plugins have been shown to not be relevant with np++ 5.9 crashes.

BUT:
.ahk files are still folded and syntax-colored without AHKExternalLexer.dll However, I'm not able to vary the coloring of .ahk files, as the style configurator has no entry for AHK anymore.

I did add the other lexer by running the .ahk file in
C:\Program Files\AutoHotkey\Extras\Editors\Notepad++\Run this to install syntax file for Notepad++.ahk
and have had no problems with it.

[/u]

bookmunkie
  • Members
  • 3 posts
  • Last active: Apr 27 2015 08:37 PM
  • Joined: 06 Apr 2011

I did add the other lexer by running the .ahk file in
C:\Program Files\AutoHotkey\Extras\Editors\Notepad++\Run this to install syntax file for Notepad++.ahk
and have had no problems with it.


Where did you get that? My C:\Program Files\AutoHotkey has no Extras folder.

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
It is no longer included in the AHK_L installer, if you want it you can download the AHK Basic version (just download the ZIP and unpack the extras folder seperately)

bookmunkie
  • Members
  • 3 posts
  • Last active: Apr 27 2015 08:37 PM
  • Joined: 06 Apr 2011

It is no longer included in the AHK_L installer, if you want it you can download the AHK Basic version (just download the ZIP and unpack the extras folder seperately)


Awesome! That worked.

guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
raptor,

what exactly is the problem with the new scilexer.dll? i don't know c++ either, but maybe someone else would be willing to help if the problem areas were made public.