What code editor do you use ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: What code editor do you use ?

Post by Positive07 »

I think you are asking too much, or at least you won't easily find what you are asking for, specially because of the dynamic typing system Lua has, there is no easy way to determine types and which thing it has inside statically (without actually running the code)

ZeroBrane is your best bet, specifically in the debugging with breakpoints and stuff, but yeah it feels outdated when compared to Visual Studio, Atom and Sublime.

I haven't seen plugins detecting LuaDoc documentation right now, but it would be a great feature. I use Atom and it's lacking the debugger with breakpoint part, the LuaDoc part and the jump to definition.

Anyway most of this stuff is actually not required most of the time. I even find it annoying sometimes but well that is my opinion.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
phobos2077
Prole
Posts: 11
Joined: Sun Feb 12, 2017 4:50 pm

Re: What code editor do you use ?

Post by phobos2077 »

Thanks for a quick reply. That's what I was afraid of. Actually it IS possible to provide proper code analysis and auto-completion, JetBrains IDE does that pretty well with JS code which is dynamically typed as well and (if you don't consider ES2015+) didn't had language support for classes, still there was a way to write JSDoc for every function and "class" so your IDE understand what type you're working with. Well, most of the time :)

I guess I'll stick with ZeroBrane and maybe use IDEA occasionally because it highlights stuff and click-jump-to-definition works at least in simple cases.
Or maybe I'll use BabeLua, it seems debugging experience is even superior to ZeroBrane (I can hover mouse over variable to it's value and I don't need to manually invoke mobdebug in my code).

Is there any editor that understands how require works and what's imported from the module?
Is there any editor that understands LuaDocs?
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: What code editor do you use ?

Post by Positive07 »

Yes, someone should create a good static-analyzer for Lua and provide some cool tool with it, go to definition, basic error checking, suggestions based on table keys (metatable aware), and whatnot. It would be a great tool and it could be helpful to write plugins for multiple editors including ZeroBrane, Atom, Sublime and Visual Studio.

I don't think many editors understand LuaDocs syntax (also I would recommend not to use LuaDocs since it's not currently maintained, but use LDoc instead, same syntax but is still maintained)

That would make a good plugin too, and wouldn't be too hard... In Atom you would need to have some `Go to Definition` though so that you understand which functions are available in the current scope based on the required files and types.
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: What code editor do you use ?

Post by paulclinger »

phobos2077 wrote: Mon Feb 20, 2017 5:21 am 5. ZeroBrane Studio. The best solution so far, because auto complete and debugging works nice. Still it doesn't understand my code (ignores LuaDocs for functions, variables, etc.) and generally it looks like an IDE from the past. I can't ctrl+click on symbol to quickly move to it's definition, I can't see a list of usages for a symbol, poor code editing in general (no wonder, because professional editors have thousands of hours put into them).
@phobos2077, thank you for the feedback. Let me go over it:

> Still it doesn't understand my code (ignores LuaDocs for functions, variables, etc.)

It does have limited support for LuaDocs for functions, but it's mostly used for providing hints about parameter types for auto-complete. For example, you can specify:

Code: Select all

-- @tparam string item
function myFunc(item)
  item:
and after typing `item:` you should get auto-complete for "string" type.

The auto-complete doesn't currently take into consideration user classes, although there are couple of tickets for this work.

> generally it looks like an IDE from the past.

I'm curious, what UI elements or functionality make it look "old"?

> I can't ctrl+click on symbol to quickly move to it's definition

You can use Ctrl+Alt+click. Ctrl+click is not available as Ctrl+DblClick is used for selection all instances of the same symbol (scope-aware). The same functionality is also available from the context menu in the editor (Right click and `Go To Definition`). Note that this works for local functions/variables (not global ones as those don't have "definitions").

> I can't see a list of usages for a symbol

Do you have examples of how it's done in other cases? For local symbols you can select them with Ctrl+DblClick and navigate using F3/Shift-F3, but for non-local symbols it requires static analysis with type inference, which is not currently used for this functionality (it's only used for validating the code in the current file).

> poor code editing in general (no wonder, because professional editors have thousands of hours put into them)

Any specific details? Some of the features that seem to be missing may already be available as plugins (for example, CloneView, DocumentMap, and many others) and for others I will at least know what would be worthwhile to add.

@Positive07> Yes, someone should create a good static-analyzer for Lua and provide some cool tool with it, go to definition, basic error checking, suggestions based on table keys (metatable aware), and whatnot.

