Giter Site home page Giter Site logo

luasublime's Introduction

LuaSublime

A collection of various different support files useful for use when programming in Lua using Sublime Text 2.

Installation

These files should be placed into the Lua package directory. For those on OS X, this can be found at:

/Users/[USERNAME]/Library/Application Support/Sublime Text 2/Packages/Lua

For Windows, this directory is here:

C:\\Users\\[USERNAME]\\AppData\\Roaming\\Sublime Text 2\\Packages\\Lua

Contents

Syntax Coloring

Lua.tmLanguage Lua.JSON-tmLanguage

These files define a language grammar for syntax highlighting lua files. Compared to the one that ships with Sublime Text, you get the following:

  • More tokens: Things like function calls and variables are now tagged, so they will show up correctly colored.
  • Better scopes: Most blocks now have some nested scoping support. This means that if the carat is on a variable in an if-block inside a function inside another function, then it knows this. This doesn't affect the coloring, but if you use the 'expand selection to scope' command then you will find that you'll get far better matches now.

For comparison, here's how the old syntax-highlighting looks with the Twilight color scheme:

Old

And here's the new one:

New

Build System

Lua.sublime-build

This is a simple build system that compiles and runs the current lua file. You can jump between errors using F4.

Live Parser

ParseLua.py

This is a small plugin that continually parses the current lua file and highlights any errors by placing a dot in the margin.

Syntax Error

Lua appears to stop at the first error, so you should only ever see one dot. The error message will be shown in the status bar.

Status Bar

luasublime's People

Contributors

gschenck avatar laserbeam3 avatar raenur avatar rorydriscoll avatar stanzilla avatar xpol avatar xuerian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luasublime's Issues

UnicodeEncodeError when editing files

Here's a sample output from ST2 console:

Writing file /home/user/projects/abc/def.lua with encoding UTF-8
Traceback (most recent call last):
  File "./ParseLua.py", line 22, in <lambda>
  File "./ParseLua.py", line 34, in parse
  File ".\subprocess.py", line 701, in communicate
  File ".\subprocess.py", line 1210, in _communicate
UnicodeEncodeError: 'ascii' codec can't encode characters in position 89-94: ordinal not in range(128)

No License :(

I'd like to use this at work (with a few modifications due to special lua syntax) but the project has no license, not sure how that will fly. That sort of thing tends to make lawyer types nervous. Could you please add one?

I can't build

When I click on Tools->Build menu I get the following error message:

[Errno 2] No such file or directory
[cmd:  [u'lua', u'/Users/myUser/Desktop/seq.lua']]
[dir:  /Users/myUser/Desktop]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

Maybe I could be interesting to know that I have lua interpreter into /usr/local/bin/

Not getting the new syntax-highlighting

Everything else seems to be working fine such as the build tool and the live parser, but the syntax is still the default one that comes with Sublime Text.

Build on OSX

Hi

I can't build and execute lua code because path is searching for /usr/bin/ but it would have to be /usr/local/bin. I have created one new build system for try it and goes without problem. How could i edit your sublime-build? because i have been searching on Application Support/Sublime Text 3/Packages/User and nothing.

The same problem occurred with live parser and i have solved editing Settings - User adding "path": "/usr/local/bin".

Thanks!

Globals highlighting, add it?

Hi,

I really missed highlighting of globals from my old IDE. It was bothering me so much that I went back to the old IDE. Then I decided to taka a look a at modifying the live parser from this plugin and it was not so hard to add highlighting of globals.

Besides the obvious that it lets you know when you forget to localize it is also highlights potential spelling errors. Example, "intputStr" capitalized wrong in this screenshot: http://i.imgur.com/BiizlEd.png

Edit: BTW there is a limitation in that I only know the line number the global is in and it only highlights the first instance of the global name found in the line: http://i.imgur.com/vjCDYs9.png

Easier editing of multiline comments

Thanks for creating the package!

It would be awesome if in the following case:

-- Makes something important<CURSOR HERE>
function foo()
   ...
end

the editor would automatically comment the next line if I press Enter:

-- Makes something important
-- <CURSOR HERE>
function foo()
   ...
end

This would hugely facilitate inserting multiline comments.

bug in function definition's "end" token

in the following snippet of code:

function myFunc()
    local ending = 1
    local endstuff = 2
end

the "end" part of "ending = 1" is highlighted (but not in "endstuff = 2"). It's probably just a missing word boundary somewhere.

This also affects scope expansion: placing the cursor on myFunc and using expand selection to scope will select form "function" to the "end" in "ending = 1".

ParseLua crash on Popen

The change (on os x) I made to prevent SublimeCrash :
p = Popen([luac_path, "-p", "-"], stdin=PIPE, stderr=PIPE, shell=False)

funtioncall matches too aggressive, break Ctrl+R/definition list

Not sure if it is intended, but Ctrl+R becomes completely unusable for locating function definitions with this broad of a rule.

Commenting functioncall... from LuaDev\Lua.tmLanguage resolves this.
Edit: Alternately, commenting the beginCaptures section of the above retains meta.functioncall* highlighting but doesn't clutter console-@ list. Admittedly, I'm not entirely sure how the .tmLanguage system works.

Also, I'm not sure if it's a conflict between the default Lua package and yours, but function table:Method() is not matched, where function Method() and function table.Method()

Using 'functioncall' instead of 'function-call'

Most themes and language files use meta.function-call. In fact a search of my Packages folder shows that this package is the only one using functioncall. For better syntax highlighting support, I would suggest using the former.

Version: Sublime Text 2

Better lua error parsing

Hi,

The default file_regex that you provide does not work if using sublime text on windows with Lua. Here is the output for an error in my case :

d:/program/lua/lua52/lua52.exe: D:\work\luaunit\luaunit-git\luaunit\test_luaunit.lua:578: coucou
stack traceback:
    [C]: in function 'error'
    D:\work\luaunit\luaunit-git\luaunit\test_luaunit.lua:578: in function 'g'
    D:\work\luaunit\luaunit-git\luaunit\test_luaunit.lua:569: in function 'f'
    D:\work\luaunit\luaunit-git\luaunit\test_luaunit.lua:581: in main chunk
    [C]: in ?
[Finished in 0.1s with exit code 1]

I use the following regexp to parse it :
"file_regex": "^(?:(?:\t)|(?:.+: ))(.+):([0-9]+): (.*)$",

It parses the whole lua stacktrace, which I find a good thing, but other may disagree.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.