Page 2 of 2
Re: creating an ide
Posted: Sun Jan 11, 2015 8:31 pm
by rmcode
For the syntax highlighting you will also need to be able to distinguish different scopes etc. and you probably need to know a bit about lexers.
The Lua-Plugin for IntelliJ is the only IDE I found (for Mac OSX) that has auto-formatting and extensive syntax highlighting (different colors for upvalues, local variables, global variables, parameters etc.). You could take a look at its source code too, but it is pretty complex.
Re: creating an ide
Posted: Mon Jan 12, 2015 1:34 am
by Positive07
I wouldn't go that far though... Just normal syntax highlighting is enough in most cases
Re: creating an ide
Posted: Mon Jan 12, 2015 1:37 am
by rmcode
Positive07 wrote:I wouldn't go that far though... Just normal syntax highlighting is enough in most cases
I agree. I guess I'm just very spoiled when it comes to syntax highlighting
Re: creating an ide
Posted: Tue Jan 13, 2015 4:43 pm
by Doctory
so creating an ide is mission impossible, how hard would it be to make a very simple text editor which could load/save files and display them as tabs? just a simple notepad with tabs
Re: creating an ide
Posted: Wed Jan 14, 2015 1:16 pm
by s-ol
Doctory wrote:so creating an ide is mission impossible
Who said that? Isn't zerobrane even written in lua? Well okay, their actual text field is a native extension (right?) but if LightTable can work in Clojure then there definitely is a way to build a lua IDE on lua.
Re: creating an ide
Posted: Thu Jan 15, 2015 5:00 am
by Positive07
I could work on the text area... but is a big project... a couple of months maybe, syntax highlighting is easy as pie... Mouse and cursor are hard (not that hard either, I already have the algorithm done)
Re: creating an ide
Posted: Sun Jan 18, 2015 11:26 am
by seeker14491
You could try using IUPLua, a GUI toolkit. It has the Scintilla library built in, which provides text editing functionality.
Here is the example from the manual showing a basic source code editor:
http://webserver2.tecgraf.puc-rio.br/iup/
Re: creating an ide
Posted: Sun Jan 18, 2015 10:13 pm
by Positive07
I guess the purpose is a completely Lua/LÖVE IDE, so that any Lover could modify it to their liking! But yeah totally possible with many libraries and toolkits made around Lua that exist out there
Re: creating an ide
Posted: Tue Jan 20, 2015 6:39 pm
by paulclinger
kikito wrote:For full-fledged IDEs,
Zerobrane Studio is worth a look. I don't know the exact percentage of Lua code vs native code on these projects, but I've heard it's significant.
For ZBS, the percentage of Lua code is close to 100%. ZBS is using wxlua, which is a wrapper around wxwidgets (which includes Scintilla editing component); I have couple of patches in C++ for those components, but the rest of ZBS code is all Lua.
Back to the topic, doing IDE/editor in Love is an interesting idea, but I think the OP may be underestimating the amount of work involved. ZBS itself is fairly small at about 14k total Lua lines in the code files (not including plugins and API/spec files), but this doesn't include any functionality provided by Scintilla or wxwidgets, which is not all available in love2d and the libraries that ship with it. For example, you can start a process from Lua using os.execute, but it doesn't provide a method to kill a process, so one would need to use something like posix or winapi modules to achieve that. One would need to write everything related to the editing and syntax-highlighting and it's not a trivial task. It's an interesting project for sure and I learned a lot while working on it (and making things to work on different platforms), so I don't want to deter anyone taking up on that.
Re: creating an ide
Posted: Thu Jan 22, 2015 2:30 am
by Positive07
I have decided to work on this... right now I have 80% of the text area done... next steps: up and down keys actually moving the cursor to an expected position, supr working at all (backspace already works, so this wont be that hard), selecting text (I could already have implemented this, but as with up and down keys... I'm too lazy) and syntax highlighting (I already have some ideas on how to go with this)
I'll start cleaning the code a little because there are too many ugly things
I haven't found any performance hickups right now, everything is working fine... The worst part will be when working with different fonts, since getting the width of a piece of text wont be as easy as font:getWidth