What do you think of 'Brackets' as an editor + How to use luacheck code linter

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Party member
Posts: 127
Joined: Tue Mar 29, 2011 11:05 pm

What do you think of 'Brackets' as an editor + How to use luacheck code linter

Post by drunken_munki » Fri May 18, 2018 12:00 pm

Been trying a few editors out, I usually use notepad++.

What caught my eye was the 'luacheck' linting tool: https://github.com/mpeterv/luacheck

Here I already tried out the tool manually which can create a report of your code issues... but then the section on integration with editors caught my other eye. So I tried sublime... hated it, and couldn't get the linter to work either.

Then I tried Brackets which is available on all systems it seems: http://brackets.io/

From here I installed it, ran it and went to File -> 'Extension Manager'. Then I searched for 'luacheck' and installed the interface for it.
Image1.png (98.72 KiB) Viewed 231 times

I also had to download luacheck from the github page, actually I got the one-off windows x86_64 binary and put it somewhere on my system. This needs to be reachable in the PATH, so I linked it in the system settings:
https://github.com/mpeterv/luacheck/rel ... acheck.exe

Now when I opened my working directory in Brackets I can see the source tree on the left, I open a file and it auto-lints the file. Neat.
Image2.png (148.77 KiB) Viewed 231 times

To configure luacheck properly, I create '.luacheckrc' which is written in basic Lua syntax and normally placed into the root directory of your code. However, to get this to work properly with Brackets I created a symbolic link (or just copy it) to:

On other systems I beleive this file should be copied to:
"~/Library/Application Support/Luacheck/.luacheckrc" on OS X/macOS, and "$XDG_CONFIG_HOME/luacheck/.luacheckrc" or "~/.config/luacheck/.luacheckrc" on a linux type OS.

My '.luacheckrc' consists of the following settings, to give you an idea of how to set it up:

Code: Select all

-- Create symbolic link of this file into this directory: %LOCALAPPDATA%\Luacheck\.luacheckrc

-- Include 'love' into the global pool (read/write)
std = {
  globals = {"love"}

-- Include all source sub-dirs or file paths relative to the root dir:
include_files = {

-- Message codes to filter out:
-- https://luacheck.readthedocs.io/en/stable/warnings.html
-- 611 A line consists of nothing but white space
-- 612 A line contains trailing white space
-- 614 Trailing white space in a comment
-- 631 line is too long
-- 311 value assigned to variable x is unused
-- 113 accessing undefined variable x 
-- 111 setting non-standard global variable x
-- 411 variable x was previously defined on line
-- 542 empty if branch
-- 422 shadowing definition of argument
-- 421 shadowing definition of variable
ignore = {"611", "612", "614", "631", "311", "113", "111", "411", "542", "422", "421"}
Image3.png (155.36 KiB) Viewed 231 times

So I spent about a day of coding time to tidy up my code and really really enjoyed using this linter, I think I cleaned up over 2000 warnings and found three bugs in the process, heh.

I realised that some features are lacking in Brackets such as a more sensible search/replace tool, but I think there are a lot of plugins being made or available.

So have you tried this, what do you think?
Last edited by drunken_munki on Sun May 20, 2018 11:40 am, edited 5 times in total.

User avatar
Party member
Posts: 180
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki

Re: What do you think of 'Brackets' as an editor?

Post by D0NM » Sat May 19, 2018 7:16 pm

1) Brackets is a nice editor.
2) I think your howto will be handy. Because some time ago I browsed all "lua-ish" brackets plugins, got no instant results and dropped them all.
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Follow @Zabuyaki.
Twitter @FaMeSoft / GP32 Free Platformer: SUPER PLUSHA
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:

User avatar
Posts: 11
Joined: Wed Mar 07, 2018 11:21 pm
Location: Denmark

Re: What do you think of 'Brackets' as an editor?

Post by MissDanish » Sat May 19, 2018 7:23 pm

damn, it looks way better than the skins for atom (what I use). But I am guessing it's probably not possible to have a button that can execute your game easily in Brackets?
Smol programmer :neko:

User avatar
Party member
Posts: 127
Joined: Tue Mar 29, 2011 11:05 pm

Re: What do you think of 'Brackets' as an editor?

Post by drunken_munki » Sun May 20, 2018 9:27 am

I'm going to check how to create a run command today, and also possibly how to use the git integration; will report back soon.

OK running a love project is easy
File -> Extension Manager -> Search for "Run LÖVE" and install it.

Restart the editor and you can use ctrl-shift-l or click the edit menu -> "Run with LÖVE". I have my love folder reachable in the system PATH.

Styler themes are pretty easy too
Find something you like: http://brackets-themes.github.io/ or a custom skin search in google maybe.
Search the name in the extensions manager or browse for something: File -> Extension Manager -> Themes tab and install.
Then go to View -> Themes and pick an installed skin from drop-down list.

Override shortcuts
I like to use ctrl+q to toggle a comment, in Brackets this defaults to closing the application (ouch). It was easy enough to add a keybind in Debug -> Open User Key Map.

I add an override in the following format:

Code: Select all

    "documentation": "https://github.com/adobe/brackets/wiki/User-Key-Bindings",
    "overrides": {
        "Ctrl-Q": "edit.lineComment"
A list of shortcuts is here: https://github.com/adobe/brackets/wiki/ ... -Shortcuts and a list of commands is here: https://github.com/adobe/brackets/blob/ ... ommands.js

Same word highlighting
This is something I just have to have, which is off by default. Here we can edit the Brackets configuration: Debug -> Open Preferences File.

Then in the "brackets.json" file add the line:

Code: Select all

"highlightMatches": true
Make sure the comma in the previous line is added as well.
Image0.png (139.56 KiB) Viewed 70 times

Now when I highlight a word it underlines similar words.
Image1.png (129.26 KiB) Viewed 70 times

Tab space to 2 characters
Change tab/spacing by clicking the tab/space text in the bottom right of the editor proper, and change the value and press return (I'm used to spacing of 2, and not 4).

Now I pretty much have a working set-up, will try it out for a week or so.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests