Home Download Buy Blog Forum Support

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

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

Postby alfredbaudisch on Thu Feb 07, 2013 4:01 am

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:
Code: Select all
local stored
stored = function() end


With this addition, the above syntax is valid:
Code: Select all
      <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>


Image
Last edited by alfredbaudisch on Thu Feb 07, 2013 4:43 pm, edited 1 time in total.
alfredbaudisch
 
Posts: 2
Joined: Thu Feb 07, 2013 3:49 am

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

Postby mhorsley on Thu Feb 07, 2013 6:09 am

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?
mhorsley
 
Posts: 7
Joined: Tue Jan 29, 2013 6:44 pm

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

Postby alfredbaudisch on Thu Feb 07, 2013 4:42 pm

mhorsley wrote: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?


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: Select all
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


If you want the updated full Lua.tmLanguage is here: https://gist.github.com/alfredbaudisch/4732057
alfredbaudisch
 
Posts: 2
Joined: Thu Feb 07, 2013 3:49 am


Return to Technical Support

Who is online

Users browsing this forum: subhaze and 13 guests