Jump to content

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

Syntax highlighter for Eclipse IDE


  • Please log in to reply
40 replies to this topic
RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

Unfortunately, I don´t have any expertise in programming plugins for the Eclipse IDE

Did you look at Colorer? it is a working syntax highlighter with a Eclipse plugin no programming needed, all it needs is AHK support and I'm working on it, I even downloaded Eclipse to test it works.


Sorry, I haven´t had the time yet. Hopefully I can do so on Sunday.
Have a nice weekend,
Rob

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005
Finally, I took a look. It seems quite promising but I think it can really only serve the purpose of syntax highlighting. This will be a good start, though, but there are several other tasks to make a good AHK editor.

Best regards,
Rob

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

Finally, I took a look. It seems quite promising but I think it can really only serve the purpose of syntax highlighting. This will be a good start, though, but there are several other tasks to make a good AHK editor.


Did you try it in Eclipse?
and do you want to test my unfinished AutoHotkey support?

And colorer seems to support a bit more then syntax highlighting:
Eclipse Colorer

* Powerful and flexible outliner for all common languages.
* Errors list could be showed in outline view.
* Shortcuts for pairs matching.
* Replace tabs with spaces option.
* Soft linebreakes option.
* Colored sources generation into HTML files.

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

Did you try it in Eclipse?
and do you want to test my unfinished AutoHotkey support?


Over the next days, I think I have the time to test it in Eclipse (need to install Eclipse on my home system anyway). Can you provide a link to your current work?

And colorer seems to support a bit more then syntax highlighting:
Eclipse Colorer

* Powerful and flexible outliner for all common languages.
* Errors list could be showed in outline view.
* Shortcuts for pairs matching.
* Replace tabs with spaces option.
* Soft linebreakes option.
* Colored sources generation into HTML files.


I was not aware that Colorer can serve as an outliner as well. Great! This would be one of the biggest advantages over other editors, imho.
What I like (best) in Eclipse´ Java editor is the highlighting of all occurences of a variable in its actual scope. I would really like to see this feature in an AHK editor as well, since I miss it in every other AHK-supported editor.
Is it clear to you which feature I mean?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I guess that getting the scope of a variable in AutoHotkey will not be obvious... The relevant chapter in the Scripts page has to be read carefully...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

Can you provide a link to your current work?

Hi
Sorry for the delay, I have not been home for the last two days.

You need to install the Colorer Eclipse plugin and then unpack my zipfile, run "ColorerInstall.ahk" install script and when the script asks for "catalog.xml" go to Colorerplugins folder in Eclipse's plugins folder and choose the catalog file.

Like I said before it's not complete, but should have some functionality.

In this Zipfile there are three files
AHKColorer.zip
ColorerInstall.ahk   Install script.
protomod.hrc         Modification to Colorers proto.hrc file to add support for AHK.
ahk.hrc              This is the syntax highlighting file for Colorer.


RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005
Hi jonib,

this looks really promising! I did a not too extensive check yesterday and I am amazed! Although it is not complete, it offers more functionality than every other editor with AHK support I have tested so far!

First thing I´ve noticed as a bug are functions not showing correctly in outline view (some are not visible at all, others are shown as child nodes of GoTo-labels). I think this is because the end of such a jump label is not (or incorrectly) tested (need to end with "Return").

I don´t know if folding needs to be supported by the Colorer plugin or by you, but this is something I would really wish for the future.

If you don´t mind, I will keep you informed about other issues I find. Or maybe you have a rough todo list that I can check against?

Best regards,
Rob

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

this looks really promising! I did a not too extensive check yesterday and I am amazed! Although it is not complete, it offers more functionality than every other editor with AHK support I have tested so far!

Hi and now I'm getting nervus. :shock:

First thing I´ve noticed as a bug are functions not showing correctly in outline view (some are not visible at all, others are shown as child nodes of GoTo-labels). I think this is because the end of such a jump label is not (or incorrectly) tested (need to end with "Return").

Yes outline functionality is very experimental for me, labels should work and functions that have "{" on the same line should work somewhat, I have to studie some more.
How did you get outlines to show in Eclipse? it says "An outline is not available" even if I try pascal source.

I don´t know if folding needs to be supported by the Colorer plugin or by you, but this is something I would really wish for the future.

