Sublime Forum

A fix to the Lua language (stored functions in Go to Symbol)

#1

EDITED: Added support to stored scoped functions. See below.
I couldn’t find a way to submit or contribute an improvement to the Lua.tmLanguage. I tried putting it into a package, but it wouldn’t work, since Lua is a official supported language.

My contribution is related to stored functions/forward declarations. In the pristine package there is no support for this. Go to Symbol actually simply ignores this function:

local stored stored = function() end

With this addition, the above syntax is valid:

<dict> <key>captures</key> <dict> <key>1</key> <dict> <key>name</key> <string>entity.name.function.lua</string> </dict> <key>2</key> <dict> <key>name</key> <string>keyword.control.lua</string> </dict> <key>3</key> <dict> <key>name</key> <string>punctuation.definition.parameters.begin.lua</string> </dict> <key>4</key> <dict> <key>name</key> <string>variable.parameter.function.lua</string> </dict> <key>5</key> <dict> <key>name</key> <string>punctuation.definition.parameters.end.lua</string> </dict> </dict> <key>match</key> <string>\b([a-zA-Z_]+)\s*=\s*(function)\s*(\()(^)]*)(\))</string> <key>name</key> <string>meta.function.lua</string> </dict>

0 Likes

#2

I use lua, and I am interested in this as well. Can you tell me a bit more about this? Are you saying I can put this into Lua.tmLanguage itself?

0 Likes

#3

Yes just add it above or below the other meta.function.lua dict.

Just added support to stored scoped functions. Now go to symbol captures all of this:

[code]local stored
stored = function() end

local class = {}

local stored; class:stored = function() end

class.stored1 = function () end

local function loc(params) end

function glob(params) end[/code]

If you want the updated full Lua.tmLanguage is here: gist.github.com/alfredbaudisch/4732057

0 Likes