Page 2 of 5

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 11 May 2021, 20:06
by Alguimist
@boiler
One of the new features of Adventure that can come in handy in the situation you described is multiple selection (Options > Enable Multiple Selection). Hold the Ctrl key and double-click the variables, one by one, from a section of the code and copy them all at once to be pasted elsewhere.

@kczx3
kczx3 wrote:
03 May 2021, 10:08
Actually... My Tools menu is empty. Are all the included Tools not automatically added here?
Most of the tools included with Adventure are relevant to AutoHotkey only. And that's why the Tools menu is initially empty. For a preset of tools, rename the file AHK-Tools.xml to Tools.xml.

@joedf
Thanks, Joe!

@oldbrother
The GUI designer is no longer directly integrated with the IDE. It became a separate tool, which can be found in the Tools folder.

@autohost
Maybe soon. I have to do some tests to determine exactly what needs to be adapted.

@lexikos
lexikos wrote:
08 May 2021, 06:38
The code pane flickers very noticeably when I resize the window. This appears to be easily fixed by adding the WS_CLIPCHILDREN style (option +0x2000000) to the main GUI.
Thanks for pointing that out!
lexikos wrote:
08 May 2021, 06:38
The Find in Files tool refuses to run if A_ScreenDPI != 96.
I will fix that for the next release of Adventure. I was actually planning to completely redesign the user interface of Find in Files and add more functionality when I noticed that such task would demand a considerable amount of time, delaying even more the publication of the current release.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 11 May 2021, 20:16
by boiler
Alguimist wrote: One of the new features of Adventure that can come in handy in the situation you described is multiple selection (Options > Enable Multiple Selection). Hold the Ctrl key and double-click the variables, one by one, from a section of the code and copy them all at once to be pasted elsewhere.
That does sound like a very useful feature. Thanks for pointing that out. Perhaps that and the many other features it has will have me not missing multiple panes (but it's still on my wish list :D).

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 04 Jun 2021, 15:05
by kunkel321
Hi Alguimist, Thanks for making this and for sharing it! The new Adventure is a real beauty!

A question for you or others:
-Is it possible to "import" the old AHK tools? Or an easy way to add them in bulk to the Tools menu (like AutoGUI had)? I'm sure it would only take me 5 minutes to add them using the Tools Manager. Thought I'd make sure there's not already a better way to add them, though.

EDIT 6-5-2021. I manually added a couple. They work fine, but I had to copy AutoHotkey.exe into each of the tools' subfolders and rename it as the tool "A_Variables.exe" etc. Of course now they don't have the associated icons like they do in the menu of AutoGUI, so that's a shame. I'm not sure if it is relevant, but I'm using portable versions of all my AHK stuff.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 24 Jun 2021, 13:05
by kczx3
How can I make the editor automatically load my session from exit upon startup? Currently, I have to manually go to the Sessions menu to do this.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 12:45
by boiler
kczx3 wrote: How can I make the editor automatically load my session from exit upon startup? Currently, I have to manually go to the Sessions menu to do this.
Did you enable this option? Options > On Exit > Remember Session

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 13:18
by boiler
@Alguimist - I discovered an issue with AHK syntax highlighting in Adventure. It occurs when a line is an expression whose first character is an open parenthesis, like in the script below that takes advantage of the short-circuit Boolean evaluation of the && operator (to act as a shorthand if statement):

Code: Select all

(WinExist("ahk_exe notepad.exe") && NotepadOpenOnScriptStart := 1)
return

#If NotepadOpenOnScriptStart
F1::WinActivate, ahk_exe notepad.exe

You can see the difference in how it is highlighted when that first line is commented out or not:
Image


The above is a contrived example. The issue was discovered when viewing teadrinker's script in this post in Adventure. It kills the highlighting for most of the script.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 14:08
by kczx3
boiler wrote:
08 Jul 2021, 12:45
Did you enable this option? Options > On Exit > Remember Session
Yep, that's enabled. And my session is definitely saved upon Exit. The problem is when I startup Adventure, the window starts blank. I want it to automatically load my session that was saved on Exit.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 14:22
by kczx3
boiler wrote:
08 Jul 2021, 13:18
@Alguimist - I discovered an issue with AHK syntax highlighting in Adventure. It occurs when a line is an expression whose first character is an open parenthesis, like in the script below that takes advantage of the short-circuit Boolean evaluation of the && operator (to act as a shorthand if statement):

Code: Select all

(WinExist("ahk_exe notepad.exe") && NotepadOpenOnScriptStart := 1)
return

#If NotepadOpenOnScriptStart
F1::WinActivate, ahk_exe notepad.exe

You can see the difference in how it is highlighted when that first line is commented out or not:
Image


The above is a contrived example. The issue was discovered when viewing teadrinker's script in this post in Adventure. It kills the highlighting for most of the script.
That's not a new issue. Alguimist uses the version of Scintilla built by RaptorX that has a lexer for AHK. This can be found here - https://github.com/RaptorX/LexAHKL
If you look at https://github.com/RaptorX/LexAHKL/blob/102ae22ac64d114622ac3dab190483b3e7b89f04/scintilla/lexers/LexAHKL.cxx#L649 I think that is where it marks a line containing only spaces and an open parenthesis that it sets the state to SCE_AHKL_STRINGOPTS which is used for continuation section flags.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 15:48
by boiler
kczx3 wrote: Yep, that's enabled. And my session is definitely saved upon Exit. The problem is when I startup Adventure, the window starts blank. I want it to automatically load my session that was saved on Exit.
Hmm. Mine does automatically load my session that was saved on exit. I would check that your settings are getting updated as they should in the FileHistory.xml file, including something like this:

Code: Select all

	<recent items="2|3|4|5|6|7|8|1|9"/>
	<sessions>
		<session name="Session Saved on Exit" items="1|9" active="2"/>
	</sessions>

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 15:53
by boiler
kczx3 wrote: That's not a new issue. Alguimist uses the version of Scintilla built by RaptorX that has a lexer for AHK. This can be found here - https://github.com/RaptorX/LexAHKL
If you look at https://github.com/RaptorX/LexAHKL/blob/102ae22ac64d114622ac3dab190483b3e7b89f04/scintilla/lexers/LexAHKL.cxx#L649 I think that is where it marks a line containing only spaces and an open parenthesis that it sets the state to SCE_AHKL_STRINGOPTS which is used for continuation section flags.
OK. I'm not sure if that means either of them has fixing it on their to-do list. Other editors handle it correctly, so I would think they would want to get their lexer to handle it as well. Not a big deal for me, but I just wanted to point it out since I ran across it.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 08 Jul 2021, 18:29
by kczx3
I know Alguimist has mentioned rewriting the lexer before but it’s not a simple task as it is written in c++. And Scintilla 5 has a new way of providing lexers though I don’t recall if they can be written in other languages or not.

Edit: Lever -> lexer

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 04:09
by lexikos
@kczx3
I believe it could be done in any language that can create an ILexer5 object and pass it to SCI_SETILEXER, including AutoHotkey. As with COM, the object is just a struct starting with a pointer to a "virtual function table" (an array of function pointers in a specific order). Passing the object means passing the address of the struct (the address of the address of the v-table).

However, it was already possible to create a container lexer in any language that can host the Scintilla control. I wrote one in 2012, but it ran on AutoHotkey v2-alpha, which has changed a lot since then (and I didn't share it).

There's also Scintillua, which I use with SciTE on a regular basis, but I'm not sure that my lexers work with the latest version of Scintillua (for Scintilla 5). I think it is considerably easier and less tedious to write an LPEG based lexer and keep it up to date, as it is more like describing the syntax than writing code to parse it.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 08:10
by kczx3
Makes sense. I know that @TheArkive has worked with the container lexer a bit.
I hadn't read up on Scintillua and don't know Lua at all. It seems that enabling that in Scintilla requires you to build it manually from what I read. I can certainly see how the LPEG versions would be easier to write and understand than a full parser. It'd be great to have a fresh lexer for the official 2.0 release.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 08:20
by kczx3
boiler wrote:
08 Jul 2021, 15:48
Hmm. Mine does automatically load my session that was saved on exit. I would check that your settings are getting updated as they should in the FileHistory.xml file, including something like this:
Not sure what was going on. The FileHistory.xml file looked fine to me. I checked my Adventure.ini file and the LoadLastSession was set to 0 however in Adventure under Options > On Exit, I had Remember Session checked. I unchecked it and then checked it, then closed Adventure. Inspecting Adventure.ini again now properly showed

Code: Select all

[Options]
LastSessionName=Session Saved on Exit
LoadLastSession=1
RememberSession=1
So it is working now. Strange!

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 08:24
by TheArkive
Actually I haven't done any work with the lexer yet :P ... Only messing with all the bells and whistles in the Scintilla control.

I did manage to accomplish the example that lexikos linked. It's fairly straight forward, until you get into handling multi-byte characters :P

It's still on my To-Do list to create a framework that's easier to populate a lexer in this way.

EDIT: If someone beats me to it, I won't complain!

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 08:52
by boiler
kczx3 wrote:
09 Jul 2021, 08:20
Not sure what was going on. The FileHistory.xml file looked fine to me. I checked my Adventure.ini file and the LoadLastSession was set to 0 however in Adventure under Options > On Exit, I had Remember Session checked. I unchecked it and then checked it, then closed Adventure. Inspecting Adventure.ini again now properly showed

So it is working now. Strange!
One time mine didn’t load the last session after Windows shut Adventure down when it performed a restart on its own ( :x ), so maybe Adventure needs to be closed down conventionally in order for it to set itself to restart correctly. That might not have been your case, but maybe something like that causes it to not leave a 1 in the LoadLastSession setting.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 08:59
by TheArkive
boiler wrote:
09 Jul 2021, 08:52
One time mine didn’t load the last session after Windows shut Adventure down when it performed a restart on its own ( :x )
I've started using my OnExit() event to write script data to disk. That should take care of unexpected shutdowns prompted by the OS.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 09 Jul 2021, 18:56
by lexikos
kczx3 wrote:
09 Jul 2021, 08:10
It seems that enabling that in Scintilla requires you to build it manually from what I read.
Feature #1 of Scintillua is "Drop-in installation in most Scintilla environments – no modifications to Scintilla are necessary."

However, "Scintillua requires Scintilla 4.4.5 or greater for a drop-in installation". I think the Scintilla version requirement has changed since I started using it, because I'm sure I did a "drop-in installation" with SciTE 3.5.1. That might be an issue for Adventure. I have no idea how much work it would be to update Scintilla.
It'd be great to have a fresh lexer for the official 2.0 release.
My LPEG lexers (linked in my last post) are fairly up to date, but maybe not fully as I only update them when I notice an issue. Also, I hadn't bothered to commit any changes to git for the last three years, so I've just pushed an update.

If you want to try to use it with Adventure (without updating Scintilla), you'll probably need to find (or build) an older version of Scintillua (the files I have are dated 2016-10-16). Unfortunately the original website appears to have been taken down, and GitHub only has Scintillua binaries for Scintilla 4.4.5 and later.

I considered writing a new lexer that can be more easily used for any Scintilla-based projects and existing programs, but I wouldn't be satisfied with anything less accurate than what I already have, and that would be a lot of work. I've also recently been using VSCode, which is obviously not Scintilla-based, and does a bunch of things so well that I've pretty much abandoned any plan to make my own editor. Then there are other ideas; if the actual AutoHotkey parser can be redesigned to be reusable for highlighting (and static analysis) without a loss of efficiency, it might be better for me to do that.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 10 Jul 2021, 14:32
by Alguimist
kunkel321 wrote:Is it possible to "import" the old AHK tools?
As already stated on the top of this page and in the documentation: "For a preset of tools, rename the file AHK-Tools.xml to Tools.xml".
kczx3 wrote:How can I make the editor automatically load my session from exit upon startup? Currently, I have to manually go to the Sessions menu to do this.
Aside from the option "Remember Session", you also have to make sure that "Session Saved on Exit" is defined as the startup session: Sessions > Manage Sessions... > Settings. Adventure does not necessarily load on startup the session automatically saved when the program is closed.
boiler wrote:I discovered an issue with AHK syntax highlighting in Adventure...
I've noticed that the AHK lexer is fairly complex compared to the lexer of other programming languages. While the AHK lexer lacks the "operator" identifier (of low relevance to syntax styling), others lack the "function" identifier (highly relevant). I'm planning to add new categories of keywords to the lexers that have insufficient groups of keywords, such as Pascal, Python and Ruby, and then I will take some time to examine in details the minor bugs that affect the AHK lexer.

Edit: grammar.

Re: Adventure - General-Purpose IDE, Lightweight Text Editor

Posted: 10 Jul 2021, 20:45
by kczx3
lexikos wrote:
09 Jul 2021, 18:56
I've also recently been using VSCode, which is obviously not Scintilla-based, and does a bunch of things so well that I've pretty much abandoned any plan to make my own editor.
Interesting. I use VSCode a lot in my day to day work. I have used it for AHK but honestly, I have never really enjoyed coding AHK in it. For some reason, I really prefer a near instant startup time when opening an editor to work on a script for AHK. And I've found that an editor like Adventure with the toolbar really lends itself well to AHK usage and development. VSCode doesn't really have much of a toolbar. It is possible this all stems from AHK being my first language I learned and working in Notepad++ then.

It has also been difficult to get good tooling for AHKv2 for obvious reasons.