I'm not sure what folding means? I have not used Eclipse other then test that Colorer worked with it.

If you don´t mind, I will keep you informed about other issues I find. Or maybe you have a rough todo list that I can check against?

Yes keep me informed, I'll make a separet posting with more documentation and todo list later.

RobOtter (not logged in)
  • Guests
  • Last active:
  • Joined: --

Yes outline functionality is very experimental for me, labels should work and functions that have "{" on the same line should work somewhat, I have to studie some more.

Functions are outlined correctly only if the opening curly bracket is in the same line (with exactly ONE blank or tab after the closing round bracket) AND if they are defined before a label. If defined right after a label, they are shown as a child of the label.
If the curly bracket is on a new line or has not exactly one blank or tab, functions are not outlined at all.

How did you get outlines to show in Eclipse? it says "An outline is not available" even if I try pascal source.

Huh? No problem here with Eclipse 3.2 beta, 3.1 final and the latest version of Eclipse Colorer; I get the outline on the fly (ok, it´s a bit slow, though)

I'm not sure what folding means? I have not used Eclipse other then test that Colorer worked with it.

Folding means "collapse a block of code so that you can only see its first line". Line numbers are left untouched. Folding is usually useful in bigger software projects to see only things you need to see. In case of AHK scripts, I would suggest that folding should at least be possible on complete labels and functions but it would be best if it would work on any block of code, i.e. everything between curly brackets.

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

Functions are outlined correctly only if the opening curly bracket is in the same line (with exactly ONE blank or tab after the closing round bracket)

Yes I know, it was a quick test to get outline to work at all with functions, I'm having a problem distinguishing a function declaration and calling a function, I'm assuming only the declaration should be outlined.

AND if they are defined before a label. If defined right after a label, they are shown as a child of the label.

I know and is weird, I'm trying to find out why it happens.

How did you get outlines to show in Eclipse? it says "An outline is not available" even if I try pascal source.

Huh? No problem here with Eclipse 3.2 beta, 3.1 final and the latest version of Eclipse Colorer; I get the outline on the fly (ok, it´s a bit slow, though)

I got it working by creating a project and a ahk file in the project, but I can't find a way to open a file other then "File" "open file" and then the outline don't work, how do you open a file?

Folding means "collapse a block of code so that you can only see its first line".

I think Colorer has to support this and I don't think it supports it.

When I got the outline to work I saw there was a "Parse Tree" view that shows how the file is parsed by Colorer, it might be a great way to see why something is not working.

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

How did you get outlines to show in Eclipse? it says "An outline is not available" even if I try pascal source.
...
I got it working by creating a project and a ahk file in the project, but I can't find a way to open a file other then "File" "open file" and then the outline don't work, how do you open a file?


I usually use the Navigator View; it shows all files / folders in your current project. Opening an AHK file via double click or by drag´n´drop works fine then.
After playing around, I found the reason for your problem (you were on the right way to find the solution yourself):
Files need to belong to the project. Although you can open any AHK file anywhere on the file system, Outline View only works (god knows why) on files belonging to the current project. It´s a bit strange but that´s it :idea:

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006
It seems there is no way to connect a file to a project without saving the file in the projects directory.

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

It seems there is no way to connect a file to a project without saving the file in the projects directory.

That´s right - that is what the project directory is for :wink:
Keeping everything in one place for a better overview is the credo. To my knowledge, the only external files you can add to a project are Java archives (jar files), but this has obviously nothing to do with AHK...

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006
It just makes it harder for me testing diffrent .ahk files, I have to move them all to the project directory.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

I'm having a problem distinguishing a function declaration and calling a function, I'm assuming only the declaration should be outlined.

Yes, that's an unfortunate choice of syntax. AHK's parser solved this, of course, but for poor syntax highlighting lexers like mine, and outliners, it is hard to see the difference, as the opening brace that show that it is a definition can be far away from the initial line:
SillyFunction(p1	; First parameter
/*
Who said disconnected?
*/
, p2)	; Yes, that's the second one!
/*

Comments are good (if used wisely...)

*/


{ ; Whew!
	Return true
}
is perfectly legal and functionnal...
Plus it has the side effect of not allowing arbitrary braces after a function call!
{	; Arbitrary braces are OK
	a = Bla
}
SillyFunction(1, 2)
; But not after a function call!
{
	b = Wot
}

Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")