## What code editor do you use ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
phobos2077
Prole
Posts: 11
Joined: Sun Feb 12, 2017 4:50 pm

### Re: What code editor do you use ?

I'm still searching for a "perfect" editor and it seems nothing works as a full IDE. I have come from professional coding background (PHP, C#, JS) so maybe my requirements are too high

Here's what I want:
1. Syntax highlighting. Obviously.
2. An actual code completion, not only for basic Lua functions and LOVE API but also for all my own functions and classes/tables I create. I want it to read LuaDoc and trace types for at least some of the variables that I use. So I can use code completion when working with some library, for example...
3. Running and debugging a game from the editor, with breakpoints, watches, etc.

Here's what I tried:
1. Notepad++ (my default editor for text files). Running anything is a mess. No debugging, no code analysis...
2. Visual Studio 2015 with BabeLua. Good running and debugging (but a mess to configure). No LOVE API hints. No console output.
3. Jetbrains IDEA with Lua plugin. Real pain to configure. Debugging is useless (I tried the .cmd file workaround and put mobdebug.lua inside my project folder). I can set up breakpoints but don't see any variable values. The best code editing so far, but still doesn't show me function and argument descriptions, etc. Though it should understand LuaDoc, so maybe I'm doing something wrong...
4. Sublime Text 3 with Love plugin. No auto-complete for my own code, no debugging whatsoever...
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).

I wanted to also try Atom but it's pointless because as I understand it's the same as Sublime plugin in terms of features.

Any suggestions will be greatly appreciated

Positive07
Party member
Posts: 999
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: What code editor do you use ?

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/Positive07)

phobos2077
Prole
Posts: 11
Joined: Sun Feb 12, 2017 4:50 pm

### Re: What code editor do you use ?

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?

Positive07
Party member
Posts: 999
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: What code editor do you use ?

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/Positive07)

paulclinger
Party member
Posts: 213
Joined: Thu Jun 28, 2012 8:46 pm

### Re: What code editor do you use ?

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.

Positive07
Party member
Posts: 999
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: What code editor do you use ?

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/Positive07)

paulclinger
Party member
Posts: 213
Joined: Thu Jun 28, 2012 8:46 pm

### Re: What code editor do you use ?

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.

Positive07
Party member
Posts: 999
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

### Re: What code editor do you use ?

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/Positive07)

evölbug
Prole
Posts: 38
Joined: Wed Dec 21, 2016 12:58 pm
Contact:

### Re: What code editor do you use ?

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 (275.51 KiB) Viewed 739 times

phobos2077
Prole
Posts: 11
Joined: Sun Feb 12, 2017 4:50 pm

### Re: What code editor do you use ?

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

### Who is online

Users browsing this forum: No registered users and 5 guests