aboutsummaryrefslogtreecommitdiff
path: root/modules/lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-02-15 19:09:48 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2011-02-15 19:09:48 -0500
commit283770beb51385270e60d75d11d63759dac6854f (patch)
tree72b426ae3b6cd7db638d37e43a327983a528fc55 /modules/lua
parent3de0163b245b386c122737e10780975e71100274 (diff)
downloadtextadept-283770beb51385270e60d75d11d63759dac6854f.tar.gz
textadept-283770beb51385270e60d75d11d63759dac6854f.zip
Add sense.syntax.class_definition for class context completion.
Diffstat (limited to 'modules/lua')
-rw-r--r--modules/lua/adeptsense.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/lua/adeptsense.lua b/modules/lua/adeptsense.lua
index 80f843e1..0d651bcc 100644
--- a/modules/lua/adeptsense.lua
+++ b/modules/lua/adeptsense.lua
@@ -7,11 +7,21 @@
module('_m.lua.adeptsense', package.seeall)
sense = _m.textadept.adeptsense.new('lua')
+sense.syntax.class_definition = 'module%s*%(?%s*[\'"]([%w_%.]+)'
sense.syntax.symbol_chars = '[%w_%.:]'
sense.api_files = { _HOME..'/modules/lua/api' }
sense:add_trigger('.')
sense:add_trigger(':', false, true)
-function sense:get_class(symbol) return nil end -- no such thing
+
+---
+-- Returns the current module's name (if any) for showing module completions in
+-- addition to global completions. Otherwise returns nil so only global
+-- completions are shown.
+-- @param symbol Must be the empty string ('').
+function sense:get_class(symbol)
+ if symbol ~= '' then return nil end -- no such thing
+ return self.super.get_class(self, symbol) -- try to get current module
+end
-- script/update_doc generates a fake set of ctags used for autocompletion.
sense.ctags_kinds = {