diff options
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r-- | modules/textadept/editing.lua | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 2f9a7f3b..553bc824 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -189,62 +189,6 @@ function autocomplete_word(word_chars) end --- --- Displays a call tip based on the word to the left of the cursor and a given --- API table. --- @param api Table of functions call tips can be displayed for. Each key is a --- function name, and each value is a table of tables. Each of those tables --- represents a function. It has 2 indexes: parameters and a description. --- This enables call tips for 'overloaded' functions. Even if there is just --- one function, it must be enclosed in a table. You can get an API table --- from a file via textadept.io.read_api_file(). --- @param start Flag indicating whether or not to start a call tip. If the user --- clicks an arrow, you should call show_call_tip again with this value being --- false to display the next function. --- @see textadept.io.read_api_file -function show_call_tip(api, start) - local buffer = buffer - local funcs - local call_tip = '' - if start then - local s = buffer:word_start_position(buffer.current_pos - 1, true) - local word = buffer:text_range(s, buffer.current_pos) - funcs = api[word] - if not funcs then return end - if #funcs > 1 then call_tip = call_tip..'\001' end - current_call_tip = { - name = word, - num = 1, - max = #funcs, - start_pos = buffer.current_pos, - ['api'] = api - } - elseif buffer:call_tip_active() and current_call_tip.max > 1 then - call_tip = call_tip..'\001' - funcs = api[current_call_tip.name] - else - return - end - local func = funcs[current_call_tip.num] - local name = current_call_tip.name - local params = func[1] - local desc = #funcs == 1 and func[2] or '\002'..func[2] - call_tip = call_tip..name..params..'\n'..desc:gsub('\\n', '\n') - buffer:call_tip_show(current_call_tip.start_pos, call_tip) -end - -textadept.events.add_handler('call_tip_click', - function(position) -- display the next or previous call tip - if not buffer:call_tip_active() then return end - if position == 1 and current_call_tip.num > 1 then - current_call_tip.num = current_call_tip.num - 1 - show_call_tip(current_call_tip.api, false) - elseif position == 2 and current_call_tip.num < current_call_tip.max then - current_call_tip.num = current_call_tip.num + 1 - show_call_tip(current_call_tip.api, false) - end - end) - ---- -- Block comments or uncomments code with a given comment string. -- @param comment The comment string inserted or removed from the beginning of -- each line in the selection. |