diff options
-rw-r--r-- | modules/textadept/adeptsense.lua | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua index 865bb376..90093b54 100644 --- a/modules/textadept/adeptsense.lua +++ b/modules/textadept/adeptsense.lua @@ -63,16 +63,18 @@ function get_class(sense, symbol) s, e, class = line:find(patt:gsub('%%_', symbol)) if class then break end end - s, e, assignment = line:find(assignment_patt) - if assignment then - for patt, type in pairs(type_assignments) do - local captures = { assignment:match(patt) } - if #captures > 0 then - class = type:gsub('%%(%d+)', function(n) - return captures[tonumber(n)] - end) + if not class then + s, e, assignment = line:find(assignment_patt) + if assignment then + for patt, type in pairs(type_assignments) do + local captures = { assignment:match(patt) } + if #captures > 0 then + class = type:gsub('%%(%d+)', function(n) + return captures[tonumber(n)] + end) + end + if class then break end end - if class then break end end end end @@ -483,12 +485,12 @@ api_files = {}, -- @field symbol_chars A Lua pattern of characters allowed in a symbol, -- including member operators. Default is '[%w_%.]'. -- @field type_declarations A list of Lua patterns used for determining the --- class type of a symbol. The first capture returned must be the class name. +-- class type of a symbol. The first capture returned must be the class name. -- Use '%_' to match the symbol. Defaults to '(%u[%w_%.]+)%s+%_'. -- @field type_assignments A map of Lua patterns to class types for variable -- assignments. This is typically used for dynamically typed languages. For --- example, `sense.type_assignments['^"'] = 'string'` would recognize string --- assignments in Lua so the `foo` in `foo = "bar"` would be recognized as +-- example, `sense.type_assignments['^"'] = 'string'` would recognize string +-- assignments in Lua so the `foo` in `foo = "bar"` would be recognized as -- type `string`. The class type value can contain pattern captures. -- @class table -- @name syntax |