I think the one that comes with ZBS (based on lua-inspect and metalua) is fairly good. It supports two modes: one is faster and less verbose and the other one is more comprehensive, slower and more verbose (as it also checks field values and does deeper type inference: https://studio.zerobrane.com/doc-genera ... c-analyzer). There is also https://github.com/mpeterv/luacheck.

Paul.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: What code editor do you use ?

Post by Positive07 »

I currently check with LuaCheck nice infor on lua-inspect + metalua didn't know about them!

I think the UI part refers to the native look of the interface compared to the CSS style interface Atom provides (just an example, I don't know if other editors provide THAT level of customization). I don't think he refers to highlighting themes since that is basically the same everywhere
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: What code editor do you use ?

Post by paulclinger »

phobos2077 wrote: Mon Feb 20, 2017 5:42 am Or maybe I'll use BabeLua, it seems debugging experience is even superior to ZeroBrane (I can hover mouse over variable to it's value and I don't need to manually invoke mobdebug in my code).
ZeroBrane does the same thing; if you mouse over `foo.bar` during debugging, it will evaluate its value and show the result in a tooltip. In fact, if you mouse over `bar` part, it will show the result for `foo.bar`, but if you mouse over `foo` part, it will show the value of `foo` itself. You can also select any variable/expression and it will show the result of that (selected) expression when you mouse over it. And you can then easily make it a Watch or evaluate in the Console using items from the popup menu.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: What code editor do you use ?

Post by Positive07 »

Do you need to insert Mobdebug to get those results? I think that is what he was referring to
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
evölbug
Prole
Posts: 38
Joined: Wed Dec 21, 2016 12:58 pm
Contact:

Re: What code editor do you use ?

Post by evölbug »

I have lately moved to a terminal oriented workflow, because I found this great editor called Micro, which is like SublimeText but for terminals.
It doesn't have autocomplete or multiple cursors yet, and it lacks high level Lua debugging capabilities (though it does have a linter).
BUT, it's extensible with Lua-based plugins and is a fast and tiny single-executable with no dependencies. It also allows to add syntax highlighting files and custom themes!
micros.jpg
micros.jpg (275.51 KiB) Viewed 10479 times
phobos2077
Prole
Posts: 11
Joined: Sun Feb 12, 2017 4:50 pm

Re: What code editor do you use ?

Post by phobos2077 »

@paulclinger:
WOW, didn't expect you to answer this, so soon. This community continues to amaze me (in a good way).

Actually I've spent some time digging into every plugin available and tweaked some settings, now it's a much better experience. I think some kind of description for every plugin in the plugin repository will be a good idea. Of course you can open the source code but it's not convenient and not everybody will be doing that.

Why is it @tparam and not just @param? And is there any way I can see my custom function's description when trying to write a function call?

Found some strange issue. When I type name of a function that is defined below the current function, it doesn't show up in auto-complete list. It does, however, if such function was already used in current block or if it was defined above...

I will evaluate more and see how it works in long term. Right now there are couple of things bugging be with ZBS:
1. Debugging initializes a bit slow. When I debug with BabeLua it runs almost instantly (without mobdebug), but with ZBS my LOVE seems to hang for about 12 seconds before showing the game. Normal execution works instantly.
2. There is no tooltips for functions and any other symbols, or maybe I don't understand how to configure them? I installed a plugin that displays some Lua reference tips (as well as LOVE API tips) inside the docked window in the bottom. But in almost every other IDE such tips are usually displayed right next to the symbol or mouse cursor when you hover over it or press some key combination.
paulclinger
Party member
Posts: 227
Joined: Thu Jun 28, 2012 8:46 pm

Re: What code editor do you use ?

Post by paulclinger »

phobos2077 wrote: Mon Feb 20, 2017 9:50 am Actually I've spent some time digging into every plugin available and tweaked some settings, now it's a much better experience. I think some kind of description for every plugin in the plugin repository will be a good idea. Of course you can open the source code but it's not convenient and not everybody will be doing that.
Yes, descriptions and a plugin manager are likely coming.

> Why is it @tparam and not just @param? And is there any way I can see my custom function's description when trying to write a function call?

They are both supported; it was just an example. You can do either of the following:

Code: Select all

  -- @tparam[...] <type> <paramname>
  -- @param[type=<type>] <paramname>
> Found some strange issue. When I type name of a function that is defined below the current function, it doesn't show up in auto-complete list. It does, however, if such function was already used in current block or if it was defined above...

The IDE takes the scope into account, so if the function is defined below the spot you are typing in, it won't be offered in auto-complete.

> I will evaluate more and see how it works in long term. Right now there are couple of things bugging be with ZBS:
> 1. Debugging initializes a bit slow. When I debug with BabeLua it runs almost instantly (without mobdebug), but with ZBS my LOVE seems to hang for about 12 seconds before showing the game. Normal execution works instantly.

You can check this session in the documentation for suggestions on how to speed it up: https://studio.zerobrane.com/doc-lua-de ... off-and-on

Also, you can start debugging at any time, so if there is some initialization code that you don't need to debug, you can completely skip it and call `start()` only when needed (for example, when you get to a point in the game you want to debug).

> 2. There is no tooltips for functions and any other symbols, or maybe I don't understand how to configure them? I installed a plugin that displays some Lua reference tips (as well as LOVE API tips) inside the docked window in the bottom. But in almost every other IDE such tips are usually displayed right next to the symbol or mouse cursor when you hover over it or press some key combination.

Both typing and mousing-over should work for all functions/methods the IDE "knows" about. For example, if you mouse over `print(123)`, you should see a tooltip with description for the "print" function. Similarly, when you type `print(` you should see the same tooltip. Try typing `love.draw(` and you should see its tooltip (assuming LOVE interpreter is set as the current one).
Post Reply

Who is online

Users browsing this forum: veethree and 68 guests