Author Topic: Writing tagdoc files (lua)  (Read 3020 times)

minde

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Writing tagdoc files (lua)
« on: December 20, 2013, 01:04:24 PM »
Hello, I'm trying to create tagdoc file for lua code completion and I need help how to do it. Let's say my code is:
Code: [Select]
foo={}
foo.bar={}
foo.bar.baz={
    bum="hello",
    mub="world"
}
print(foo.bar.baz.bum)
And I want to enable completion for foo.bar.baz.bum, so I created file custom.tagdoc:
Code: [Select]
table foo = {
   table baz = {
      table baz = {
         string bum;
         string mub;
      }
   }
}
Of course it doesn't work...

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Writing tagdoc files (lua)
« Reply #1 on: December 20, 2013, 05:16:48 PM »
The .tagdoc extension uses it's own special syntax for defining language constructs. It's a way for us to create tagging symbols for a variety of languages that do not have a full-blown parser.

However, there is a real parser now for Lua, so you can create tags for any file with a .lua extension. (I forget exactly which version introduced the Lua parser, but it's been a couple years now)

If you open the Tools > Tag Files configuration dialog, you may already see a Lua tag file which has the contents of the lua.tagdoc symbols. You can select that tag file, use the "Add Files…" button and browse to any .lua file you wish to have symbols for. (Yes, you can mix .tagdoc and "real" files in the same tag file)

minde

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Writing tagdoc files (lua)
« Reply #2 on: December 20, 2013, 06:00:04 PM »
Ok, but my question is how to create tagdoc file for that lua table?

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Writing tagdoc files (lua)
« Reply #3 on: December 20, 2013, 06:48:16 PM »
Just save that code snippet (without the printf line) as a separate file with a .lua extension. Then do what I recommended below to browse to and add that snippet file to the existing lua.vtg file.