zerobrane

Is it possible to assign editor styles to API tokens?


If I define my own API and I want to highlight values, classes and methods of my API in editor. How I can do it? Is it possible to assign some of keyword styles to api tokens?

Here is my instead.lua in api folder of ZBS:

return {
  instead = {
    type = "lib",
    description = "Библиотека INSTEAD",
    childs = {
      tiny = {
        type = "value",
        description = "Флаг «минималистичного INSTEAD», без графики и множества других возможностей."
      }
    }
  },
}

And this is some code snippet:

if not instead.tiny then 
  require "autotheme"
end  

So I want instead and tiny to be highlighted in my code.


Solution

  • You can use keyword highlighting, but while it works for "instead" and "tiny", it will also have to be set for "instead.tiny", which is not ideal (this looks like a limitation in the version of the Scintilla editor component used by the IDE); see this ticket for a related discussion and explanation. You may also check a proposed highlight property plugin that does something similar (although for all properties).