creating an ide

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: creating an ide

Post 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.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: creating an ide

Post by Positive07 »

I wouldn't go that far though... Just normal syntax highlighting is enough in most cases
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: creating an ide

Post 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 ^^
User avatar
Doctory
Party member
Posts: 441
Joined: Fri Dec 27, 2013 4:53 pm

Re: creating an ide

Post 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
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: creating an ide

Post 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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: creating an ide

Post 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)
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
seeker14491
Prole
Posts: 9
Joined: Thu Nov 29, 2012 10:47 pm

Re: creating an ide

Post 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:
Image
http://webserver2.tecgraf.puc-rio.br/iup/
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: creating an ide

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
paulclinger
Party member
Posts: 227
Joined: Thu Jun 28, 2012 8:46 pm

Re: creating an ide

Post 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.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: creating an ide

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests