diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cpp/commands.lua | 11 | ||||
-rw-r--r-- | modules/lua/adeptsense.lua | 11 | ||||
-rw-r--r-- | modules/lua/commands.lua | 17 |
3 files changed, 18 insertions, 21 deletions
diff --git a/modules/cpp/commands.lua b/modules/cpp/commands.lua index fa876ef7..a74d83a5 100644 --- a/modules/cpp/commands.lua +++ b/modules/cpp/commands.lua @@ -14,8 +14,8 @@ module('_m.cpp.commands', package.seeall) -- fields and functions. -- + `Ctrl+I`: (Windows and Linux) Autocomplete symbol. -- + `~`: (Mac OSX) Autocomplete symbol. --- + `Tab`: When the caret is to the right of a `(` in a known function call, --- show a calltip with documentation for the function. +-- + `Ctrl+H`: Show documentation for the selected symbol or the symbol under +-- the caret. -- + `Shift+Return`: Add ';' to line end and insert newline. local m_editing, m_run = _m.textadept.editing, _m.textadept.run @@ -48,12 +48,7 @@ if type(keys) == 'table' then buffer:new_line() end }, [not OSX and 'ci' or '~'] = { cppsense.complete, cppsense }, - ['\t'] = { function() - if string.char(buffer.char_at[buffer.current_pos - 1]) ~= '(' then - return false - end - return cppsense:show_apidoc() - end }, + ch = { cppsense.show_apidoc, cppsense }, } end diff --git a/modules/lua/adeptsense.lua b/modules/lua/adeptsense.lua index 6b900cd8..9e6d86a2 100644 --- a/modules/lua/adeptsense.lua +++ b/modules/lua/adeptsense.lua @@ -27,6 +27,17 @@ sense.ctags_kinds = { }
sense:load_ctags(_HOME..'/modules/lua/tags', true)
+---
+-- Shows an autocompletion list for the symbol behind the caret.
+-- @param only_fields If true, returns list of only fields; defaults to false.
+-- @param only_functions If true, returns list of only functions; defaults to
+-- false.
+function sense:complete(only_fields, only_functions)
+ local line, pos = buffer:get_cur_line()
+ local symbol = line:sub(1, pos):match(self.syntax.symbol_chars..'*$')
+ return self.super.complete(self, false, symbol:find(':'))
+end
+
-- Load user tags and apidoc.
if lfs.attributes(_USERHOME..'/modules/lua/tags') then
sense:load_ctags(_USERHOME..'/modules/lua/tags')
diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua index fb12461b..06e1944c 100644 --- a/modules/lua/commands.lua +++ b/modules/lua/commands.lua @@ -17,8 +17,8 @@ module('_m.lua.commands', package.seeall) -- functions only. -- + `Ctrl+I`: (Windows and Linux) Autocomplete symbol. -- + `~`: (Mac OSX) Autocomplete symbol. --- + `Tab`: When the caret is to the right of a `(` in a known function call, --- show a calltip with documentation for the function. +-- + `Ctrl+H`: Show documentation for the selected symbol or the symbol under +-- the caret. local m_editing, m_run = _m.textadept.editing, _m.textadept.run -- Comment string tables use lexer names. @@ -118,16 +118,7 @@ if type(keys) == 'table' then g = { goto_required }, }, ['s\n'] = { try_to_autocomplete_end }, - [not OSX and 'ci' or '~'] = { function() - local line, pos = buffer:get_cur_line() - local symbol = line:sub(1, pos):match(luasense.syntax.symbol_chars..'*$') - return luasense:complete(false, symbol:find(':')) - end }, - ['\t'] = { function() - if string.char(buffer.char_at[buffer.current_pos - 1]) ~= '(' then - return false - end - return luasense:show_apidoc() - end }, + [not OSX and 'ci' or '~'] = { luasense.complete, luasense }, + ch = { luasense.show_apidoc, luasense }, } end |