aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/ansi_c/init.lua208
-rw-r--r--modules/lua/api81
-rw-r--r--modules/lua/init.lua118
-rw-r--r--modules/lua/tags74
-rw-r--r--modules/textadept/adeptsense.lua1020
-rw-r--r--modules/textadept/editing.lua96
-rw-r--r--modules/textadept/init.lua1
-rw-r--r--modules/textadept/keys.lua13
-rw-r--r--modules/textadept/menu.lua6
9 files changed, 358 insertions, 1259 deletions
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua
index 725dd3be..a6173bb8 100644
--- a/modules/ansi_c/init.lua
+++ b/modules/ansi_c/init.lua
@@ -11,44 +11,65 @@ local M = {}
--
-- + `Ctrl+L, M` (`⌘L, M` on Mac OSX | `M-L, M` in curses)
-- Open this module for editing.
--- + `.`
--- Show an autocompletion list of members for the symbol behind the caret.
--- + `->`
--- Show an autocompletion list of members for the symbol behind the caret.
-- + `Shift+Enter` (`⇧↩` | `S-Enter`)
-- Add ';' to the end of the current line and insert a newline.
--- @field sense
--- The C [Adeptsense](textadept.adeptsense.html).
--- It loads user tags from *`_USERHOME`/modules/ansi_c/tags* and user apidocs
--- from *`_USERHOME`/modules/ansi_c/api*.
module('_M.ansi_c')]]
--- Adeptsense.
+-- Autocompletion and documentation.
-M.sense = textadept.adeptsense.new('ansi_c')
-local as = textadept.adeptsense
-M.sense.ctags_kinds = {
- c = as.CLASS, d = as.FUNCTION, e = as.FIELD, f = as.FUNCTION, g = as.CLASS,
- m = as.FIELD, s = as.CLASS, t = as.CLASS
-}
-M.sense:load_ctags(_HOME..'/modules/ansi_c/tags', true)
-M.sense.api_files = {
- _HOME..'/modules/ansi_c/api', _HOME..'/modules/ansi_c/lua_api'
-}
-M.sense.syntax.type_declarations = {
- '([%w_%.]+)[%s%*&]+%_[^%w_]', -- Foo bar, Foo *bar, Foo* bar, Foo &bar, etc.
-}
-M.sense:add_trigger('.')
-M.sense:add_trigger('->')
+---
+-- List of ctags files to use for autocompletion.
+-- @class table
+-- @name tags
+-- @see textadept.editing.autocomplete
+M.tags = {_HOME..'/modules/ansi_c/tags', _USERHOME..'/modules/ansi_c/tags'}
--- Load user tags and apidoc.
-if lfs.attributes(_USERHOME..'/modules/ansi_c/tags') then
- M.sense:load_ctags(_USERHOME..'/modules/ansi_c/tags')
-end
-if lfs.attributes(_USERHOME..'/modules/ansi_c/api') then
- M.sense.api_files[#M.sense.api_files + 1] = _USERHOME..'/modules/ansi_c/api'
+local XPM = textadept.editing.XPM_IMAGES
+local xpms = setmetatable({
+ c = XPM.CLASS, d = XPM.SLOT, e = XPM.VARIABLE, f = XPM.METHOD,
+ g = XPM.TYPEDEF, m = XPM.VARIABLE, s = XPM.STRUCT, t = XPM.TYPEDEF,
+ v = XPM.VARIABLE
+}, {__index = function(t, k) return 0 end})
+
+textadept.editing.autocompleters.ansi_c = function()
+ local list = {}
+ -- Retrieve the symbol behind the caret.
+ local line, pos = buffer:get_cur_line()
+ local symbol, op, part = line:sub(1, pos):match('([%w_]-)([%.%->]*)([%w_]*)$')
+ if symbol == '' and part == '' and op ~= '' then return nil end -- lone ., ->
+ if op ~= '' and op ~= '.' and op ~= '->' then return nil end
+ -- Attempt to identify the symbol type.
+ local buffer = buffer
+ local declaration = '([%w_]+)[%s%*&]+'..symbol:gsub('(%p)', '%%%1')..'[^%w_]'
+ for i = buffer:line_from_position(buffer.current_pos) - 1, 0, -1 do
+ local class = buffer:get_line(i):match(declaration)
+ if class then symbol = class break end
+ end
+ -- Search through ctags for completions for that symbol.
+ local name_patt = '^'..part
+ for i = 1, #M.tags do
+ if lfs.attributes(M.tags[i]) then
+ for line in io.lines(M.tags[i]) do
+ local name = line:match('^%S+')
+ if name:find(name_patt) and not name:find('^!') and not list[name] then
+ local fields = line:match(';"\t(.*)$')
+ if (fields:match('class:(%S+)') or fields:match('enum:(%S+)') or
+ fields:match('struct:(%S+)') or fields:match('typedef:(%S+)') or
+ '') == symbol then
+ list[#list + 1] = ("%s?%d"):format(name, xpms[fields:sub(1, 1)])
+ list[name] = true
+ end
+ end
+ end
+ end
+ end
+ return #part, list
end
+textadept.editing.api_files.ansi_c = {
+ _HOME..'/modules/ansi_c/api', _USERHOME..'/modules/ansi_c/api'
+}
+
-- Commands.
---
@@ -75,64 +96,75 @@ keys.ansi_c = {
if type(snippets) == 'table' then
snippets.ansi_c = {
-- Lua snippets
- lf = 'static int %1(function)(lua_State *%2(lua)) {\n\t%0\n\treturn 0;\n}',
- ls = 'lua_State',
- lgf = 'lua_getfield(%1(lua), %2(-1), %3(field));',
- lgg = 'lua_getglobal(%1(lua), %2(global));',
- lgt = 'lua_gettable(%1(lua), %2(-2));',
- ltop = 'lua_gettop(%1(lua));',
- lib = 'lua_isboolean(%1(lua), %2(-1))',
- licf = 'lua_iscfunction(%1(lua), %2(-1))',
- lif = 'lua_isfunctionu(%1(lua), %2(-1))',
- linil = 'lua_isnil(%1(lua), %2(-1))',
- linone = 'lua_isnone(%1(lua), %2(-1))',
- linonen = 'lua_isnoneornil(%1(lua), %2(-1))',
- lin = 'lua_isnumber(%1(lua), %2(-1))',
- lis = 'lua_isstring(%1(lua), %2(-1))',
- lit = 'lua_istable(%1(lua), %2(-1))',
- lith = 'lua_isthread(%1(lua), %2(-1))',
- liu = 'lua_isuserdata(%1(lua), %2(-1))',
- llen = 'lua_rawlen(%1(lua), %2(-1))',
- lpop = 'lua_pop(%1(lua), %2(1));',
- lpb = 'lua_pushboolean(%1(lua), %2(boolean));',
- lpcc = 'lua_pushcclosure(%1(lua), %2(closure_func), %3(num_values));',
- lpcf = 'lua_pushcfunction(%1(lua), %2(cfunction));',
- lpi = 'lua_pushinteger(%1(lua), %2(integer));',
- lplu = 'lua_pushlightuserdata(%1(lua), %2(userdata));',
- lpnil = 'lua_pushnil(%1(lua));',
- lpn = 'lua_pushnumber(%1(lua), %2(number));',
- lps = 'lua_pushstring(%1(lua), %2(string));',
- lpth = 'lua_pushthread(%1(lua));',
- lpv = 'lua_pushvalue(%1(lua), %2(-1));',
- lrg = 'lua_rawget(%1(lua), %2(-2));',
- lrgi = 'lua_rawgeti(%1(lua), %2(-2), %3(1));',
- lrs = 'lua_rawset(%1(lua), %2(-3));',
- lrsi = 'lua_rawseti(%1(lua), %2(-2), %3(1));',
- lr = 'lua_register(%1(lua), %2(fname), %3(cfunction));',
- lsf = 'lua_setfield(%1(lua), %2(-2), %3(field));',
- lsg = 'lua_setglobal(%1(lua), %2(global));',
- lst = 'lua_settable(%1(lua), %2(-3));',
- ltb = 'lua_toboolean(%1(lua), %2(-1))',
- ltcf = 'lua_tocfunction(%1(lua), %2(-1))',
- lti = 'lua_tointeger(%1(lua), %2(-1))',
- ltn = 'lua_tonumber(%1(lua), %2(-1))',
- ltp = 'lua_topointer(%1(lua), %2(-1))',
- lts = 'lua_tostring(%1(lua), %2(-1))',
- ltth = 'lua_tothread(%1(lua), %2(-1))',
- ltu = 'lua_touserdata(%1(lua), %2(-1))',
- lt = 'lua_type(%1(lua), %2(-1))',
- llcint = 'luaL_checkint(%1(lua), %2(-1))',
- llci = 'luaL_checkinteger(%1(lua), %2(-1))',
- llcl = 'luaL_checklong(%1(lua), %2(-1))',
- llcn = 'luaL_checknumber(%1(lua), %2(-1))',
- llcs = 'luaL_checkstring(%1(lua), %2(-1))',
- llcu = 'luaL_checkudata(%1(lua), %2(-1), %3(mt_name))',
- llerr = 'luaL_error(%1(lua), %2(errorstring)%3(, %4(arg)));',
- lloint = 'luaL_optint(%1(lua), %2(-1), %3(default))',
- lloi = 'luaL_optinteger(%1(lua), %2(-1), %3(default))',
- llol = 'luaL_optlong(%1(lua), %2(-1), %3(default))',
- llon = 'luaL_optnumber(%1(lua), %2(-1), %3(default))',
- llos = 'luaL_optstring(%1(lua), %2(-1), %3(default))',
+ lc = 'lua_call(%1(L), %2(nargs), %3(nresults))',
+ lcs = 'lua_checkstack(%1(L), %2(1))',
+ lf = 'static int %1(func)(lua_State *%2(L)) {\n\t%0\n\treturn %3(0);\n}',
+ lgf = 'lua_getfield(%1(L), %2(-1), %3(field))',
+ lgg = 'lua_getglobal(%1(L), %2(global))',
+ lgmt = 'lua_getmetatable(%1(L), %2(-1))',
+ lgt = 'lua_gettable(%1(L), %2(-2))',
+ ltop = 'lua_gettop(%1(L))',
+ lib = 'lua_isboolean(%1(L), %2(-1))',
+ licf = 'lua_iscfunction(%1(L), %2(-1))',
+ lif = 'lua_isfunction(%1(L), %2(-1))',
+ lilu = 'lua_islightuserdata(%1(L), %2(-1))',
+ linil = 'lua_isnil(%1(L), %2(-1))',
+ linone = 'lua_isnone(%1(L), %2(-1))',
+ linonen = 'lua_isnoneornil(%1(L), %2(-1))',
+ lin = 'lua_isnumber(%1(L), %2(-1))',
+ lis = 'lua_isstring(%1(L), %2(-1))',
+ lit = 'lua_istable(%1(L), %2(-1))',
+ liu = 'lua_isuserdata(%1(L), %2(-1))',
+ llen = 'lua_len(%1(L), %2(-1))',
+ lrlen = 'lua_rawlen(%1(L), %2(-1))',
+ lnt = 'lua_newtable(%1(L))',
+ lnu = '(%3 *)lua_newuserdata(%1(L), %2(sizeof(%3(struct))))',
+ ln = 'lua_next(%1(L), %2(-2))',
+ lpc = 'lua_pcall(%1(L), %2(nargs), %3(nresults), %4(msgh))',
+ lpop = 'lua_pop(%1(L), %2(1))',
+ lpb = 'lua_pushboolean(%1(L), %2(bool))',
+ lpcc = 'lua_pushcclosure(%1(L), %2(cfunc), %3(nvalues))',
+ lpcf = 'lua_pushcfunction(%1(L), %2(cfunc))',
+ lpi = 'lua_pushinteger(%1(L), %2(integer))',
+ lplu = 'lua_pushlightuserdata(%1(L), %2(pointer))',
+ lpnil = 'lua_pushnil(%1(L))',
+ lpn = 'lua_pushnumber(%1(L), %2(number))',
+ lps = 'lua_pushstring(%1(L), %2(string))',
+ lpls = 'lua_pushlstring(%1(L), %2(string), %3(len))',
+ lpv = 'lua_pushvalue(%1(L), %2(-1))',
+ lrg = 'lua_rawget(%1(L), %2(-2))',
+ lrgi = 'lua_rawgeti(%1(L), %2(-2), %3(1))',
+ lrs = 'lua_rawset(%1(L), %2(-3))',
+ lrsi = 'lua_rawseti(%1(L), %2(-2), %3(1))',
+ lr = 'lua_register(%1(L), %2(name), %3(cfunc))',
+ lsf = 'lua_setfield(%1(L), %2(-2), %3(field))',
+ lsg = 'lua_setglobal(%1(L), %2(global))',
+ lsmt = 'lua_setmetatable(%1(L), %2(-2))',
+ lst = 'lua_settable(%1(L), %2(-3))',
+ ltb = 'lua_toboolean(%1(L), %2(-1))',
+ lti = 'lua_tointeger(%1(L), %2(-1))',
+ ltn = 'lua_tonumber(%1(L), %2(-1))',
+ ltls = 'lua_tolstring(%1(L), %2(-1), &%3(int))',
+ lts = 'lua_tostring(%1(L), %2(-1))',
+ ltu = '(%3 *)lua_touserdata(%1(L), %2(-1))',
+ lt = 'lua_type(%1(L), %2(-1))',
+ llac = 'luaL_argcheck(%1(L), %2(expr), %3(1), %4(extramsg))',
+ llci = 'luaL_checkinteger(%1(L), %2(1))',
+ llcl = 'luaL_checklong(%1(L), %2(1))',
+ llcls = 'luaL_checklstring(%1(L), %2(1), &%3(int))',
+ llcn = 'luaL_checknumber(%1(L), %2(1))',
+ llcs = 'luaL_checkstring(%1(L), %2(1))',
+ llcu = '(%4 *)luaL_checkudata(%1(L), %2(1), %3(mt_name))',
+ llerr = 'luaL_error(%1(L), %2(message)%3(, %4(arg)))',
+ llgmt = 'luaL_getmetatable(%1(L), %2(mt_name))',
+ llnmt = 'luaL_newmetatable(%1(L), %2(mt_name))',
+ lloi = 'luaL_optinteger(%1(L), %2(1), %3(default))',
+ llol = 'luaL_optlong(%1(L), %2(1), %3(default))',
+ llon = 'luaL_optnumber(%1(L), %2(1), %3(default))',
+ llos = 'luaL_optstring(%1(L), %2(1), %3(default))',
+ llref = 'luaL_ref(%1(L), %2(LUA_REGISTRYINDEX))',
+ llsmt = 'luaL_setmetatable(%1(L), %2(mt_name))',
+ lluref = 'luaL_unref(%1(L), %2(LUA_REGISTRYINDEX), %3(ref))',
}
end
diff --git a/modules/lua/api b/modules/lua/api
index 091c4553..d0bd8122 100644
--- a/modules/lua/api
+++ b/modules/lua/api
@@ -6,6 +6,7 @@ ANNOTATION_HIDDEN _SCINTILLA.constants.ANNOTATION_HIDDEN\n0
ANNOTATION_STANDARD _SCINTILLA.constants.ANNOTATION_STANDARD\n1
APPLEEVENT_ODOC events.APPLEEVENT_ODOC (string)\nEmitted when Mac OSX tells Textadept to open a file.\nArguments:\n\n* _`uri`_: The UTF-8-encoded URI to open.
ARG_NONE events.ARG_NONE (string)\nEmitted when no command line arguments are passed to Textadept on startup.
+AUTOCOMPLETE_ALL textadept.editing.AUTOCOMPLETE_ALL (bool)\nAutocomplete the current word using words from all open buffers.\nIf `true`, performance may be slow when many buffers are open.\nThe default value is `false`.
AUTOINDENT textadept.editing.AUTOINDENT (bool)\nMatch the previous line's indentation level after inserting a new line.\nThe default value is `true`.
AUTOMATICFOLD_CHANGE _SCINTILLA.constants.AUTOMATICFOLD_CHANGE\n4
AUTOMATICFOLD_CLICK _SCINTILLA.constants.AUTOMATICFOLD_CLICK\n2
@@ -38,8 +39,9 @@ CASE_LOWER _SCINTILLA.constants.CASE_LOWER\n2
CASE_MIXED _SCINTILLA.constants.CASE_MIXED\n0
CASE_UPPER _SCINTILLA.constants.CASE_UPPER\n1
CHAR_ADDED events.CHAR_ADDED (string)\nEmitted after the user types a text character into the buffer.\nArguments:\n\n* _`byte`_: The text character's byte.
+CHECK_SYNTAX _M.python.CHECK_SYNTAX (bool)\nWhether or not to invoke Python to check the syntax of the current file\nwhen saving it.\nThe default value is `true`.
CLASS lexer.CLASS (string)\nThe token name for class tokens.
-CLASS textadept.adeptsense.CLASS (string)\nCtags kind for Adeptsense classes.
+CLASS textadept.editing.XPM_IMAGES.CLASS (table)\nThe image number for classes.
CLEAR keys.CLEAR (string)\nThe key that clears the current key chain.\nIt cannot be part of a key chain.\nThe default value is `'esc'` for the `Esc` (`⎋` on Mac OSX | `Esc` in\ncurses) key.
COMMAND_ENTRY_KEYPRESS events.COMMAND_ENTRY_KEYPRESS (string)\nEmitted when pressing a key in the command entry.\nIf any handler returns `true`, the key is not inserted into the entry.\nArguments:\n\n* _`code`_: The numeric key code.\n* _`shift`_: The "Shift" modifier key is held down.\n* _`ctrl`_: The "Control" modifier key is held down.\n* _`alt`_: The "Alt"/"Option" modifier key is held down.\n* _`meta`_: The "Command" modifier key on Mac OSX is held down.
COMMENT lexer.COMMENT (string)\nThe token name for comment tokens.
@@ -62,6 +64,7 @@ Cs lpeg.Cs(patt)\nCreates a substitution capture, which captures the substring o
Ct lpeg.Ct(patt)\nCreates a table capture. This capture creates a table and puts all values\nfrom all anonymous captures made by `patt` inside this table in successive\ninteger keys, starting at 1. Moreover, for each named capture group created\nby `patt`, the first value of the group is put into the table with the group\nname as its key. The captured value is only the table.
DEFAULT lexer.DEFAULT (string)\nThe token name for default tokens.
DEFAULT_SESSION textadept.session.DEFAULT_SESSION (string)\nThe path to the default session file, *`_USERHOME`/session*, or\n*`_USERHOME`/session_term* if `_G.CURSES` is `true`.
+DOCUTILS_PATH _M.rest.DOCUTILS_PATH (string)\nThe absolute path to the directory that contains the Python Docutils\nlibrary if it is not in the environment's `PYTHONPATH`.\nThe default value is `nil`, which indicates Docutils is installed.
DOUBLE_CLICK events.DOUBLE_CLICK (string)\nEmitted after double-clicking the mouse button.\nArguments:\n\n* _`position`_: The position double-clicked.\n* _`line`_: The line number of the position double-clicked.\n* _`modifiers`_: A bit-mask of any modifier keys used: `buffer.MOD_CTRL`,\n `buffer.MOD_SHIFT`, `buffer.MOD_ALT`, and `buffer.MOD_META`.\n Note: If you set `buffer.rectangular_selection_modifier` to\n `buffer.MOD_CTRL`, the "Control" modifier is reported as *both* "Control"\n and "Alt" due to a Scintilla limitation with GTK+.
DWELL_END events.DWELL_END (string)\nEmitted after `DWELL_START` when the user moves the mouse, presses a key,\nor scrolls the view.\nArguments:\n\n* _`position`_: The position closest to *x* and *y*.\n* _`x`_: The x-coordinate of the mouse in the view.\n* _`y`_: The y-coordinate of the mouse in the view.
DWELL_START events.DWELL_START (string)\nEmitted when the mouse is stationary for `buffer.mouse_dwell_time`\nmilliseconds.\nArguments:\n\n* _`position`_: The position closest to *x* and *y*.\n* _`x`_: The x-coordinate of the mouse in the view.\n* _`y`_: The y-coordinate of the mouse in the view.
@@ -73,8 +76,6 @@ EOL_CRLF _SCINTILLA.constants.EOL_CRLF\n0
EOL_LF _SCINTILLA.constants.EOL_LF\n2
ERROR events.ERROR (string)\nEmitted when an error occurs.\nArguments:\n\n* _`text`_: The error message text.
ERROR lexer.ERROR (string)\nThe token name for error tokens.
-FIELD textadept.adeptsense.FIELD (string)\nCtags kind for Adeptsense fields.
-FIELD_IMAGE textadept.adeptsense.FIELD_IMAGE (string)\nXPM image for Adeptsense fields.
FILE_AFTER_SAVE events.FILE_AFTER_SAVE (string)\nEmitted right after saving a file to disk.\nEmitted by `io.save_file()`.\nArguments:\n\n* _`filename`_: The filename of the file being saved.
FILE_BEFORE_SAVE events.FILE_BEFORE_SAVE (string)\nEmitted right before saving a file to disk.\nEmitted by `io.save_file()`.\nArguments:\n\n* _`filename`_: The filename of the file being saved.
FILE_CHANGED events.FILE_CHANGED (string)\nEmitted when Textadept detects that an open file was modified externally.\nWhen connecting to this event, connect with an index of 1 to override the\ndefault prompt to reload the file.\nArguments:\n\n* _`filename`_: The filename externally modified.
@@ -96,6 +97,7 @@ FOLDFLAG_LINEAFTER_CONTRACTED _SCINTILLA.constants.FOLDFLAG_LINEAFTER_CONTRACTED
FOLDFLAG_LINEAFTER_EXPANDED _SCINTILLA.constants.FOLDFLAG_LINEAFTER_EXPANDED\n8
FOLDFLAG_LINEBEFORE_CONTRACTED _SCINTILLA.constants.FOLDFLAG_LINEBEFORE_CONTRACTED\n4
FOLDFLAG_LINEBEFORE_EXPANDED _SCINTILLA.constants.FOLDFLAG_LINEBEFORE_EXPANDED\n2
+FOLDFLAG_LINESTATE _SCINTILLA.constants.FOLDFLAG_LINESTATE\n128
FOLDLEVELBASE _SCINTILLA.constants.FOLDLEVELBASE\n1024
FOLDLEVELHEADERFLAG _SCINTILLA.constants.FOLDLEVELHEADERFLAG\n8192
FOLDLEVELNUMBERMASK _SCINTILLA.constants.FOLDLEVELNUMBERMASK\n4095
@@ -104,8 +106,6 @@ FOLD_BASE lexer.FOLD_BASE (number)\nThe initial (root) fold level.
FOLD_BLANK lexer.FOLD_BLANK (number)\nFlag indicating that the line is blank.
FOLD_HEADER lexer.FOLD_HEADER (number)\nFlag indicating the line is fold point.
FUNCTION lexer.FUNCTION (string)\nThe token name for function tokens.
-FUNCTION textadept.adeptsense.FUNCTION (string)\nCtags kind for Adeptsense functions.
-FUNCTION_IMAGE textadept.adeptsense.FUNCTION_IMAGE (string)\nXPM image for Adeptsense functions.
HIGHLIGHT_BRACES textadept.editing.HIGHLIGHT_BRACES (bool)\nHighlight matching brace characters like "()[]{}".\nThe default value is `true`.\nMatching braces are defined in the `braces` table.
HOTSPOT_CLICK events.HOTSPOT_CLICK (string)\nEmitted when clicking on text that is in a style that has the hotspot\nattribute set.\nArguments:\n\n* _`position`_: The clicked text's position.\n* _`modifiers`_: A bit-mask of any modifier keys used: `buffer.MOD_CTRL`,\n `buffer.MOD_SHIFT`, `buffer.MOD_ALT`, and `buffer.MOD_META`.\n Note: If you set `buffer.rectangular_selection_modifier` to\n `buffer.MOD_CTRL`, the "Control" modifier is reported as *both* "Control"\n and "Alt" due to a Scintilla limitation with GTK+.
HOTSPOT_DOUBLE_CLICK events.HOTSPOT_DOUBLE_CLICK (string)\nEmitted when double-clicking on text that is in a style that has the\nhotspot attribute set.\nArguments:\n\n* _`position`_: The double-clicked text's position.\n* _`modifiers`_: A bit-mask of any modifier keys used: `buffer.MOD_CTRL`,\n `buffer.MOD_SHIFT`, `buffer.MOD_ALT`, and `buffer.MOD_META`.\n Note: If you set `buffer.rectangular_selection_modifier` to\n `buffer.MOD_CTRL`, the "Control" modifier is reported as *both* "Control"\n and "Alt" due to a Scintilla limitation with GTK+.
@@ -202,8 +202,9 @@ MASK_FOLDERS _SCINTILLA.constants.MASK_FOLDERS\n-33554432
MAX_MARGIN _SCINTILLA.constants.MAX_MARGIN\n4
MAX_RECENT_FILES textadept.session.MAX_RECENT_FILES (number)\nThe maximum number of recent files to save in session files.\nRecent files are stored in `io.recent_files`.\nThe default value is `10`.
MENU_CLICKED events.MENU_CLICKED (string)\nEmitted after selecting a menu item.\nArguments:\n\n* _`menu_id`_: The numeric ID of the menu item set in `ui.menu()`.
+METHOD textadept.editing.XPM_IMAGES.METHOD (table)\nThe image number for methods.
MODE keys.MODE (string)\nThe current key mode.\nWhen non-`nil`, all key bindings defined outside of `keys[MODE]` are\nignored.\nThe default value is `nil`.
-MODEVENTMASKALL _SCINTILLA.constants.MODEVENTMASKALL\n1048575
+MODEVENTMASKALL _SCINTILLA.constants.MODEVENTMASKALL\n2097151
MOD_ALT _SCINTILLA.constants.MOD_ALT\n4
MOD_BEFOREDELETE _SCINTILLA.constants.MOD_BEFOREDELETE\n2048
MOD_BEFOREINSERT _SCINTILLA.constants.MOD_BEFOREINSERT\n1024
@@ -217,16 +218,20 @@ MOD_CHANGESTYLE _SCINTILLA.constants.MOD_CHANGESTYLE\n4
MOD_CONTAINER _SCINTILLA.constants.MOD_CONTAINER\n262144
MOD_CTRL _SCINTILLA.constants.MOD_CTRL\n2
MOD_DELETETEXT _SCINTILLA.constants.MOD_DELETETEXT\n2
+MOD_INSERTCHECK _SCINTILLA.constants.MOD_INSERTCHECK\n1048576
MOD_INSERTTEXT _SCINTILLA.constants.MOD_INSERTTEXT\n1
MOD_LEXERSTATE _SCINTILLA.constants.MOD_LEXERSTATE\n524288
MOD_META _SCINTILLA.constants.MOD_META\n16
MOD_NORM _SCINTILLA.constants.MOD_NORM\n0
MOD_SHIFT _SCINTILLA.constants.MOD_SHIFT\n1
MOD_SUPER _SCINTILLA.constants.MOD_SUPER\n8
+MULTIAUTOC_EACH _SCINTILLA.constants.MULTIAUTOC_EACH\n1
+MULTIAUTOC_ONCE _SCINTILLA.constants.MULTIAUTOC_ONCE\n0
MULTILINEUNDOREDO _SCINTILLA.constants.MULTILINEUNDOREDO\n4096
MULTIPASTE_EACH _SCINTILLA.constants.MULTIPASTE_EACH\n1
MULTIPASTE_ONCE _SCINTILLA.constants.MULTIPASTE_ONCE\n0
MULTISTEPUNDOREDO _SCINTILLA.constants.MULTISTEPUNDOREDO\n128
+NAMESPACE textadept.editing.XPM_IMAGES.NAMESPACE (table)\nThe image number for namespaces.
NUMBER lexer.NUMBER (string)\nThe token name for number tokens.
OPERATOR lexer.OPERATOR (string)\nThe token name for operator tokens.
ORDER_CUSTOM _SCINTILLA.constants.ORDER_CUSTOM\n2
@@ -282,11 +287,14 @@ SEL_LINES _SCINTILLA.constants.SEL_LINES\n2
SEL_RECTANGLE _SCINTILLA.constants.SEL_RECTANGLE\n1
SEL_STREAM _SCINTILLA.constants.SEL_STREAM\n0
SEL_THIN _SCINTILLA.constants.SEL_THIN\n3
+SIGNAL textadept.editing.XPM_IMAGES.SIGNAL (table)\nThe image number for signals.
SILENT_PRINT ui.SILENT_PRINT (bool)\nWhether or not to print messages to buffers silently.\nThe default value is `false`, and focuses buffers when messages are printed\nto them.
+SLOT textadept.editing.XPM_IMAGES.SLOT (table)\nThe image number for slots.
SNAPOPEN_MAX io.SNAPOPEN_MAX (number)\nThe maximum number of files listed in the snapopen dialog.\nThe default value is `1000`.
STARTACTION _SCINTILLA.constants.STARTACTION\n8192
STRING lexer.STRING (string)\nThe token name for string tokens.
STRIP_TRAILING_SPACES textadept.editing.STRIP_TRAILING_SPACES (bool)\nStrip trailing whitespace before saving files.\nThe default value is `false`.
+STRUCT textadept.editing.XPM_IMAGES.STRUCT (table)\nThe image number for structures.
STYLE_BRACEBAD _SCINTILLA.constants.STYLE_BRACEBAD\n35
STYLE_BRACEBAD lexer.STYLE_BRACEBAD (string)\nThe style used for unmatched brace characters.
STYLE_BRACELIGHT _SCINTILLA.constants.STYLE_BRACELIGHT\n34
@@ -322,6 +330,7 @@ STYLE_VARIABLE lexer.STYLE_VARIABLE (string)\nThe style typically used for varia
STYLE_WHITESPACE lexer.STYLE_WHITESPACE (string)\nThe style typically used for whitespace.
TIME_FOREVER _SCINTILLA.constants.TIME_FOREVER\n10000000
TYPE lexer.TYPE (string)\nThe token name for type tokens.
+TYPEDEF textadept.editing.XPM_IMAGES.TYPEDEF (table)\nThe image number for type definitions.
TYPEOVER_CHARS textadept.editing.TYPEOVER_CHARS (bool)\nMove over closing brace and quote characters under the caret when typing\nthem.\nThe default value is `true`.\nTypeover characters are defined in the `typeover_chars`\ntable.
UPDATE_CONTENT _SCINTILLA.constants.UPDATE_CONTENT\n1
UPDATE_H_SCROLL _SCINTILLA.constants.UPDATE_H_SCROLL\n8
@@ -332,6 +341,7 @@ URI_DROPPED events.URI_DROPPED (string)\nEmitted after dragging and dropping a U
USER_LIST_SELECTION events.USER_LIST_SELECTION (string)\nEmitted after selecting an item in a user list.\nArguments:\n\n* _`id`_: The *id* from `buffer:user_list_show()`.\n* _`text`_: The selection's text.\n* _`position`_: The position the list was displayed at.
V lpeg.V(v)\nThis operation creates a non-terminal (a variable) for a grammar. The created\nnon-terminal refers to the rule indexed by `v` in the enclosing grammar. (See\nGrammars for details.)
VARIABLE lexer.VARIABLE (string)\nThe token name for variable tokens.
+VARIABLE textadept.editing.XPM_IMAGES.VARIABLE (table)\nThe image number for variables.
VIEW_AFTER_SWITCH events.VIEW_AFTER_SWITCH (string)\nEmitted right after switching to another view.\nEmitted by `ui.goto_view()`.
VIEW_BEFORE_SWITCH events.VIEW_BEFORE_SWITCH (string)\nEmitted right before switching to another view.\nEmitted by `ui.goto_view()`.
VIEW_NEW events.VIEW_NEW (string)\nEmitted after creating a new view.\nEmitted on startup and by `view:split()`.
@@ -359,6 +369,7 @@ WRAP_WORD _SCINTILLA.constants.WRAP_WORD\n1
WS_INVISIBLE _SCINTILLA.constants.WS_INVISIBLE\n0
WS_VISIBLEAFTERINDENT _SCINTILLA.constants.WS_VISIBLEAFTERINDENT\n2
WS_VISIBLEALWAYS _SCINTILLA.constants.WS_VISIBLEALWAYS\n1
+XPM_IMAGES textadept.editing.XPM_IMAGES (table)\nMap of image names to registered image numbers.
_BUFFERS _G._BUFFERS (table)\nTable of all open buffers in Textadept.\nNumeric keys have buffer values and buffer keys have their associated numeric\nkeys.\n@see _G.buffer
_CHARSET _G._CHARSET (string)\nThe filesystem's character encoding.\nThis is used when working with files.
_G _G._G (module)\nLua _G module.
@@ -389,7 +400,6 @@ abspath lfs.abspath(filename, prefix)\nReturns the absolute path to string *file
acos math.acos(x)\nReturns the arc cosine of `x` (in radians).
add_selection buffer.add_selection(buffer, end_pos, start_pos)\nSelects the range of text between positions *start_pos* to *end_pos* as the\nmain selection, retaining all other selections as additional selections.\nSince an empty selection still counts as a selection, use\n`buffer:set_selection()` first when setting a list of selections.\n@param buffer A buffer.\n@param end_pos The caret position of the range of text to select in *buffer*.\n@param start_pos The anchor position of the range of text to select in\n *buffer*.
add_text buffer.add_text(buffer, text)\nAdds string *text* to the buffer at the caret position and moves the caret to\nthe end of the added text without scrolling it into view.\n@param buffer A buffer.\n@param text The text to add.
-add_trigger textadept.adeptsense.add_trigger(sense, c, only_fields, only_functions)\nAllows the user to autocomplete the symbol behind the caret by typing\ncharacter(s) *c*.\nIf either *only_fields* or *only_functions* is `true`, displays the\nappropriate subset of completions.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@param c The character(s) that triggers the autocompletion. You can have up\n to two characters.\n@param only_fields Optional flag indicating whether or not this trigger only\n completes fields. The default value is `false`.\n@param only_functions Optional flag indicating whether or not this trigger\n only completes functions. The default value is `false`.\n@usage sense:add_trigger('.')\n@usage sense:add_trigger(':', false, true) -- only functions\n@usage sense:add_trigger('->')
additional_caret_fore buffer.additional_caret_fore (number)\nThe foreground color, in "0xBBGGRR" format, of additional carets.
additional_carets_blink buffer.additional_carets_blink (bool)\nAllow additional carets to blink.\nThe default value is `true`.
additional_carets_visible buffer.additional_carets_visible (bool)\nDisplay additional carets.\nThe default value is `true`.
@@ -397,12 +407,10 @@ additional_sel_alpha buffer.additional_sel_alpha (number)\nThe alpha value, rang
additional_sel_back buffer.additional_sel_back (number, Write-only)\nThe background color, in "0xBBGGRR" format, of additional selections.\nThis field has no effect when calling `buffer:set_sel_back(false, ...)`.
additional_sel_fore buffer.additional_sel_fore (number, Write-only)\nThe foreground color, in "0xBBGGRR" format, of additional selections.\nThis field has no effect when calling `buffer:set_sel_fore(false, ...)`.
additional_selection_typing buffer.additional_selection_typing (bool)\nType into multiple selections.\nThe default value is `false`.
-adeptsense textadept.adeptsense (module)\nCode autocompletion and documentation support for programming languages.
all_lines_visible buffer.all_lines_visible (bool, Read-only)\nWhether or not all lines are visible.
allocate_extended_styles buffer.allocate_extended_styles(buffer, num_styles)\nAllocates an additional *num_styles* number of styles for use by margins or\nannotations and returns the starting style number of the new range.\nThese styles are outside the 0..255 range used by lexers.\n@param buffer A buffer\n@param num_styles The number of additional styles to allocate.\n@return number\n@see annotation_style_offset\n@see margin_style_offset
alnum lexer.alnum (pattern)\nA pattern that matches any alphanumeric character ('A'-'Z', 'a'-'z',\n '0'-'9').
alpha lexer.alpha (pattern)\nA pattern that matches any alphabetic character ('A'-'Z', 'a'-'z').
-always_show_globals textadept.adeptsense.always_show_globals (bool)\nInclude globals in the list of completions offered.\nGlobals are classes, functions, and fields that do not belong to another\nclass. They are contained in `sense.completions['']`.\nThe default value is `true`.
anchor buffer.anchor (number)\nThe anchor's position.
annotation_clear_all buffer.annotation_clear_all(buffer)\nClears annotations from all lines.\n@param buffer A buffer.
annotation_lines buffer.annotation_lines (table, Read-only)\nTable of the number of annotation text lines for line numbers starting from\nzero.
@@ -414,7 +422,7 @@ ansi_c _G.keys.ansi_c (table)\nTable of C-specific key bindings.
ansi_c _G.snippets.ansi_c (table)\nTable of C-specific snippets.
ansi_c _M.ansi_c (module)\nThe ansi_c module.\nIt provides utilities for editing C code.
any lexer.any (pattern)\nA pattern that matches any single character.
-api_files textadept.adeptsense.api_files (table)\nA list of api files used by `show_apidoc()`.\nEach line in the api file contains a symbol name (not the full symbol)\nfollowed by a space character and then the symbol's documentation. Since\nthere may be many duplicate symbol names, it is recommended to put the full\nsymbol and arguments, if any, on the first line. (e.g. `Class.function(arg1,\narg2, ...)`). This allows the correct documentation to be shown based on the\ncurrent context. In the documentation, newlines are represented with "\n". A\n'\' before "\n" escapes the newline.
+api_files textadept.editing.api_files (table)\nMap of lexer names to API documentation file tables.\nEach line in an API file consists of the name of a symbol (not the full\nsymbol), a space character, and that symbol's documentation. '\n' represents\na newline character.\n@see document_symbol
append_text buffer.append_text(buffer, text)\nAppends string *text* to the end of the buffer without modifying any existing\nselections or scrolling the text into view.\n@param buffer A buffer.\n@param text The text to append.
arg _G.arg (table)\nTable of command line parameters passed to Textadept.\n@see _G.args
args _G.args (module)\nProcesses command line arguments for Textadept.
@@ -446,7 +454,8 @@ auto_c_separator buffer.auto_c_separator (number)\nThe byte value of the charact
auto_c_show buffer.auto_c_show(buffer, len_entered, items)\nDisplays an autocompletion list constructed from string *items* (whose items\nare delimited by `buffer.auto_c_separator` characters) using *len_entered*\nnumber of characters behind the caret as the prefix of the word to be\nautocompleted.\nThe sorted order of *items* (`buffer.auto_c_order`) must have already been\ndefined.\n@param buffer A buffer.\n@param len_entered The number of characters before the caret used to provide\n the context.\n@param items The sorted string of words to show, separated by\n `buffer.auto_c_separator` characters (initially spaces).
auto_c_stops buffer.auto_c_stops(buffer, chars)\nAllows the user to type any character in string set *chars* in order to\ncancel an autocompletion or user list.\nThe default set is empty.\n@param buffer A buffer.\n@param chars The string of characters that cancel autocompletion. This string\n is empty by default.
auto_c_type_separator buffer.auto_c_type_separator (number)\nThe character byte that separates autocompletion and user list items and\ntheir image types.\nAutocompletion and user list items can display both an image and text.\nRegister images and their types using\n`buffer:register_image()` or\n`buffer:register_rgba_image()` before appending\nimage types to list items after type separator characters.\nThe default value is 63 ('?').
-autocomplete_word textadept.editing.autocomplete_word(words)\nDisplays an autocompletion list for the word behind the caret, returning\n`true` if completions were found.\nThe displayed list is built from existing words in the buffer and the set of\nwords in string *words*.\n@param words Optional list of words considered to be in the buffer,\n even if they are not. Words may contain registered images.\n@return `true` if there were completions to show; `false` otherwise.\n@see buffer.word_chars
+autocomplete textadept.editing.autocomplete(name)\nDisplays an autocompletion list provided by the autocompleter function\nassociated with string *name*, and returns `true` if completions were found.\n@param name The name of an autocompleter function in the `autocompleters`\n table to use for providing autocompletions.\n@see autocompleters
+autocompleters textadept.editing.autocompleters (table)\nMap of autocompleter names to autocompletion functions.\nNames are typically lexer names and autocompletion functions typically\nautocomplete symbols.\nAutocompletion functions must return two values: the number of characters\nbehind the caret that are used as the prefix of the entity to autocomplete,\nand a list of completions to show. Autocompletion lists are sorted\nautomatically.\n@see autocomplete
back_space_un_indents buffer.back_space_un_indents (bool)\nUn-indent text when backspacing within indentation.\nThe default value is `false`.
back_tab buffer.back_tab(buffer)\nUn-indents the text on the selected lines.\n@param buffer A buffer.
band bit32.band(...)\nReturns the bitwise "and" of its operands.
@@ -505,9 +514,7 @@ char_right_extend buffer.char_right_extend(buffer)\nMoves the caret right one ch
char_right_rect_extend buffer.char_right_rect_extend(buffer)\nMoves the caret right one character, extending the rectangular selection to\nthe new position.\n@param buffer A buffer.
chdir lfs.chdir(path)\nChanges the current working directory to the given path.\n\nReturns true in case of success or nil plus an error string.
choose_caret_x buffer.choose_caret_x(buffer)\nIdentifies the current horizontal caret position as the caret's preferred\nhorizontal position when moving between lines.\n@param buffer A buffer.\n@see caret_sticky
-class_definition textadept.adeptsense.syntax.class_definition (table)\nA Lua pattern representing the language's class\n definition syntax. The first capture returned must be the class name. A\n second, optional capture contains the class's superclass (if any). If no\n completions are found for the class name, completions for the superclass\n are shown (if any). Completions will not be shown for both a class and\n superclass unless defined in a previously loaded Ctags file. Also, multiple\n superclasses cannot be recognized by this pattern; use a Ctags file\n instead. The default value is `'class%s+([%w_]+)'`.
clear buffer.clear(buffer)\nDeletes the selected text or the character at the caret.\n@param buffer A buffer.
-clear textadept.adeptsense.clear(sense)\nClears the Adeptsense for loading new Ctags or project files.\n@param sense The Adeptsense returned by `adeptsense.new()`.
clear textadept.bookmarks.clear()\nClears all bookmarks in the current buffer.
clear_all buffer.clear_all(buffer)\nDeletes the buffer's text.\n@param buffer A buffer.
clear_document_style buffer.clear_document_style(buffer)\nClears all styling and folding information.\n@param buffer A buffer.
@@ -528,9 +535,7 @@ command_entry ui.command_entry (module)\nTextadept's Command Entry.
comment_string textadept.editing.comment_string (table)\nMap of lexer names to line comment strings for programming languages, used by\nthe `block_comment()` function.\nKeys are lexer names and values are either the language's line comment\nprefixes or block comment delimiters separated by a '|' character.\n@see block_comment
compile textadept.run.compile()\nCompiles the current file based on its extension or language, using the\nshell command from the `compile_commands` table.\nEmits `COMPILE_OUTPUT` events.\n@see compile_commands\n@see _G.events
compile_commands textadept.run.compile_commands (table)\nMap of file extensions or lexer names to their associated "compile" shell\ncommand line strings or functions that return such strings.\nCommand line strings may have the following macros:\n\n + `%f` or `%(filename)`: The file's name, including its extension.\n + `%e` or `%(filename_noext)`: The file's name, excluding its extension.\n + `%d` or `%(filedir)`: The current file's directory path.\n + `%(filepath)`: The current file's full path.
-complete textadept.adeptsense.complete(sense, only_fields, only_functions)\nShows an autocompletion list for the symbol behind the caret, returning\n`true` on success.\nIf either *only_fields* or *only_functions* is `true`, displays the\nappropriate subset of completions.\n@param sense The Adeptsense returned by `adeptsense.new()`. If `nil`, uses\n the current language's Adeptsense (if it exists).\n@param only_fields Optional flag indicating whether or not to return a list\n of only fields. The default value is `false`.\n@param only_functions Optional flag indicating whether or not to return a\n list of only functions. The default value is `false`.\n@return `true` on success or `false`.\n@see get_symbol\n@see get_completions
complete_lua ui.command_entry.complete_lua(code)\nShows a set of Lua code completions for string *code* or `entry_text`.\nCompletions are subject to an "abbreviated" environment where the `buffer`,\n`view`, and `ui` tables are also considered as globals.\n@param code The Lua code to complete. The default value is the value of\n `entry_text`.
-completions textadept.adeptsense.completions (table)\nA list containing lists of possible completions for known symbols.\nEach symbol key has a table value that contains a list of field completions\nwith a `fields` key and a list of functions completions with a `functions`\nkey. This table is normally populated by `load_ctags()`, but can also be set\nby the user.
concat table.concat(list [, sep [, i [, j]]])\nGiven a list where all elements are strings or numbers, returns the string\n`list[i]..sep..list[i+1] ··· sep..list[j]`. The default value for `sep` is\nthe empty string, the default for `i` is 1, and the default for `j` is\n`#list`. If `i` is greater than `j`, returns the empty string.
config package.config (string)\nA string describing some compile-time configurations for packages. This\nstring is a sequence of lines:\n The first line is the directory separator string. Default is '`\`' for\n Windows and '`/`' for all other systems.\n The second line is the character that separates templates in a path.\n Default is '`;`'.\n The third line is the string that marks the substitution points in a\n template. Default is '`?`'.\n The fourth line is a string that, in a path in Windows, is replaced by\n the executable's directory. Default is '`!`'.\n The fifth line is a mark to ignore all text before it when building the\n `luaopen_` function name. Default is '`-`'.
connect events.connect(event, f, index)\nAdds function *f* to the set of event handlers for event *event* at position\n*index*.\nIf *index* not given, appends *f* to the set of handlers. *event* may be any\narbitrary string and does not need to have been previously defined.\n@param event The string event name.\n@param f The Lua function to connect to *event*.\n@param index Optional index to insert the handler into.\n@usage events.connect('my_event', function(msg) ui.print(msg) end)\n@see disconnect
@@ -554,7 +559,6 @@ create coroutine.create(f)\nCreates a new coroutine, with body `f`. `f` must be
css _G.keys.css (table)\nContainer for CSS-specific key bindings.
css _G.snippets.css (table)\nContainer for CSS-specific snippets.
css _M.css (module)\nThe css module.\nIt provides utilities for editing CSS code.
-ctags_kinds textadept.adeptsense.ctags_kinds (table)\nA map of Ctags kinds to Adeptsense types.\nRecognized types are `FUNCTION`, `FIELD`, and `CLASS`. Classes are quite\nsimply containers for functions and fields so Lua modules would count as\nclasses. Any other kinds will be passed to `handle_ctag()` for user-defined\nhandling.\n@see handle_ctag
current_pos buffer.current_pos (number)\nThe caret's position.\nWhen set, does not scroll the caret into view.
currentdir lfs.currentdir()\nReturns a string with the current working directory or nil plus an error\nstring.
cursor buffer.cursor (number)\nThe display cursor type.\n\n* `buffer.CURSORNORMAL`\n The text insert cursor.\n* `buffer.CURSORARROW`\n The arrow cursor.\n* `buffer.CURSORWAIT`\n The wait cursor.\n* `buffer.CURSORREVERSEARROW`\n The reversed arrow cursor.\n\nThe default value is `buffer.CURSORNORMAL`.
@@ -618,6 +622,7 @@ execute os.execute([command])\nThis function is equivalent to the ANSI C functio
execute_lua ui.command_entry.execute_lua(code)\nExecutes string *code* as Lua code that is subject to an "abbreviated"\nenvironment.\nIn this environment, the contents of the `buffer`, `view`, and `ui` tables\nare also considered as global functions and fields.\nPrints the results of '=' expressions like in the Lua prompt.\n@param code The Lua code to execute.
exit os.exit([code [, close]])\nCalls the ANSI C function `exit` to terminate the host program. If `code` is\n`true`, the returned status is `EXIT_SUCCESS`; if `code` is `false`, the\nreturned status is `EXIT_FAILURE`; if `code` is a number, the returned status\nis this number. The default value for `code` is `true`.\n\nIf the optional second argument `close` is true, closes the Lua state before\nexiting.
exp math.exp(x)\nReturns the value *e^x*.
+expr_types _M.lua.expr_types (table)\nMap of expression patterns to their types.\nExpressions are expected to match after the '=' sign of a statement.
extend lexer.extend (pattern)\nA pattern that matches any ASCII extended character (codes 0 to 255).
extensions textadept.file_types.extensions (table)\nMap of file extensions to their associated lexer names.\nIf the file type is not recognized by shebang words or first-line patterns,\neach file extension is matched against the file's extension.
extra_ascent buffer.extra_ascent (number)\nThe amount of pixel padding above lines.\nThe default value is `0`.
@@ -663,9 +668,6 @@ form_feed buffer.form_feed(buffer)\nTypes a Form Feed character ("\f") at the ca
format string.format(formatstring, ···)\nReturns a formatted version of its variable number of arguments following the\ndescription given in its first argument (which must be a string). The format\nstring follows the same rules as the ANSI C function `sprintf`. The only\ndifferences are that the options/modifiers `*`, `h`, `L`, `l`, `n`, and `p`\nare not supported and that there is an extra option, `q`. The `q` option\nformats a string between double quotes, using escape sequences when necessary\nto ensure that it can safely be read back by the Lua interpreter. For\ninstance, the call\n\n string.format('%q', 'a string with "quotes" and \n new line')\n\nmay produce the string:\n\n "a string with \"quotes\" and \\n new line"\n\nOptions `A` and `a` (when available), `E`, `e`, `f`, `G`, and `g` all expect\na number as argument. Options `c`, `d`, `i`, `o`, `u`, `X`, and `x` also\nexpect a number, but the range of that number may be limited by the\nunderlying C implementation. For options `o`, `u`, `X`, and `x`, the number\ncannot be negative. Option `q` expects a string; option `s` expects a string\nwithout embedded zeros. If the argument to option `s` is not a string, it is\nconverted to one following the same rules of `tostring`.
frexp math.frexp(x)\nReturns `m` and `e` such that 'x = m2^e', `e` is an integer and the\nabsolute value of `m` is in the range *[0.5, 1)* (or zero when `x` is zero).
functions _SCINTILLA.functions (table)\nMap of Scintilla function names to tables containing their IDs, return types,\nwParam types, and lParam types. Types are as follows:\n\n + `0`: Void.\n + `1`: Integer.\n + `2`: Length of the given lParam string.\n + `3`: Integer position.\n + `4`: Color, in "0xBBGGRR" format.\n + `5`: Boolean `true` or `false`.\n + `6`: Bitmask of Scintilla key modifiers and a key value.\n + `7`: String parameter.\n + `8`: String return value.
-get_apidoc textadept.adeptsense.get_apidoc(sense, symbol)\nReturns the list of API documentation strings for string *symbol*.\nA `pos` key in that list holds the index of the documentation string that\nshould be shown.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@param symbol The symbol name to get apidocs for.\n@return list of apidocs or `nil`
-get_class textadept.adeptsense.get_class(sense, symbol)\nReturns the class type of *symbol* name.\nIf *symbol* is `sense.syntax.self` and occurs inside a class definition that\nmatches `sense.syntax.class_definition`, that class is returned. Otherwise,\nthe buffer is searched backwards for either a type declaration of *symbol*\naccording to the patterns in `sense.syntax.type_declarations`, or for a type\nassignment of *symbol* according to `sense.syntax.type_assignments`,\nwhichever comes first.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@param symbol The symbol name to get the class of.\n@return class or `nil`\n@see syntax
-get_completions textadept.adeptsense.get_completions(sense, symbol, only_fields, only_functions)\nReturns the list of completions for string *symbol*.\nIf either *only_fields* or *only_functions* is `true`, returns the\nappropriate subset of completions.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@param symbol The symbol name to get completions for.\n@param only_fields Optional flag indicating whether or not to return a list\n of only fields. The default value is `false`.\n@param only_functions Optional flag indicating whether or not to return a\n list of only functions. The default value is `false`.\n@return completion_list or `nil`
get_cur_line buffer.get_cur_line(buffer)\nReturns the current line's text and the caret's position on that line,\nstarting from zero.\n@param buffer A buffer.\n@return string, number
get_hotspot_active_back buffer.get_hotspot_active_back(buffer)\nReturns the numeric background color of active hotspots.\n@param buffer A buffer.\n@return number
get_hotspot_active_fore buffer.get_hotspot_active_fore(buffer)\nReturns the numeric foreground color of active hotspots.\n@param buffer A buffer.\n@return number
@@ -677,7 +679,6 @@ get_line_sel_start_position buffer.get_line_sel_start_position(buffer, line)\nRe
get_project_root io.get_project_root(path)\nReturns the root directory of the project that contains filesystem path\n*path*.\nIn order to be recognized, projects must be under version control. Recognized\nVCSes are Bazaar, Git, Mercurial, SVN, and CVS.\n@param path Optional filesystem path to a project or a file contained within\n a project. The default value is the buffer's filename or the current\n working directory.\n@return string root
get_sel_text buffer.get_sel_text(buffer)\nReturns the selected text.\nMultiple selections are included in order with no delimiters. Rectangular\nselections are included from top to bottom with end of line characters.\nVirtual space is not included.\n@param buffer A buffer.\n@return string, number
get_split_table ui.get_split_table()\nReturns a split table that contains Textadept's current split view structure.\nThis is primarily used in session saving.\n@return table of split views. Each split view entry is a table with 4\n fields: `1`, `2`, `vertical`, and `size`. `1` and `2` have values of either\n nested split view entries or the views themselves; `vertical` is a flag\n that indicates if the split is vertical or not; and `size` is the integer\n position of the split resizer.
-get_symbol textadept.adeptsense.get_symbol(sense)\nReturns the full symbol and the current symbol part behind the caret.\nFor example: `buffer.cur` would return `'buffer'` and `'cur'`.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@return symbol or `''`\n@return part or `''`
get_text buffer.get_text(buffer)\nReturns the buffer's text.\n@param buffer A buffer.
getenv os.getenv(varname)\nReturns the value of the process environment variable `varname`, or\nnil if the variable is not defined.
gethook debug.gethook([thread])\nReturns the current hook settings of the thread, as three values: the\ncurrent hook function, the current hook mask, and the current hook count\n(as set by the `debug.sethook` function).
@@ -689,8 +690,8 @@ getregistry debug.getregistry()\nReturns the registry table (see §4.5).
getupvalue debug.getupvalue(f, up)\nThis function returns the name and the value of the upvalue with index\n`up` of the function `f`. The function returns nil if there is no upvalue\nwith the given index.
getuservalue debug.getuservalue(u)\nReturns the Lua value associated to `u`. If `u` is not a userdata, returns\nnil.
gmatch string.gmatch(s, pattern)\nReturns an iterator function that, each time it is called, returns the\nnext captures from `pattern` over the string `s`. If `pattern` specifies no\ncaptures, then the whole match is produced in each call.\n\nAs an example, the following loop will iterate over all the words from string\n`s`, printing one per line:\n\n s = "hello world from Lua"\n for w in string.gmatch(s, "%a+") do\n print(w)\n end\n\nThe next example collects all pairs `key=value` from the given string into a\ntable:\n\n t = {}\n s = "from=world, to=Lua"\n for k, v in string.gmatch(s, "(%w+)=(%w+)") do\n t[k] = v\n end\n\nFor this function, a caret '`^`' at the start of a pattern does not work as\nan anchor, as this would prevent the iteration.
+goto_anchor _M.yaml.goto_anchor()\nJumps to the anchor for the alias underneath the caret.
goto_buffer view.goto_buffer(view, n, relative)\nSwitches to buffer number *n* in the view.\n*relative* indicates whether or not *n* is an index relative to the current\nbuffer's index in `_G._BUFFERS` instead of an absolute index.\nEmits `BUFFER_BEFORE_SWITCH` and `BUFFER_AFTER_SWITCH` events.\n@param view The view to switch buffers in.\n@param n A relative or absolute buffer index in `_G._BUFFERS`. An absolute\n index of `-1` goes to the last buffer.\n@param relative Optional flag indicating whether *n* is a relative or\n absolute index. The default value is `false`, for an absolute index.\n@see _G._G._BUFFERS\n@see events.BUFFER_BEFORE_SWITCH\n@see events.BUFFER_AFTER_SWITCH
-goto_ctag textadept.adeptsense.goto_ctag(sense, kind, title)\nPrompts the user to select a known symbol of kind *kind* to jump to.\nIf *kind* is `nil`, displays all known symbols. *title* is the filtered list\ndialog prompt's title.\n@param sense The Adeptsense returned by `adeptsense.new()`. If `nil`, uses\n the current language's Adeptsense (if it exists).\n@param kind Optional Ctag character kind (e.g. `'f'` for a Lua function).\n@param title Optional title for the filtered list dialog.
goto_error textadept.run.goto_error(line, next)\nJumps to the source of the recognized compile/run warning or error on line\nnumber *line* in the message buffer.\nIf *line* is `nil`, jumps to the next or previous warning or error, depending\non boolean *next*. Displays an annotation with the warning or error message\nif possible.\n@param line The line number in the message buffer that contains the\n compile/run warning/error to go to.\n@param next Optional flag indicating whether to go to the next recognized\n warning/error or the previous one. Only applicable when *line* is `nil` or\n `false`.\n@see error_patterns\n@see cwd
goto_file ui.goto_file(filename, split, preferred_view, sloppy)\nSwitches to the existing view whose buffer's filename is *filename*.\nIf no view was found and *split* is `true`, splits the current view in order\nto show the requested file. If *split* is `false`, shifts to the next or\n*preferred_view* view in order to show the requested file. If *sloppy* is\n`true`, requires only the last part of *filename* to match a buffer's\n`filename`.\n@param filename The filename of the buffer to go to.\n@param split Optional flag that indicates whether or not to open the buffer\n in a split view if there is only one view. The default value is `false`.\n@param preferred_view Optional view to open the desired buffer in if the\n buffer is not visible in any other view.\n@param sloppy Optional flag that indicates whether or not to not match\n *filename* to `buffer.filename` exactly. When `true`, matches *filename* to\n only the last part of `buffer.filename` This is useful for run and compile\n commands which output relative filenames and paths instead of full ones and\n it is likely that the file in question is already open. The default value\n is `false`.
goto_file_found ui.find.goto_file_found(line, next)\nJumps to the source of the find in files search result on line number *line*\nin the buffer titled "Files Found" or, if *line* is `nil`, jumps to the next\nor previous search result, depending on boolean *next*.\n@param line The line number in the files found buffer that contains the\n search result to go to.\n@param next Optional flag indicating whether to go to the next search result\n or the previous one. Only applicable when *line* is `nil` or `false`.
@@ -698,12 +699,11 @@ goto_line buffer.goto_line(buffer, line)\nMoves the caret to the beginning of li
goto_line textadept.editing.goto_line(line)\nMoves the caret to the beginning of line number *line* or the user-specified\nline, ensuring *line* is visible.\n@param line Optional line number to go to. If `nil`, the user is prompted for\n one.
goto_mark textadept.bookmarks.goto_mark(next)\nPrompts the user to select a bookmarked line to move the caret to the\nbeginning of unless *next* is given.\nIf *next* is `true` or `false`, moves the caret to the beginning of the next\nor previously bookmarked line, respectively.\n@param next Optional flag indicating whether to go to the next or previous\n bookmarked line relative to the current line. The default value is `nil`,\n prompting the user for a bookmarked line to go to.
goto_pos buffer.goto_pos(buffer, pos)\nMoves the caret to position *pos* and scrolls it into view.\n@param buffer A buffer.\n@param pos The position in *buffer* to go to.
+goto_section M.goto_section()\nPrompts the user to select a section title to jump to.\nRequires the entire document to be styled.
goto_view ui.goto_view(n, relative)\nShifts to view number *n*.\n*relative* indicates whether or not *n* is an index relative to the current\nview's index in `_G._VIEWS` instead of an absolute index.\nEmits `VIEW_BEFORE_SWITCH` and `VIEW_AFTER_SWITCH` events.\n@param n A relative or absolute view index in `_G._VIEWS`.\n@param relative Optional flag that indicates whether *n* is a relative or\n absolute index. The default value is `false`, for an absolute index.\n@see _G._G._VIEWS\n@see events.VIEW_BEFORE_SWITCH\n@see events.VIEW_AFTER_SWITCH
graph lexer.graph (pattern)\nA pattern that matches any graphical character ('!' to '~').
gsub string.gsub(s, pattern, repl [, n])\nReturns a copy of `s` in which all (or the first `n`, if given)\noccurrences of the `pattern` have been replaced by a replacement string\nspecified by `repl`, which can be a string, a table, or a function. `gsub`\nalso returns, as its second value, the total number of matches that occurred.\nThe name `gsub` comes from "Global SUBstitution".\n\nIf `repl` is a string, then its value is used for replacement. The character\n`%` works as an escape character: any sequence in `repl` of the form `%d`,\nwith `d` between 1 and 9, stands for the value of the `d`-th captured\nsubstring. The sequence `%0` stands for the whole match. The sequence `%%`\nstands for a single `%`.\n\nIf `repl` is a table, then the table is queried for every match, using\nthe first capture as the key.\n\nIf `repl` is a function, then this function is called every time a match\noccurs, with all captured substrings passed as arguments, in order.\n\nIn any case, if the pattern specifies no captures, then it behaves as if the\nwhole pattern was inside a capture.\n\nIf the value returned by the table query or by the function call is a\nstring or a number, then it is used as the replacement string; otherwise,\nif it is false or nil, then there is no replacement (that is, the original\nmatch is kept in the string).\n\nHere are some examples:\n\n x = string.gsub("hello world", "(%w+)", "%1 %1")\n --> x="hello hello world world"\n x = string.gsub("hello world", "%w+", "%0 %0", 1)\n --> x="hello hello world"\n x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")\n --> x="world hello Lua from"\n x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)\n --> x="home = /home/roberto, user = roberto"\n x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)\n return load(s)()\n end)\n --> x="4+5 = 9"\n local t = {name="lua", version="5.2"}\n x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)\n --> x="lua-5.2.tar.gz"
h_scroll_bar buffer.h_scroll_bar (bool)\nDisplay the horizontal scroll bar.\nThe default value is `true`.
-handle_clear textadept.adeptsense.handle_clear(sense)\nHelps clear the Adeptsense along with `clear()`.\nThis function should be replaced with your own if you have any persistant\nobjects that need to be deleted.\n@param sense The Adeptsense returned by `adeptsense.new()`.
-handle_ctag textadept.adeptsense.handle_ctag(sense, tag_name, file_name, ex_cmd, ext_fields)\nHandles unrecognized Ctag kinds in `load_ctags()`.\nThe parameters are extracted from Ctags' tag format. This method should\nbe replaced with your own that is specific to the language.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@param tag_name The tag name.\n@param file_name The name of the file the tag belongs to.\n@param ex_cmd The `ex_cmd` returned by Ctags.\n@param ext_fields The `ext_fields` returned by Ctags.
hex_num lexer.hex_num (pattern)\nA pattern that matches a hexadecimal number.
hide_lines buffer.hide_lines(buffer, start_line, end_line)\nHides the range of lines between line numbers *start_line* to *end_line*.\nThis has no effect on fold levels or fold flags and the first line cannot be\nhidden.\n@param buffer A buffer.\n@param start_line The start line of the range of lines in *buffer* to hide.\n@param end_line The end line of the range of lines in *buffer* to hide.
hide_selection buffer.hide_selection(buffer, hide)\nDo not highlight selected text if *hide* is `true`.\n@param buffer A buffer.\n@param hide Whether or not to hide the selection.
@@ -739,7 +739,6 @@ indicator_current buffer.indicator_current (number)\nThe indicator number in the
indicator_end buffer.indicator_end(buffer, indicator, pos)\nReturns the next boundary position, starting from position *pos*, of\nindicator number *indicator*, in the range of `0` to `31`.\nReturns `buffer.length` if *indicator* was not found.\n@param buffer A buffer.\n@param indicator An indicator number in the range of `0` to `31`.\n@param pos The position in *buffer* of the indicator.
indicator_fill_range buffer.indicator_fill_range(buffer, pos, length)\nFills the range of text from position *pos* to *pos* + *length* with\nindicator number `buffer.indicator_current`.\n@param buffer A buffer.\n@param pos The start position of the range of text in *buffer* to set\n indicators over.\n@param length The number of characters in the range of text to set indicators\n over.
indicator_start buffer.indicator_start(buffer, indicator, pos)\nReturns the previous boundary position, starting from position *pos*, of\nindicator number *indicator*, in the range of `0` to `31`.\nReturns `0` if *indicator* was not found.\n@param buffer A buffer.\n@param indicator An indicator number in the range of `0` to `31`.\n@param pos The position in *buffer* of the indicator.
-inherited_classes textadept.adeptsense.inherited_classes (table)\nA map of classes and a list of their inherited classes, normally populated by\n`load_ctags()`.
input io.input([file])\nWhen called with a file name, it opens the named file (in text mode),\nand sets its handle as the default input file. When called with a file\nhandle, it simply sets this file handle as the default input file. When\ncalled without parameters, it returns the current default input file.\n\nIn case of errors this function raises the error, instead of returning an\nerror code.
inputbox ui.dialogs.inputbox(options)\nPrompts the user with a one-line input box dialog defined by dialog options\ntable *options*, returning the selected button's index along with the input\ntext or, if *options*.`string_output` is `true`, the selected button's label\nalong with the input text.\nIf the dialog timed out, returns `0` or `"timeout"`. If the user canceled the\ndialog, returns `-1` or `"delete"`.\n@param options Table of key-value option pairs for the input box.\n\n * `title`: The dialog's title text.\n * `informative_text`: The dialog's main message text. If the value is a\n table, the first table value is the main message text and any subsequent\n values are used as the labels for multiple entry boxes. Providing a\n single label has no effect.\n * `text`: The dialog's initial input text. If the value is a table, the\n table values are used to populate the multiple entry boxes defined by\n `informative_text`.\n * `button1`: The right-most button's label. The default value is\n `_L['_OK']`.\n * `button2`: The middle button's label.\n * `button3`: The left-most button's label. This option requires `button2`\n to be set.\n * `string_output`: Return the selected button's label or the dialog's exit\n status instead of the button's index or the dialog's exit code. The\n default value is `false`.\n * `width`: The dialog's pixel width.\n * `height`: The dialog's pixel height.\n * `float`: Show the dialog on top of all desktop windows. The default value\n is `false`.\n * `timeout`: the integer number of seconds the dialog waits for the user to\n select a button before timing out. Dialogs do not time out by default.\n@usage ui.dialogs.inputbox{title = 'Goto Line', informative_text = 'Line:',\n text = '1'}\n@return selected button or exit code, input text
insert table.insert(list, [pos, ] value)\nInserts element `value` at position `pos` in `list`, shifting up the elements\n`list[pos], list[pos+1], ···, list[#list]`. The default value for `pos` is\n`#list+1`, so that a call `table.insert(t,x)` inserts `x` at the end of list\n`t`.
@@ -755,7 +754,7 @@ keychain keys.keychain (table)\nThe current chain of key sequences. (Read-only.)
keys _G.keys (module)\nManages key bindings in Textadept.
keys _G.keys (table)\nMap of key bindings to commands, with language-specific key tables assigned\nto a lexer name key.
keys textadept.keys (module)\nDefines key commands for Textadept.\nThis set of key commands is pretty standard among other text editors. If\napplicable, load this module second to last in your *~/.textadept/init.lua*,\nbefore `textadept.menu`.
-kill proc.kill(proc)\nKills running `proc`.\n@param proc A running process created by `spawn()`.
+kill proc.kill(proc)\nKills running process *proc*.\n@param proc A running process created by `spawn()`.
last_char_includes lexer.last_char_includes(s)\nCreates and returns a pattern that verifies that string set *s* contains the\nfirst non-whitespace character behind the current match position.\n@param s String character set like one passed to `lpeg.S()`.\n@usage local regex = l.last_char_includes('+-*!%^&|=,([{') *\n l.delimited_range('/')\n@return pattern
ldexp math.ldexp(m, e)\nReturns 'm2^e' (`e` should be an integer).
len string.len(s)\nReceives a string and returns its length. The empty string `""` has\nlength 0. Embedded zeros are counted, so `"a\000bc\000"` has length 5.
@@ -802,13 +801,11 @@ lines_split buffer.lines_split(buffer, pixel_width, width)\nSplits the lines in
load _G.load(ld [, source [, mode [, env]]])\nLoads a chunk.\n\nIf `ld` is a string, the chunk is this string. If `ld` is a function, `load`\ncalls it repeatedly to get the chunk pieces. Each call to `ld` must return a\nstring that concatenates with previous results. A return of an empty string,\nnil, or no value signals the end of the chunk.\n\nIf there are no syntactic errors, returns the compiled chunk as a function;\notherwise, returns <b>nil</b> plus the error message.\n\nIf the resulting function has upvalues, the first upvalue is set to the value\nof `env`, if that parameter is given, or to the value of the global\nenvironment. (When you load a main chunk, the resulting function will always\nhave exactly one upvalue, the `_ENV` variable (see §2.2). When you load a\nbinary chunk created from a function (see `string.dump`), the resulting\nfunction can have arbitrary upvalues.)\n\n`source` is used as the source of the chunk for error messages and debug\ninformation (see §4.9). When absent, it defaults to `ld`, if `ld` is a\nstring, or to "`=(load)`" otherwise.\n\nThe string `mode` controls whether the chunk can be text or binary (that is,\na precompiled chunk). It may be the string "`b`" (only binary chunks), "`t`"\n(only text chunks), or "`bt`" (both binary and text). The default is "`bt`".
load lexer.load(name, alt_name)\nInitializes or loads and returns the lexer of string name *name*.\nScintilla calls this function to load a lexer. Parent lexers also call this\nfunction to load child lexers and vice-versa. The user calls this function\nto load a lexer when using Scintillua as a Lua library.\n@param name The name of the lexing language.\n@param alt_name The alternate name of the lexing language. This is useful for\n embedding the same child lexer with multiple sets of start and end tokens.\n@return lexer object
load textadept.session.load(filename)\nLoads session file *filename* or the user-selected session, returning `true`\nif a session file was opened and read.\nTextadept restores split views, opened buffers, cursor information, and\nrecent files.\n@param filename Optional absolute path to the session file to load. If `nil`,\n the user is prompted for one.\n@usage textadept.session.load(filename)\n@return `true` if the session file was opened and read; `false` otherwise.\n@see DEFAULT_SESSION
-load_ctags textadept.adeptsense.load_ctags(sense, tag_file, no_locations)\nGenerates a set of symbol completion lists from Ctags file *tag_file* and\nadds the set to the Adeptsense.\n*no_locations* indicates whether or not to store the location part of tags.\nIf `true`, `sense:goto_ctag()` cannot be used with this set of tags. It is\nrecommended to pass `-n` to `ctags` in order to use line numbers instead of\ntext patterns to locate tags. This will greatly reduce memory usage for a\nlarge number of symbols if *no_locations* is `false`.\n@param sense The Adeptsense returned by `adeptsense.new()`.\n@param tag_file The path of the Ctags file to load.\n@param no_locations Optional flag indicating whether or not to discard the\n locations of the tags for use by `sense:goto_ctag()`. The default value is\n `false`.
load_project _M.rails.load_project(dir)\nOpens a Rails project for snapopen.\nIf not directory is provided, the user is prompted for one.\n@param dir The Rails project directory.
loaded package.loaded (table)\nA table used by `require` to control which modules are already loaded. When\nyou require a module `modname` and `package.loaded[modname]` is not false,\n`require` simply returns the value stored there.\nThis variable is only a reference to the real table; assignments to this\nvariable do not change the table used by `require`.
loadfile _G.loadfile([filename [, mode [, env]]])\nSimilar to `load`, but gets the chunk from file `filename` or from the\nstandard input, if no file name is given.
loadlib package.loadlib(libname, funcname)\nDynamically links the host program with the C library `libname`.\n\nIf `funcname` is "`*`", then it only links with the library, making the\nsymbols exported by the library available to other dynamically linked\nlibraries. Otherwise, it looks for a function `funcname` inside the library\nand returns this function as a C function. So, `funcname` must follow the\n`lua_CFunction` prototype (see `lua_CFunction`).\n\nThis is a low-level function. It completely bypasses the package and module\nsystem. Unlike `require`, it does not perform any path searching and does\nnot automatically adds extensions. `libname` must be the complete file name\nof the C library, including if necessary a path and an extension. `funcname`\nmust be the exact name exported by the C library (which may depend on the\nC compiler and linker used).\n\nThis function is not supported by Standard C. As such, it is only available\non some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix\nsystems that support the `dlfcn` standard).
locale lpeg.locale([table])\nReturns a table with patterns for matching some character classes according\nto the current locale. The table has fields named `alnum`, `alpha`, `cntrl`,\n`digit`, `graph`, `lower`, `print`, `punct`, `space`, `upper`, and `xdigit`,\neach one containing a correspondent pattern. Each pattern matches any single\ncharacter that belongs to its class.\n\nIf called with an argument `table`, then it creates those fields inside the\ngiven table and returns that table.
-locations textadept.adeptsense.locations (table)\nA list of the locations of known symbols, normally populated by\n`load_ctags()`.
lock lfs.lock(filehandle, mode[, start[, length]])\nLocks a file or a part of it. This function works on open files; the file\nhandle should be specified as the first argument. The string mode could be\neither r (for a read/shared lock) or w (for a write/exclusive lock). The\noptional arguments start and length can be used to specify a starting point\nand its length; both should be numbers.\n\nReturns true if the operation was successful; in case of error, it returns\nnil plus an error string.
lock_dir lfs.lock_dir(path, [seconds_stale])\nCreates a lockfile (called lockfile.lfs) in path if it does not exist and\nreturns the lock. If the lock already exists checks it it's stale, using the\nsecond parameter (default for the second parameter is INT_MAX, which in\npractice means the lock will never be stale. To free the the lock call\nlock:free().\n\nIn case of any errors it returns nil and the error message. In particular,\nif the lock exists and is not stale it returns the "File exists" message.
log math.log(x [, base])\nReturns the logarithm of `x` in the given base. The default for `base` is 'e'\n(so that the function returns the natural logarithm of `x`).
@@ -880,7 +877,6 @@ multi_paste buffer.multi_paste (number)\nThe multiple selection paste mode.\n\n*
multiple_selection buffer.multiple_selection (bool)\nEnable multiple selection.\nThe default value is `false`.
nested_pair lexer.nested_pair(start_chars, end_chars)\nReturns a pattern that matches a balanced range of text that starts with\nstring *start_chars* and ends with string *end_chars*.\nWith single-character delimiters, this function is identical to\n`delimited_range(start_chars..end_chars, false, true, true)`.\n@param start_chars The string starting a nested sequence.\n@param end_chars The string ending a nested sequence.\n@usage local nested_comment = l.nested_pair('/*', '*/')\n@return pattern\n@see delimited_range
new buffer.new()\nCreates and returns a new buffer.\nEmits a `BUFFER_NEW` event.\n@return the new buffer.\n@see events.BUFFER_NEW
-new textadept.adeptsense.new(lang)\nCreates and returns a new Adeptsense for lexer name *lexer*.\nOnly one sense can exist per language.\n@param lang The lexer language name to create an Adeptsense for.\n@usage local lua_sense = textadept.adeptsense.new('lua')\n@return adeptsense
new_line buffer.new_line(buffer)\nTypes a new line at the caret position according to\n`buffer.eol_mode`.\n@param buffer A buffer.
newline lexer.newline (pattern)\nA pattern that matches any set of end of line characters.
next _G.next(table [, index])\nAllows a program to traverse all fields of a table. Its first argument is\na table and its second argument is an index in this table. `next` returns\nthe next index of the table and its associated value. When called with nil\nas its second argument, `next` returns an initial index and its associated\nvalue. When called with the last index, or with nil in an empty table, `next`\nreturns nil. If the second argument is absent, then it is interpreted as\nnil. In particular, you can use `next(t)` to check whether a table is empty.\n\nThe order in which the indices are enumerated is not specified, *even for\nnumeric indices*. (To traverse a table in numeric order, use a numerical\n`for`.)\n\nThe behavior of `next` is undefined if, during the traversal, you assign any\nvalue to a non-existent field in the table. You may however modify existing\nfields. In particular, you may clear existing fields.
@@ -893,6 +889,7 @@ oct_num lexer.oct_num (pattern)\nA pattern that matches an octal number.
ok_msgbox ui.dialogs.ok_msgbox(options)\nPrompts the user with a generic message box dialog defined by dialog options\ntable *options* and with localized "Ok" and "Cancel" buttons, returning the\nselected button's index or, if *options*.`string_output` is `true`, the\nselected button's label.\nIf the dialog timed out, returns `0` or `"timeout"`. If the user canceled the\ndialog, returns `-1` or `"delete"`.\n@param options Table of key-value option pairs for the message box.\n\n * `title`: The dialog's title text.\n * `text`: The dialog's main message text.\n * `informative_text`: The dialog's extra informative text.\n * `icon`: The dialog's GTK stock icon name. Examples are\n "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and\n "gtk-dialog-warning". The dialog does not display an icon by default.\n * `icon_file`: The dialog's icon file path. This option has no effect when\n `icon` is set.\n * `no_cancel`: Do not display the "Cancel" button. The default value is\n `false`.\n * `string_output`: Return the selected button's label or the dialog's exit\n status instead of the button's index or the dialog's exit code. The\n default value is `false`.\n * `width`: The dialog's pixel width.\n * `height`: The dialog's pixel height.\n * `float`: Show the dialog on top of all desktop windows. The default value\n is `false`.\n * `timeout`: the integer number of seconds the dialog waits for the user to\n select a button before timing out. Dialogs do not time out by default.\n@return selected button or exit code
open io.open(filename [, mode])\nThis function opens a file, in the mode specified in the string `mode`. It\nreturns a new file handle, or, in case of errors, nil plus an error message.\n\nThe `mode` string can be any of the following:\n "r": read mode (the default);\n "w": write mode;\n "a": append mode;\n "r+": update mode, all previous data is preserved;\n "w+": update mode, all previous data is erased;\n "a+": append update mode, previous data is preserved, writing is only\n allowed at the end of file.\n\nThe `mode` string can also have a '`b`' at the end, which is needed in\nsome systems to open the file in binary mode.
open_file io.open_file(filenames)\nOpens *filenames*, a string filename or list of filenames, or the\nuser-selected filenames.\nEmits a `FILE_OPENED` event.\n@param filenames Optional string filename or table of filenames to open. If\n `nil`, the user is prompted with a fileselect dialog.\n@see _G.events
+open_image M.open_image()\nOpens the image specified in an "image" or "figure" directive on the current\nline.
open_recent_file io.open_recent_file()\nPrompts the user to select a recently opened file to be reopened.\n@see recent_files
optionselect ui.dialogs.optionselect(options)\nPrompts the user with an option selection dialog defined by dialog options \ntable *options*, returning the selected button's index along with the indices \nof the selected options or, if *options*.`string_output` is `true`, the \nselected button's label along with the text of the selected options.\nIf the dialog timed out, returns `0` or `"timeout"`. If the user canceled the\ndialog, returns `-1` or `"delete"`.\n@param options Table of key-value option pairs for the option select dialog.\n\n * `title`: The dialog's title text.\n * `text`: The dialog's main message text.\n * `items`: The list of string options to show in the option group.\n * `button1`: The right-most button's label. The default value is\n `_L['_OK']`.\n * `button2`: The middle button's label.\n * `button3`: The left-most button's label. This option requires `button2`\n to be set.\n * `select`: The indices of initially selected options.\n * `string_output`: Return the selected button's label or the dialog's exit\n status along with the selected option's text instead of the button's \n index or the dialog's exit code along with the option's index. The \n default value is `false`.\n * `width`: The dialog's pixel width.\n * `height`: The dialog's pixel height.\n * `float`: Show the dialog on top of all desktop windows. The default value\n is `false`.\n * `timeout`: the integer number of seconds the dialog waits for the user to\n select a button before timing out. Dialogs do not time out by default.\n@usage ui.dialogs.optionselect{title = 'Language', \n informative_text = 'Check the languages you understand'\n items = {'English', 'Romanian'}, select = 1, string_output = true}\n@return selected button or exit code, list of selected options
os _G.os (module)\nLua os module.
@@ -958,6 +955,7 @@ rawlen _G.rawlen(v)\nReturns the length of the object `v`,\nwhich must be a tabl
rawset _G.rawset(table, index, value)\nSets the real value of `table[index]` to `value`, without invoking any\nmetamethod. `table` must be a table, `index` any value different from nil and\nNaN, and `value` any Lua value.\n\nThis function returns `table`.
read file:read(···)\nReads the file `file`, according to the given formats, which specify\nwhat to read. For each format, the function returns a string (or a number)\nwith the characters read, or nil if it cannot read data with the specified\nformat. When called without formats, it uses a default format that reads\nthe next line (see below).\n\nThe available formats are\n "*n": reads a number; this is the only format that returns a number\n instead of a string.\n "*a": reads the whole file, starting at the current position. On end of\n file, it returns the empty string.\n "*l": reads the next line skipping the end of line, returning nil on\n end of file. This is the default format.\n "*L": reads the next line keeping the end of line (if present), returning\n nil on end of file.\n *number*: reads a string with up to this number of bytes, returning nil on\n end of file. If number is zero, it reads nothing and returns an empty\n string, or nil on end of file.
read io.read(···)\nEquivalent to `io.input():read(···)`.
+read proc.read(proc, arg)\nReads and returns stdout from process *proc*, according to string format or\nnumber *arg*.\nSimilar to Lua's `io.read()` and blocks for input. *proc* must still be\nrunning. If an error occurs while reading, returns `nil`, an error code, and\nan error message.\nEnsure any read operations read all stdout available. The stdout callback\nfunction passed to `spawn()` will not be called until the stdout buffer is\nclear.\n@param proc A process created by `spawn()`.\n@param arg Optional argument similar to those in Lua's `io.read()`, but "*n"\n is not supported. The default value is "*l", which reads a line.\n@return string of bytes read
read_only buffer.read_only (bool)\nWhether or not the buffer is read-only.\nThe default value is `false`.
recent_files io.recent_files (table)\nList of recently opened files, the most recent being towards the top.
rectangular_selection_anchor buffer.rectangular_selection_anchor (number)\nThe rectangular selection's anchor position.
@@ -988,6 +986,9 @@ replace_target_re buffer.replace_target_re(buffer, text)\nReplaces the text in t
representation buffer.representation (table)\nThe alternative string representations of characters.\nRepresentations are displayed in the same way control characters are. Use\nthe empty string for the '\0' character when assigning its representation.\nCall `buffer:clear_representation()` to remove a\nrepresentation.
require _G.require(modname)\nLoads the given module. The function starts by looking into the\n`package.loaded` table to determine whether `modname` is already\nloaded. If it is, then `require` returns the value stored at\n`package.loaded[modname]`. Otherwise, it tries to find a *loader* for\nthe module.\n\nTo find a loader, `require` is guided by the `package.searchers` sequence. By\nchanging this sequence, we can change how `require` looks for a module. The\nfollowing explanation is based on the default configuration for\n`package.searchers`.\n\nFirst `require` queries `package.preload[modname]`. If it has a value,\nthis value (which should be a function) is the loader. Otherwise `require`\nsearches for a Lua loader using the path stored in `package.path`. If\nthat also fails, it searches for a C loader using the path stored in\n`package.cpath`. If that also fails, it tries an *all-in-one* loader (see\n`package.searchers`).\n\nOnce a loader is found, `require` calls the loader with two arguments:\n`modname` and an extra value dependent on how it got the loader. (If the\nloader came from a file, this extra value is the file name.) If the loader\nreturns any non-nil value, `require` assigns the returned value to\n`package.loaded[modname]`. If the loader does not return a non-nil value and\nhas not assigned any value to `package.loaded[modname]`, then `require`\nassigns <b>true</b> to this entry. In any case, `require` returns the final\nvalue of `package.loaded[modname]`.\n\nIf there is any error loading or running the module, or if it cannot find\nany loader for the module, then `require` raises an error.
reset _G.reset()\nResets the Lua state by reloading all initialization scripts.\nLanguage modules for opened files are NOT reloaded. Re-opening the files that\nuse them will reload those modules instead.\nThis function is useful for modifying user scripts (such as\n*~/.textadept/init.lua* and *~/.textadept/modules/textadept/keys.lua*) on\nthe fly without having to restart Textadept. `arg` is set to `nil` when\nreinitializing the Lua State. Any scripts that need to differentiate between\nstartup and reset can test `arg`.
+rest _G.keys.rest (table)\nContainer for reST-specific key bindings.
+rest _G.snippets.rest (table)\nContainer for reST-specific snippets.
+rest _M.rest (module)\nThe reST module.\nIt provides utilities for editing reST and Sphinx documents.
resume coroutine.resume(co [, val1, ···])\nStarts or continues the execution of coroutine `co`. The first time\nyou resume a coroutine, it starts running its body. The values `val1`,\n... are passed as the arguments to the body function. If the coroutine\nhas yielded, `resume` restarts it; the values `val1`, ... are passed\nas the results from the yield.\n\nIf the coroutine runs without any errors, `resume` returns true plus any\nvalues passed to `yield` (if the coroutine yields) or any values returned\nby the body function (if the coroutine terminates). If there is any error,\n`resume` returns false plus the error message.
reverse string.reverse(s)\nReturns a string that is the string `s` reversed.
rgba_image_height buffer.rgba_image_height (number)\nThe height of the RGBA image to be defined using\n`buffer:marker_define_rgba_image()`.
@@ -1051,23 +1052,20 @@ selection_n_end buffer.selection_n_end (table)\nTable of positions at the end of
selection_n_start buffer.selection_n_start (table)\nTable of positions at the beginning of existing selections numbered from\nzero, the main selection.
selection_start buffer.selection_start (number)\nThe position of the beginning of the selected text.\nWhen set, becomes the anchor, but is not scrolled into view.
selections buffer.selections (number, Read-only)\nThe number of active selections.
-self textadept.adeptsense.syntax.self (table)\nThe language's syntax-equivalent of "self". The default value is\n `'self'`.
-sense _M.ansi_c.sense\nThe C Adeptsense.\n It loads user tags from *`_USERHOME`/modules/ansi_c/tags* and user apidocs\n from *`_USERHOME`/modules/ansi_c/api*.
sense _M.css.sense\nThe CSS Adeptsense.\n It loads user tags from *`_USERHOME`/modules/css/tags* and user apidocs\n from *`_USERHOME`/modules/css/api*.
sense _M.html.sense\nThe HTML Adeptsense.\n It loads user tags from *`_USERHOME`/modules/html/tags* and user apidocs\n from *`_USERHOME`/modules/html/api*.
sense _M.java.sense\nThe Java Adeptsense.\n It loads user tags from *`_USERHOME`/modules/java/tags* and user apidocs\n from *`_USERHOME`/modules/java/api*.
-sense _M.lua.sense\nThe Lua Adeptsense.\n It loads user tags from *`_USERHOME`/modules/lua/tags* and user apidocs\n from *`_USERHOME`/modules/lua/api*.
sense _M.php.sense\nThe PHP Adeptsense.\n It loads user tags from *`_USERHOME`/modules/php/tags* and user apidocs\n from *`_USERHOME`/modules/php/api*.
sense _M.python.sense\nThe Python Adeptsense.\n It loads user tags from *`_USERHOME`/modules/python/tags* and user apidocs\n from *`_USERHOME`/modules/python/api*.
sense _M.rails.sense\nThe Rails Adeptsense.\n It loads user tags from *`_USERHOME`/modules/rails/tags* and user apidocs\n from *`_USERHOME`/modules/rails/api*.
sense _M.rhtml.sense\nThe RHTML Adeptsense.\n It loads user tags from *`_USERHOME`/modules/rhtml/tags* and user apidocs\n from *`_USERHOME`/modules/rhtml/api*.
sense _M.ruby.sense\nThe Ruby Adeptsense.\n It loads user tags from *`_USERHOME`/modules/ruby/tags* and user apidocs\n from *`_USERHOME`/modules/ruby/api*.
session textadept.session (module)\nSession support for Textadept.
-set_buffer_encoding io.set_buffer_encoding(encoding)\nConverts the current buffer's contents to encoding *encoding*.\n@param encoding The string encoding to set. Valid encodings are ones that GNU\n iconv accepts.\n@usage io.set_buffer_encoding('ASCII')
set_chars_default buffer.set_chars_default(buffer)\nResets `buffer.word_chars`, `buffer.whitespace_chars`, and\n`buffer.punctuation_chars` to their respective defaults.\n@param buffer A buffer.\n@see word_chars\n@see whitespace_chars\n@see punctuation_chars
set_contextmenu textadept.menu.set_contextmenu(menu)\nSets `ui.context_menu` from menu item list *menu*.\nDeprecated in favor of `set_contextmenus()`.\n@param menu The menu table to create the context menu from.\n@see set_contextmenus
set_contextmenus textadept.menu.set_contextmenus(buffer_menu, tab_menu)\nSets `ui.context_menu` and `ui.tab_context_menu` from menu item lists\n*buffer_menu* and *tab_menu*, respectively.\nMenu items are tables containing menu text and either a function to call or\na table containing a function with its parameters to call when an item is\nclicked. Menu items may also be sub-menus, ordered lists of menu items with\nan additional `title` key for the sub-menu's title text.\n@param buffer_menu Optional menu table to create the buffer context menu\n from. If `nil`, uses the default context menu.\n@param tab_menu Optional menu table to create the tabbar context menu from.\n If `nil`, uses the default tab context menu.\n@see ui.context_menu\n@see ui.tab_context_menu\n@see ui.menu
set_empty_selection buffer.set_empty_selection(buffer, pos)\nMoves the caret to position *pos* without scrolling the view and removes any\nselections.\n@param buffer A buffer\n@param pos The position in *buffer* to move to.
+set_encoding buffer.set_encoding(buffer, encoding)\nConverts the current buffer's contents to encoding *encoding*.\n@param buffer A buffer.\n@param encoding The string encoding to set. Valid encodings are ones that GNU\n iconv accepts.\n@usage io.set_buffer_encoding('ASCII')
set_fold_margin_colour buffer.set_fold_margin_colour(buffer, use_setting, color)\nOverrides the fold margin's default color with color *color*, in "0xBBGGRR"\nformat,\nif *use_setting* is `true`.\n@param buffer A buffer.\n@param use_setting Whether or not to use *color*.\n@param color The color in "0xBBGGRR" format.
set_fold_margin_hi_colour buffer.set_fold_margin_hi_colour(buffer, use_setting, color)\nOverrides the fold margin's default highlight color with color *color*, in\n"0xBBGGRR" format, if *use_setting* is `true`.\n@param buffer A buffer.\n@param use_setting Whether or not to use *color*.\n@param color The color in "0xBBGGRR" format.
set_hotspot_active_back buffer.set_hotspot_active_back(buffer, use_setting, color)\nOverrides the default background color of active hotspots with color *color*,\nin "0xBBGGRR" format, if *use_setting* is `true`.\n@param buffer A buffer.\n@param use_setting Whether or not to use *color*.\n@param color The color in "0xBBGGRR" format.
@@ -1098,8 +1096,8 @@ setupvalue debug.setupvalue(f, up, value)\nThis function assigns the value `valu
setuservalue debug.setuservalue(udata, value)\nSets the given `value` as the Lua value associated to the given `udata`.\n`value` must be a table or nil; `udata` must be a full userdata.\n\nReturns `udata`.
setvbuf file:setvbuf(mode [, size])\nSets the buffering mode for an output file. There are three available\nmodes:\n "no": no buffering; the result of any output operation appears immediately.\n "full": full buffering; output operation is performed only when the\n buffer is full or when you explicitly `flush` the file (see\n `io.flush`).\n "line": line buffering; output is buffered until a newline is output or\n there is any input from some special files (such as a terminal\n device).\n\nFor the last two cases, `size` specifies the size of the buffer, in\nbytes. The default is an appropriate size.
shebangs textadept.file_types.shebangs (table)\nMap of shebang words to their associated lexer names.\nIf the file has a shebang line, a line that starts with "#!" and is the first\nline in the file, each shebang word is matched against that line.
-show_apidoc textadept.adeptsense.show_apidoc(sense)\nShows a call tip with API documentation for the symbol behind the caret.\nIf a call tip is already shown, cycles to the next one if it exists.\n@param sense The Adeptsense returned by `adeptsense.new()`. If `nil`, uses\n the current language's Adeptsense (if it exists).\n@return list of apidocs on success or `nil`.\n@see get_symbol\n@see get_apidoc
show_completions ui.command_entry.show_completions(completions)\nShows completion list *completions* for the current word prefix.\nWord prefix characters are alphanumerics and underscores. On selection, the\nword prefix is replaced with the completion.\n@param completions The table of completions to show. Non-string values are\n ignored.
+show_documentation textadept.editing.show_documentation()\nDisplays a call tip with documentation for the symbol under or directly\nbehind the caret.\nIf a call tip is already shown, cycles to the next one if it exists.\nDocumentation is stored in API files in the `api_files` table.\n@see api_files
show_lines buffer.show_lines(buffer, start_line, end_line)\nShows the range of lines between line numbers *start_line* to *end_line*.\nThis has no effect on fold levels or fold flags and the first line cannot be\nhidden.\n@param buffer A buffer.\n@param start_line The start line of the range of lines in *buffer* to show.\n@param end_line The end line of the range of lines in *buffer* to show.
sin math.sin(x)\nReturns the sine of `x` (assumed to be in radians).
singular _M.rails.singular\nA map of plural controller names to their singulars. Add key-value pairs to\n this if the local function `singularize()` is incorrectly converting your\n plural controller name to its singular model name.
@@ -1120,7 +1118,7 @@ standard_inputbox ui.dialogs.standard_inputbox(options)\nPrompts the user with a
start_styling buffer.start_styling(buffer, position, style_mask, styling_mask)\nBegins styling at position *position* with styling bit-mask *styling_mask*.\n*styling_mask* specifies which style bits can be set with\n`buffer:set_styling()`.\n@param buffer A buffer.\n@param position The position in *buffer* to start styling at.\n@param styling_mask The bit mask of style bits that can be set when styling.\n@usage buffer:start_styling(0, 0xFF)
starts_line lexer.starts_line(patt)\nCreates and returns a pattern that matches pattern *patt* only at the\nbeginning of a line.\n@param patt The LPeg pattern to match on the beginning of a line.\n@usage local preproc = token(l.PREPROCESSOR, #P('#') * l.starts_line('#' *\n l.nonnewline^0))\n@return pattern
status coroutine.status(co)\nReturns the status of coroutine `co`, as a string: `"running"`, if\nthe coroutine is running (that is, it called `status`); `"suspended"`, if\nthe coroutine is suspended in a call to `yield`, or if it has not started\nrunning yet; `"normal"` if the coroutine is active but not running (that\nis, it has resumed another coroutine); and `"dead"` if the coroutine has\nfinished its body function, or if it has stopped with an error.
-status proc.status(proc)\nReturns the status of `proc`, which is either "running" or "terminated".\n@param proc A process created by `spawn()`.\n@return "running" or "terminated"
+status proc.status(proc)\nReturns the status of process *proc*, which is either "running" or\n"terminated".\n@param proc A process created by `spawn()`.\n@return "running" or "terminated"
statusbar_text ui.statusbar_text (string, Write-only)\nThe text displayed in the statusbar.
stderr io.stderr (file)\nStandard error.
stdin io.stdin (file)\nStandard in.
@@ -1151,9 +1149,7 @@ style_visible buffer.style_visible (table)\nTable of flags that indicate whether
sub string.sub(s, i [, j])\nReturns the substring of `s` that starts at `i` and continues until\n`j`; `i` and `j` can be negative. If `j` is absent, then it is assumed to\nbe equal to -1 (which is the same as the string length). In particular,\nthe call `string.sub(s,1,j)` returns a prefix of `s` with length `j`, and\n`string.sub(s, -i)` returns a suffix of `s` with length `i`.\n\nIf, after the translation of negative indices, `i` is less than 1, it is\ncorrected to 1. If `j` is greater than the string length, it is corrected to\nthat length. If, after these corrections, `i` is greater than `j`, the\nfunction returns the empty string.
swap_main_anchor_caret buffer.swap_main_anchor_caret(buffer)\nSwaps the main selection's beginning and end positions.\n@param buffer A buffer.
switch_buffer ui.switch_buffer()\nPrompts the user to select a buffer to switch to.
-symbol_chars textadept.adeptsense.syntax.symbol_chars (table)\nA Lua pattern of characters allowed in a symbol,\n including member operators. The pattern should be a character set.\n The default value is `'[%w_%.]'`.
symlinkattributes lfs.symlinkattributes(filepath [, aname])\nIdentical to lfs.attributes except that it obtains information about the link\nitself (not the file it refers to). This function is not available in Windows\nso you may want to make sure that lfs.symlinkattributes exists before using\nit.
-syntax textadept.adeptsense.syntax (table)\nMap of language-specific syntax settings.\n@see get_class
tab buffer.tab(buffer)\nIndents the text on the selected lines or types a Tab character ("\t") at\nthe caret position.\n@param buffer A buffer.
tab_context_menu ui.tab_context_menu\nThe context menu for the buffer's tab, a `ui.menu()`.\n This is a low-level field. You probably want to use the higher-level\n `textadept.menu.set_contextmenus()`.
tab_indents buffer.tab_indents (bool)\nIndent text when tabbing within indentation.\nThe default value is `false`.
@@ -1162,6 +1158,8 @@ tab_width buffer.tab_width (number)\nThe number of space characters represented
table _G.table (module)\nLua table module.
tabs ui.tabs (bool)\nWhether or not to display the tab bar when multiple buffers are open.\nThe default value is `true`.
tag buffer.tag (table, Read-only)\nList of capture text for capture numbers from a regular expression search.
+tags _M.ansi_c.tags (table)\nList of ctags files to use for autocompletion.\n@see textadept.editing.autocomplete
+tags _M.lua.tags (table)\nList of "fake" ctags files to use for autocompletion.\nThe kind 'm' is recognized a module, 'f' as a function, 't' as a table and \n'F' as a module or table field.\n@see textadept.editing.autocomplete
tan math.tan(x)\nReturns the tangent of `x` (assumed to be in radians).
tanh math.tanh(x)\nReturns the hyperbolic tangent of `x`.
target_end buffer.target_end (number)\nThe position of the end of the target range.\nThis is also set by a successful\n`buffer:search_in_target()`.
@@ -1194,9 +1192,6 @@ two_phase_draw buffer.two_phase_draw (bool)\nDraw in two phases: first the backg
type _G.type(v)\nReturns the type of its only argument, coded as a string. The possible\nresults of this function are "\n`nil`" (a string, not the value nil), "`number`", "`string`", "`boolean`",\n"`table`", "`function`", "`thread`", and "`userdata`".
type io.type(obj)\nChecks whether `obj` is a valid file handle. Returns the string `"file"`\nif `obj` is an open file handle, `"closed file"` if `obj` is a closed file\nhandle, or nil if `obj` is not a file handle.
type lpeg.type(value)\nIf the given value is a pattern, returns the string "pattern". Otherwise\nreturns nil.
-type_assignments textadept.adeptsense.syntax.type_assignments (table)\nA map of Lua patterns to class types for variable\n assignments, typically used for dynamically typed languages. For example,\n `sense.syntax.type_assignments['^"'] = 'string'` would recognize string\n assignments in Lua so the `foo` in `foo = "bar"` would be recognized as\n class type `string`. The class type value may contain `%n` pattern\n captures.
-type_declarations textadept.adeptsense.syntax.type_declarations (table)\nA list of Lua patterns used for determining the\n class type of a symbol. The first capture returned must be the class name.\n Use `%_` to match the symbol.\n The default value is `'(%u[%w_%.]+)%s+%_'`.
-type_declarations_exclude textadept.adeptsense.syntax.type_declarations_exclude (table)\nA table of class types to exclude, even if\n they match a `type_declarations` pattern. Each excluded type is a table key\n and has a `true` boolean value. For example, `{Foo = true}` excludes any\n class type whose name is `Foo`.\n The default value is `{}`.
typeover_chars textadept.editing.typeover_chars (table)\nTable of characters to move over when typed, with language-specific typeover\ncharacter tables assigned to a lexer name key.\nThe ASCII values of characters are keys and are assigned non-`nil` values.\nThe default characters are ')', ']', '}', ''', and '"'.\n@see TYPEOVER_CHARS
ui _G.ui (module)\nUtilities for interacting with Textadept's user interface.
undo buffer.undo(buffer)\nUndoes the most recent action.\n@param buffer A buffer.
@@ -1227,14 +1222,13 @@ view_eol buffer.view_eol (bool)\nDisplay end of line characters.\nThe default va
view_ws buffer.view_ws (number)\nThe whitespace visibility mode.\n\n* `buffer.WS_INVISIBLE`\n Whitespace is invisible.\n* `buffer.WS_VISIBLEALWAYS`\n Display all space characters as dots and tab characters as arrows.\n* `buffer.WS_VISIBLEAFTERINDENT`\n Display only non-indentation spaces and tabs as dots and arrows.\n\nThe default value is `buffer.WS_INVISIBLE`.
virtual_space_options buffer.virtual_space_options (number)\nThe virtual space mode.\n\n* `buffer.VS_NONE`\n Disable virtual space.\n* `buffer.VS_RECTANGULARSELECTION`\n Enable virtual space only for rectangular selections.\n* `buffer.VS_USERACCESSIBLE`\n Enable virtual space.\n\nWhen virtual space is enabled, the caret may move into the space past end\nof line characters.\nThe default value is `buffer.VS_NONE`.
visible_from_doc_line buffer.visible_from_doc_line(buffer, line)\nReturns the displayed line number of actual line number *line*, taking hidden\nlines into account, or `-1` if *line* is outside the range of lines in the\nbuffer.\nLines can occupy more than one display line if they wrap.\n@param buffer A buffer.\n@param line The line number in *buffer* to use.\n@return number
-wait proc.wait(proc)\nBlocks until `proc` finishes.\n@param proc A process created by `spawn()`.
+wait proc.wait(proc)\nBlocks until process *proc* finishes.\n@param proc A process created by `spawn()`.
whitespace_chars buffer.whitespace_chars (string)\nThe string set of characters recognized as whitespace characters.\nSet this only after setting `buffer.word_chars`.\nThe default value is a string that contains all non-newline characters less\nthan ASCII value 33.
whitespace_size buffer.whitespace_size (number)\nThe pixel size of the dots that represent space characters when whitespace\nis visible.\nThe default value is `1`.
whole_word ui.find.whole_word (bool)\nMatch search text only when it is surrounded by non-word characters in\nsearches.\nThe default value is `false`.
whole_word_label_text ui.find.whole_word_label_text (string, Write-only)\nThe text of the "Whole word" label.\nThis is primarily used for localization.
word lexer.word (pattern)\nA pattern that matches a typical word. Words begin with a letter or\nunderscore and consist of alphanumeric and underscore characters.
word_chars buffer.word_chars (string)\nThe string set of characters recognized as word characters.\nThe default value is a string that contains alphanumeric characters, an\nunderscore, and all characters greater than ASCII value 127.
-word_chars textadept.adeptsense.syntax.word_chars (table)\nA Lua pattern of characters allowed in a word.\n The default value is `'%w_'`.
word_end_position buffer.word_end_position(buffer, pos, only_word_chars)\nReturns the position of the end of the word at position *pos*.\n`buffer.word_chars` contains word characters. If *pos* has a non-word\ncharacter to its right and *only_word_chars* is `false`, returns the first\nword character's position.\n@param buffer A buffer.\n@param pos The position in *buffer* of the word.\n@param only_word_chars If `true`, stops searching at the first non-word\n character in the search direction. Otherwise, the first character in the\n search direction sets the type of the search as word or non-word and the\n search stops at the first non-matching character. Searches are also\n terminated by the start or end of the buffer.
word_left buffer.word_left(buffer)\nMoves the caret left one word.\n`buffer.word_chars` contains word characters.\n@param buffer A buffer.
word_left_end buffer.word_left_end(buffer)\nMoves the caret left one word, positioning it at the end of the previous\nword.\n`buffer.word_chars` contains word characters.\n@param buffer A buffer.
@@ -1259,11 +1253,14 @@ wrap_visual_flags buffer.wrap_visual_flags (number)\nThe wrapped line visual fla
wrap_visual_flags_location buffer.wrap_visual_flags_location (number)\nThe wrapped line visual flag drawing mode.\n\n* `buffer.WRAPVISUALFLAGLOC_DEFAULT`\n Draw a visual flag near the view's right margin.\n* `buffer.WRAPVISUALFLAGLOC_END_BY_TEXT`\n Draw a visual flag near text at the end of a wrapped line.\n* `buffer.WRAPVISUALFLAGLOC_START_BY_TEXT`\n Draw a visual flag near text at the beginning of a subline.\n\nThe default value is `buffer.WRAPVISUALFLAGLOC_DEFAULT`.
write file:write(···)\nWrites the value of each of its arguments to `file`. The arguments must be\nstrings or numbers.\n\nIn case of success, this function returns `file`. Otherwise it returns nil\nplus a string describing the error.
write io.write(···)\nEquivalent to `io.output():write(···)`.
-write proc.write(proc, ...)\nWrites string `input` to the stdin of `proc`.\n@param proc A process created by `spawn()`.\n@param ... Standard input for `proc`.
+write proc.write(proc, ...)\nWrites string input to the stdin of process *proc*.\n@param proc A process created by `spawn()`.\n@param ... Standard input for *proc*.
x_offset buffer.x_offset (number)\nThe horizontal scroll pixel position.\nA value of `0` is the normal position with the first text column visible at\nthe left of the view.
xdigit lexer.xdigit (pattern)\nA pattern that matches any hexadecimal digit ('0'-'9', 'A'-'F', 'a'-'f').
xor bit32.xor(...)\nReturns the bitwise "exclusive or" of its operands.
xpcall _G.xpcall(f, msgh [, arg1, ···])\nThis function is similar to `pcall`, except that it sets a new message\nhandler `msgh`.
+yaml _G.keys.yaml (table)\nContainer for YAML-specific key bindings.
+yaml _G.snippets.yaml (table)\nContainer for YAML-specific snippets.
+yaml _M.yaml (module)\nThe YAML module.\nIt provides utilities for editing YAML documents.
yesno_msgbox ui.dialogs.yesno_msgbox(options)\nPrompts the user with a generic message box dialog defined by dialog options\ntable *options* and with localized "Yes", "No", and "Cancel" buttons,\nreturning the selected button's index or, if *options*.`string_output` is\n`true`, the selected button's label.\nIf the dialog timed out, returns `0` or `"timeout"`. If the user canceled the\ndialog, returns `-1` or `"delete"`.\n@param options Table of key-value option pairs for the message box.\n\n * `title`: The dialog's title text.\n * `text`: The dialog's main message text.\n * `informative_text`: The dialog's extra informative text.\n * `icon`: The dialog's GTK stock icon name. Examples are\n "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and\n "gtk-dialog-warning". The dialog does not display an icon by default.\n * `icon_file`: The dialog's icon file path. This option has no effect when\n `icon` is set.\n * `no_cancel`: Do not display the "Cancel" button. The default value is\n `false`.\n * `string_output`: Return the selected button's label or the dialog's exit\n status instead of the button's index or the dialog's exit code. The\n default value is `false`.\n * `width`: The dialog's pixel width.\n * `height`: The dialog's pixel height.\n * `float`: Show the dialog on top of all desktop windows. The default value\n is `false`.\n * `timeout`: the integer number of seconds the dialog waits for the user to\n select a button before timing out. Dialogs do not time out by default.\n@return selected button or exit code
yield coroutine.yield(···)\nSuspends the execution of the calling coroutine. Any arguments to `yield` are\npassed as extra results to `resume`.
zoom buffer.zoom (number)\nThe number of points to add to the size of all fonts.\nNegative values are allowed.\nThe default value is `0`.
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index 3a1c8e5d..0fac88ef 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -11,68 +11,73 @@ local M = {}
--
-- + `Ctrl+L, M` (`⌘L, M` on Mac OSX | `M-L, M` in curses)
-- Open this module for editing.
--- + `.`
--- Show an autocompletion list of fields for the symbol behind the caret.
--- + `:`
--- Show an autocompletion list of functions for the symbol behind the caret.
-- + `Shift+Enter` (`⇧↩` | `S-Enter`)
-- Autocomplete an `if`, `while`, `for`, etc. control structure with the `end`
-- keyword.
--- @field sense
--- The Lua [Adeptsense](textadept.adeptsense.html).
--- It loads user tags from *`_USERHOME`/modules/lua/tags* and user apidocs
--- from *`_USERHOME`/modules/lua/api*.
module('_M.lua')]]
--- Adeptsense.
-
-M.sense = textadept.adeptsense.new('lua')
-M.sense.syntax.class_definition = 'module%s*%(?%s*[\'"]([%w_%.]+)'
-M.sense.syntax.symbol_chars = '[%w_%.:]'
-M.sense.syntax.type_declarations = {}
-M.sense.syntax.type_assignments = {
- ['^[\'"]'] = 'string', -- foo = 'bar' or foo = "bar"
- ['^([%w_%.]+)%s*$'] = '%1', -- foo = textadept.adeptsense
- ['^(textadept%.adeptsense)%.new'] = '%1',
- ['require%s*%(?%s*(["\'])([%w_%.]+)%1%)?'] = '%2',
- ['^io%.p?open%s*%b()%s*$'] = 'file',
- ['^spawn%s*%b()%s*$'] = 'proc'
-}
-M.sense.api_files = {_HOME..'/modules/lua/api'}
-M.sense:add_trigger('.')
-M.sense:add_trigger(':', false, true)
-
--- script/update_doc generates a fake set of ctags used for autocompletion.
-local as = textadept.adeptsense
-M.sense.ctags_kinds = {
- f = as.FUNCTION, F = as.FIELD, m = as.CLASS, t = as.FIELD
-}
-M.sense:load_ctags(_HOME..'/modules/lua/tags', true)
-
--- Strips '_G' from symbols since it's implied.
-function M.sense:get_symbol()
- local symbol, part = self.super.get_symbol(self)
- if symbol:find('^_G') then symbol = symbol:gsub('_G%.?', '') end
- if part == '_G' then part = '' end
- return symbol, part
-end
+-- Autocompletion and documentation.
+
+---
+-- List of "fake" ctags files to use for autocompletion.
+-- The kind 'm' is recognized a module, 'f' as a function, 't' as a table and
+-- 'F' as a module or table field.
+-- @class table
+-- @name tags
+-- @see textadept.editing.autocomplete
+M.tags = {_HOME..'/modules/lua/tags', _USERHOME..'/modules/lua/tags'}
+
+---
+-- Map of expression patterns to their types.
+-- Expressions are expected to match after the '=' sign of a statement.
+-- @class table
+-- @name expr_types
+-- @usage _M.lua.expr_types['^spawn%b()%s*$'] = 'proc'
+M.expr_types = {['^[\'"]'] = 'string', ['^io%.p?open%s*%b()%s*$'] = 'file'}
--- Shows an autocompletion list for the symbol behind the caret.
--- If the symbol contains a ':', only display functions. Otherwise, display
--- both functions and fields.
-function M.sense:complete(only_fields, only_functions)
+local XPM = textadept.editing.XPM_IMAGES
+local xpms = {m = XPM.CLASS, f = XPM.METHOD, F = XPM.VARIABLE, t = XPM.TYPEDEF}
+
+textadept.editing.autocompleters.lua = function()
+ local list = {}
+ -- Retrieve the symbol behind the caret.
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(':'))
+ local symbol, op, part = line:sub(1, pos):match('([%w_%.]-)([%.:]?)([%w_]*)$')
+ if symbol == '' and part == '' and op ~= '' then return nil end -- lone .
+ symbol, part = symbol:gsub('^_G%.?', ''), part ~= '_G' and part or ''
+ -- Attempt to identify string type and file type symbols.
+ local buffer = buffer
+ local assignment = '%f[%w_]'..symbol:gsub('(%p)', '%%%1')..'%s*=%s*(.*)$'
+ for i = buffer:line_from_position(buffer.current_pos) - 1, 0, -1 do
+ local expr = buffer:get_line(i):match(assignment)
+ if expr then
+ for patt, type in pairs(M.expr_types) do
+ if expr:find(patt) then symbol = type break end
+ end
+ end
+ end
+ -- Search through ctags for completions for that symbol.
+ local name_patt = '^'..part
+ for i = 1, #M.tags do
+ if lfs.attributes(M.tags[i]) then
+ for line in io.lines(M.tags[i]) do
+ local name = line:match('^%S+')
+ if name:find(name_patt) and not list[name] then
+ local fields = line:match(';"\t(.*)$')
+ local k, class = fields:sub(1, 1), fields:match('class:(%S+)') or ''
+ if class == symbol and (op ~= ':' or k == 'f') then
+ list[#list + 1], list[name] = ("%s?%d"):format(name, xpms[k]), true
+ end
+ end
+ end
+ end
+ end
+ return #part, list
end
--- Load user tags and apidoc.
-if lfs.attributes(_USERHOME..'/modules/lua/tags') then
- M.sense:load_ctags(_USERHOME..'/modules/lua/tags')
-end
-if lfs.attributes(_USERHOME..'/modules/lua/api') then
- M.sense.api_files[#M.sense.api_files + 1] = _USERHOME..'/modules/lua/api'
-end
+textadept.editing.api_files.lua = {
+ _HOME..'/modules/lua/api', _USERHOME..'/modules/lua/api'
+}
-- Commands.
@@ -146,12 +151,7 @@ if type(snippets) == 'table' then
-- @class table
-- @name _G.snippets.lua
snippets.lua = {
- l = "local %1(expr)%2( = %3(value))",
- p = "print(%0)",
- f = "function %1(name)(%2(args))\n\t%0\nend",
- ['for'] = "for i = %1(1), %2(10)%3(, -1) do\n\t%0\nend",
- fori = "for %1(i), %2(val) in ipairs(%3(table)) do\n\t%0\nend",
- forp = "for %1(k), %2(v) in pairs(%3(table)) do\n\t%0\nend",
+
}
end
diff --git a/modules/lua/tags b/modules/lua/tags
index 0ad71650..8d509d06 100644
--- a/modules/lua/tags
+++ b/modules/lua/tags
@@ -6,6 +6,7 @@ ANNOTATION_HIDDEN _ 0;" F class:_SCINTILLA.constants
ANNOTATION_STANDARD _ 0;" F class:_SCINTILLA.constants
APPLEEVENT_ODOC _ 0;" F class:events
ARG_NONE _ 0;" F class:events
+AUTOCOMPLETE_ALL _ 0;" F class:textadept.editing
AUTOINDENT _ 0;" F class:textadept.editing
AUTOMATICFOLD_CHANGE _ 0;" F class:_SCINTILLA.constants
AUTOMATICFOLD_CLICK _ 0;" F class:_SCINTILLA.constants
@@ -38,8 +39,9 @@ CASE_LOWER _ 0;" F class:_SCINTILLA.constants
CASE_MIXED _ 0;" F class:_SCINTILLA.constants
CASE_UPPER _ 0;" F class:_SCINTILLA.constants
CHAR_ADDED _ 0;" F class:events
+CHECK_SYNTAX _ 0;" F class:_M.python
CLASS _ 0;" F class:lexer
-CLASS _ 0;" F class:textadept.adeptsense
+CLASS _ 0;" F class:textadept.editing.XPM_IMAGES
CLEAR _ 0;" F class:keys
COMMAND_ENTRY_KEYPRESS _ 0;" F class:events
COMMENT _ 0;" F class:lexer
@@ -62,6 +64,7 @@ Cs _ 0;" f class:lpeg
Ct _ 0;" f class:lpeg
DEFAULT _ 0;" F class:lexer
DEFAULT_SESSION _ 0;" F class:textadept.session
+DOCUTILS_PATH _ 0;" F class:_M.rest
DOUBLE_CLICK _ 0;" F class:events
DWELL_END _ 0;" F class:events
DWELL_START _ 0;" F class:events
@@ -73,8 +76,6 @@ EOL_CRLF _ 0;" F class:_SCINTILLA.constants
EOL_LF _ 0;" F class:_SCINTILLA.constants
ERROR _ 0;" F class:events
ERROR _ 0;" F class:lexer
-FIELD _ 0;" F class:textadept.adeptsense
-FIELD_IMAGE _ 0;" F class:textadept.adeptsense
FILE_AFTER_SAVE _ 0;" F class:events
FILE_BEFORE_SAVE _ 0;" F class:events
FILE_CHANGED _ 0;" F class:events
@@ -96,6 +97,7 @@ FOLDFLAG_LINEAFTER_CONTRACTED _ 0;" F class:_SCINTILLA.constants
FOLDFLAG_LINEAFTER_EXPANDED _ 0;" F class:_SCINTILLA.constants
FOLDFLAG_LINEBEFORE_CONTRACTED _ 0;" F class:_SCINTILLA.constants
FOLDFLAG_LINEBEFORE_EXPANDED _ 0;" F class:_SCINTILLA.constants
+FOLDFLAG_LINESTATE _ 0;" F class:_SCINTILLA.constants
FOLDLEVELBASE _ 0;" F class:_SCINTILLA.constants
FOLDLEVELHEADERFLAG _ 0;" F class:_SCINTILLA.constants
FOLDLEVELNUMBERMASK _ 0;" F class:_SCINTILLA.constants
@@ -104,8 +106,6 @@ FOLD_BASE _ 0;" F class:lexer
FOLD_BLANK _ 0;" F class:lexer
FOLD_HEADER _ 0;" F class:lexer
FUNCTION _ 0;" F class:lexer
-FUNCTION _ 0;" F class:textadept.adeptsense
-FUNCTION_IMAGE _ 0;" F class:textadept.adeptsense
HIGHLIGHT_BRACES _ 0;" F class:textadept.editing
HOTSPOT_CLICK _ 0;" F class:events
HOTSPOT_DOUBLE_CLICK _ 0;" F class:events
@@ -202,6 +202,7 @@ MASK_FOLDERS _ 0;" F class:_SCINTILLA.constants
MAX_MARGIN _ 0;" F class:_SCINTILLA.constants
MAX_RECENT_FILES _ 0;" F class:textadept.session
MENU_CLICKED _ 0;" F class:events
+METHOD _ 0;" F class:textadept.editing.XPM_IMAGES
MODE _ 0;" F class:keys
MODEVENTMASKALL _ 0;" F class:_SCINTILLA.constants
MOD_ALT _ 0;" F class:_SCINTILLA.constants
@@ -217,16 +218,20 @@ MOD_CHANGESTYLE _ 0;" F class:_SCINTILLA.constants
MOD_CONTAINER _ 0;" F class:_SCINTILLA.constants
MOD_CTRL _ 0;" F class:_SCINTILLA.constants
MOD_DELETETEXT _ 0;" F class:_SCINTILLA.constants
+MOD_INSERTCHECK _ 0;" F class:_SCINTILLA.constants
MOD_INSERTTEXT _ 0;" F class:_SCINTILLA.constants
MOD_LEXERSTATE _ 0;" F class:_SCINTILLA.constants
MOD_META _ 0;" F class:_SCINTILLA.constants
MOD_NORM _ 0;" F class:_SCINTILLA.constants
MOD_SHIFT _ 0;" F class:_SCINTILLA.constants
MOD_SUPER _ 0;" F class:_SCINTILLA.constants
+MULTIAUTOC_EACH _ 0;" F class:_SCINTILLA.constants
+MULTIAUTOC_ONCE _ 0;" F class:_SCINTILLA.constants
MULTILINEUNDOREDO _ 0;" F class:_SCINTILLA.constants
MULTIPASTE_EACH _ 0;" F class:_SCINTILLA.constants
MULTIPASTE_ONCE _ 0;" F class:_SCINTILLA.constants
MULTISTEPUNDOREDO _ 0;" F class:_SCINTILLA.constants
+NAMESPACE _ 0;" F class:textadept.editing.XPM_IMAGES
NUMBER _ 0;" F class:lexer
OPERATOR _ 0;" F class:lexer
ORDER_CUSTOM _ 0;" F class:_SCINTILLA.constants
@@ -282,11 +287,14 @@ SEL_LINES _ 0;" F class:_SCINTILLA.constants
SEL_RECTANGLE _ 0;" F class:_SCINTILLA.constants
SEL_STREAM _ 0;" F class:_SCINTILLA.constants
SEL_THIN _ 0;" F class:_SCINTILLA.constants
+SIGNAL _ 0;" F class:textadept.editing.XPM_IMAGES
SILENT_PRINT _ 0;" F class:ui
+SLOT _ 0;" F class:textadept.editing.XPM_IMAGES
SNAPOPEN_MAX _ 0;" F class:io
STARTACTION _ 0;" F class:_SCINTILLA.constants
STRING _ 0;" F class:lexer
STRIP_TRAILING_SPACES _ 0;" F class:textadept.editing
+STRUCT _ 0;" F class:textadept.editing.XPM_IMAGES
STYLE_BRACEBAD _ 0;" F class:_SCINTILLA.constants
STYLE_BRACEBAD _ 0;" F class:lexer
STYLE_BRACELIGHT _ 0;" F class:_SCINTILLA.constants
@@ -322,6 +330,7 @@ STYLE_VARIABLE _ 0;" F class:lexer
STYLE_WHITESPACE _ 0;" F class:lexer
TIME_FOREVER _ 0;" F class:_SCINTILLA.constants
TYPE _ 0;" F class:lexer
+TYPEDEF _ 0;" F class:textadept.editing.XPM_IMAGES
TYPEOVER_CHARS _ 0;" F class:textadept.editing
UPDATE_CONTENT _ 0;" F class:_SCINTILLA.constants
UPDATE_H_SCROLL _ 0;" F class:_SCINTILLA.constants
@@ -332,6 +341,7 @@ URI_DROPPED _ 0;" F class:events
USER_LIST_SELECTION _ 0;" F class:events
V _ 0;" f class:lpeg
VARIABLE _ 0;" F class:lexer
+VARIABLE _ 0;" F class:textadept.editing.XPM_IMAGES
VIEW_AFTER_SWITCH _ 0;" F class:events
VIEW_BEFORE_SWITCH _ 0;" F class:events
VIEW_NEW _ 0;" F class:events
@@ -359,6 +369,7 @@ WRAP_WORD _ 0;" F class:_SCINTILLA.constants
WS_INVISIBLE _ 0;" F class:_SCINTILLA.constants
WS_VISIBLEAFTERINDENT _ 0;" F class:_SCINTILLA.constants
WS_VISIBLEALWAYS _ 0;" F class:_SCINTILLA.constants
+XPM_IMAGES _ 0;" t class:textadept.editing
_BUFFERS _ 0;" t
_CHARSET _ 0;" F
_G _ 0;" F
@@ -377,8 +388,10 @@ _M.lua _ 0;" m
_M.php _ 0;" m
_M.python _ 0;" m
_M.rails _ 0;" m
+_M.rest _ 0;" m
_M.rhtml _ 0;" m
_M.ruby _ 0;" m
+_M.yaml _ 0;" m
_NAME _ 0;" F class:lexer.lexer
_RELEASE _ 0;" F
_RULES _ 0;" F class:lexer.lexer
@@ -402,7 +415,6 @@ abspath _ 0;" f class:lfs
acos _ 0;" f class:math
add_selection _ 0;" f class:buffer
add_text _ 0;" f class:buffer
-add_trigger _ 0;" f class:textadept.adeptsense
additional_caret_fore _ 0;" F class:buffer
additional_carets_blink _ 0;" F class:buffer
additional_carets_visible _ 0;" F class:buffer
@@ -410,12 +422,10 @@ additional_sel_alpha _ 0;" F class:buffer
additional_sel_back _ 0;" F class:buffer
additional_sel_fore _ 0;" F class:buffer
additional_selection_typing _ 0;" F class:buffer
-adeptsense _ 0;" t class:textadept
all_lines_visible _ 0;" F class:buffer
allocate_extended_styles _ 0;" f class:buffer
alnum _ 0;" F class:lexer
alpha _ 0;" F class:lexer
-always_show_globals _ 0;" F class:textadept.adeptsense
anchor _ 0;" F class:buffer
annotation_clear_all _ 0;" f class:buffer
annotation_lines _ 0;" F class:buffer
@@ -427,7 +437,7 @@ ansi_c _ 0;" t class:_M
ansi_c _ 0;" t class:keys
ansi_c _ 0;" t class:snippets
any _ 0;" F class:lexer
-api_files _ 0;" t class:textadept.adeptsense
+api_files _ 0;" t class:textadept.editing
append_text _ 0;" f class:buffer
arg _ 0;" t
args _ 0;" m
@@ -460,7 +470,8 @@ auto_c_separator _ 0;" F class:buffer
auto_c_show _ 0;" f class:buffer
auto_c_stops _ 0;" f class:buffer
auto_c_type_separator _ 0;" F class:buffer
-autocomplete_word _ 0;" f class:textadept.editing
+autocomplete _ 0;" f class:textadept.editing
+autocompleters _ 0;" t class:textadept.editing
back_space_un_indents _ 0;" F class:buffer
back_tab _ 0;" f class:buffer
band _ 0;" f class:bit32
@@ -521,9 +532,7 @@ char_right_extend _ 0;" f class:buffer
char_right_rect_extend _ 0;" f class:buffer
chdir _ 0;" f class:lfs
choose_caret_x _ 0;" f class:buffer
-class_definition _ 0;" F class:textadept.adeptsense.syntax
clear _ 0;" f class:buffer
-clear _ 0;" f class:textadept.adeptsense
clear _ 0;" f class:textadept.bookmarks
clear_all _ 0;" f class:buffer
clear_document_style _ 0;" f class:buffer
@@ -544,9 +553,7 @@ command_entry _ 0;" t class:ui
comment_string _ 0;" t class:textadept.editing
compile _ 0;" f class:textadept.run
compile_commands _ 0;" t class:textadept.run
-complete _ 0;" f class:textadept.adeptsense
complete_lua _ 0;" f class:ui.command_entry
-completions _ 0;" t class:textadept.adeptsense
concat _ 0;" f class:table
config _ 0;" F class:package
connect _ 0;" f class:events
@@ -571,7 +578,6 @@ create _ 0;" f class:coroutine
css _ 0;" t class:_M
css _ 0;" t class:keys
css _ 0;" t class:snippets
-ctags_kinds _ 0;" t class:textadept.adeptsense
current_pos _ 0;" F class:buffer
currentdir _ 0;" f class:lfs
cursor _ 0;" F class:buffer
@@ -637,6 +643,7 @@ execute _ 0;" f class:os
execute_lua _ 0;" f class:ui.command_entry
exit _ 0;" f class:os
exp _ 0;" f class:math
+expr_types _ 0;" t class:_M.lua
extend _ 0;" F class:lexer
extensions _ 0;" t class:textadept.file_types
extra_ascent _ 0;" F class:buffer
@@ -682,9 +689,6 @@ form_feed _ 0;" f class:buffer
format _ 0;" f class:string
frexp _ 0;" f class:math
functions _ 0;" t class:_SCINTILLA
-get_apidoc _ 0;" f class:textadept.adeptsense
-get_class _ 0;" f class:textadept.adeptsense
-get_completions _ 0;" f class:textadept.adeptsense
get_cur_line _ 0;" f class:buffer
get_hotspot_active_back _ 0;" f class:buffer
get_hotspot_active_fore _ 0;" f class:buffer
@@ -696,7 +700,6 @@ get_line_sel_start_position _ 0;" f class:buffer
get_project_root _ 0;" f class:io
get_sel_text _ 0;" f class:buffer
get_split_table _ 0;" f class:ui
-get_symbol _ 0;" f class:textadept.adeptsense
get_text _ 0;" f class:buffer
getenv _ 0;" f class:os
gethook _ 0;" f class:debug
@@ -708,8 +711,8 @@ getregistry _ 0;" f class:debug
getupvalue _ 0;" f class:debug
getuservalue _ 0;" f class:debug
gmatch _ 0;" f class:string
+goto_anchor _ 0;" f class:_M.yaml
goto_buffer _ 0;" f class:view
-goto_ctag _ 0;" f class:textadept.adeptsense
goto_error _ 0;" f class:textadept.run
goto_file _ 0;" f class:ui
goto_file_found _ 0;" f class:ui.find
@@ -717,12 +720,11 @@ goto_line _ 0;" f class:buffer
goto_line _ 0;" f class:textadept.editing
goto_mark _ 0;" f class:textadept.bookmarks
goto_pos _ 0;" f class:buffer
+goto_section _ 0;" f class:_M.rest
goto_view _ 0;" f class:ui
graph _ 0;" F class:lexer
gsub _ 0;" f class:string
h_scroll_bar _ 0;" F class:buffer
-handle_clear _ 0;" f class:textadept.adeptsense
-handle_ctag _ 0;" f class:textadept.adeptsense
hex_num _ 0;" F class:lexer
hide_lines _ 0;" f class:buffer
hide_selection _ 0;" f class:buffer
@@ -758,7 +760,6 @@ indicator_current _ 0;" F class:buffer
indicator_end _ 0;" f class:buffer
indicator_fill_range _ 0;" f class:buffer
indicator_start _ 0;" f class:buffer
-inherited_classes _ 0;" t class:textadept.adeptsense
input _ 0;" f class:io
inputbox _ 0;" f class:ui.dialogs
insert _ 0;" f class:table
@@ -825,13 +826,11 @@ lines_split _ 0;" f class:buffer
load _ 0;" f
load _ 0;" f class:lexer
load _ 0;" f class:textadept.session
-load_ctags _ 0;" f class:textadept.adeptsense
load_project _ 0;" f class:_M.rails
loaded _ 0;" F class:package
loadfile _ 0;" f
loadlib _ 0;" f class:package
locale _ 0;" f class:lpeg
-locations _ 0;" t class:textadept.adeptsense
lock _ 0;" f class:lfs
lock_dir _ 0;" f class:lfs
log _ 0;" f class:math
@@ -905,7 +904,6 @@ multi_paste _ 0;" F class:buffer
multiple_selection _ 0;" F class:buffer
nested_pair _ 0;" f class:lexer
new _ 0;" f class:buffer
-new _ 0;" f class:textadept.adeptsense
new_line _ 0;" f class:buffer
newline _ 0;" F class:lexer
next _ 0;" f
@@ -918,6 +916,7 @@ oct_num _ 0;" F class:lexer
ok_msgbox _ 0;" f class:ui.dialogs
open _ 0;" f class:io
open_file _ 0;" f class:io
+open_image _ 0;" f class:_M.rest
open_recent_file _ 0;" f class:io
optionselect _ 0;" f class:ui.dialogs
os _ 0;" m
@@ -986,6 +985,7 @@ rawlen _ 0;" f
rawset _ 0;" f
read _ 0;" f class:file
read _ 0;" f class:io
+read _ 0;" f class:proc
read_only _ 0;" F class:buffer
recent_files _ 0;" t class:io
rectangular_selection_anchor _ 0;" F class:buffer
@@ -1016,6 +1016,9 @@ replace_target_re _ 0;" f class:buffer
representation _ 0;" F class:buffer
require _ 0;" f
reset _ 0;" f
+rest _ 0;" t class:_M
+rest _ 0;" t class:keys
+rest _ 0;" t class:snippets
resume _ 0;" f class:coroutine
reverse _ 0;" f class:string
rgba_image_height _ 0;" F class:buffer
@@ -1079,23 +1082,20 @@ selection_n_end _ 0;" F class:buffer
selection_n_start _ 0;" F class:buffer
selection_start _ 0;" F class:buffer
selections _ 0;" F class:buffer
-self _ 0;" F class:textadept.adeptsense.syntax
-sense _ 0;" F class:_M.ansi_c
sense _ 0;" F class:_M.css
sense _ 0;" F class:_M.html
sense _ 0;" F class:_M.java
-sense _ 0;" F class:_M.lua
sense _ 0;" F class:_M.php
sense _ 0;" F class:_M.python
sense _ 0;" F class:_M.rails
sense _ 0;" F class:_M.rhtml
sense _ 0;" F class:_M.ruby
session _ 0;" t class:textadept
-set_buffer_encoding _ 0;" f class:io
set_chars_default _ 0;" f class:buffer
set_contextmenu _ 0;" f class:textadept.menu
set_contextmenus _ 0;" f class:textadept.menu
set_empty_selection _ 0;" f class:buffer
+set_encoding _ 0;" f class:buffer
set_fold_margin_colour _ 0;" f class:buffer
set_fold_margin_hi_colour _ 0;" f class:buffer
set_hotspot_active_back _ 0;" f class:buffer
@@ -1126,8 +1126,8 @@ setupvalue _ 0;" f class:debug
setuservalue _ 0;" f class:debug
setvbuf _ 0;" f class:file
shebangs _ 0;" t class:textadept.file_types
-show_apidoc _ 0;" f class:textadept.adeptsense
show_completions _ 0;" f class:ui.command_entry
+show_documentation _ 0;" f class:textadept.editing
show_lines _ 0;" f class:buffer
sin _ 0;" f class:math
singular _ 0;" F class:_M.rails
@@ -1180,9 +1180,7 @@ style_visible _ 0;" F class:buffer
sub _ 0;" f class:string
swap_main_anchor_caret _ 0;" f class:buffer
switch_buffer _ 0;" f class:ui
-symbol_chars _ 0;" F class:textadept.adeptsense.syntax
symlinkattributes _ 0;" f class:lfs
-syntax _ 0;" t class:textadept.adeptsense
tab _ 0;" f class:buffer
tab_context_menu _ 0;" F class:ui
tab_indents _ 0;" F class:buffer
@@ -1192,6 +1190,8 @@ table _ 0;" m
table _ 0;" t
tabs _ 0;" F class:ui
tag _ 0;" F class:buffer
+tags _ 0;" t class:_M.ansi_c
+tags _ 0;" t class:_M.lua
tan _ 0;" f class:math
tanh _ 0;" f class:math
target_end _ 0;" F class:buffer
@@ -1203,7 +1203,6 @@ text_range _ 0;" f class:buffer
text_width _ 0;" f class:buffer
textadept _ 0;" m
textadept _ 0;" t
-textadept.adeptsense _ 0;" m
textadept.bookmarks _ 0;" m
textadept.editing _ 0;" m
textadept.file_types _ 0;" m
@@ -1235,9 +1234,6 @@ two_phase_draw _ 0;" F class:buffer
type _ 0;" f
type _ 0;" f class:io
type _ 0;" f class:lpeg
-type_assignments _ 0;" F class:textadept.adeptsense.syntax
-type_declarations _ 0;" F class:textadept.adeptsense.syntax
-type_declarations_exclude _ 0;" F class:textadept.adeptsense.syntax
typeover_chars _ 0;" t class:textadept.editing
ui _ 0;" m
ui _ 0;" t
@@ -1280,7 +1276,6 @@ whole_word _ 0;" F class:ui.find
whole_word_label_text _ 0;" F class:ui.find
word _ 0;" F class:lexer
word_chars _ 0;" F class:buffer
-word_chars _ 0;" F class:textadept.adeptsense.syntax
word_end_position _ 0;" f class:buffer
word_left _ 0;" f class:buffer
word_left_end _ 0;" f class:buffer
@@ -1310,6 +1305,9 @@ x_offset _ 0;" F class:buffer
xdigit _ 0;" F class:lexer
xor _ 0;" f class:bit32
xpcall _ 0;" f
+yaml _ 0;" t class:_M
+yaml _ 0;" t class:keys
+yaml _ 0;" t class:snippets
yesno_msgbox _ 0;" f class:ui.dialogs
yield _ 0;" f class:coroutine
zoom _ 0;" F class:buffer
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
deleted file mode 100644
index 3a253d58..00000000
--- a/modules/textadept/adeptsense.lua
+++ /dev/null
@@ -1,1020 +0,0 @@
--- Copyright 2007-2014 Mitchell mitchell.att.foicica.com. See LICENSE.
-
-local M = {}
-
---[[ This comment is for LuaDoc.
----
--- Code autocompletion and documentation support for programming languages.
---
--- ## Overview
---
--- Adeptsense is a form of autocompletion for programming. Object-oriented
--- programming languages often have class types with member methods. For
--- example, the Ruby and Java programming languages implement "String" classes
--- with member functions that return the uppercase versions of the strings. This
--- looks like:
---
--- # Ruby | // Java
--- foo = "bar" | String foo = "bar";
--- foo.upcase! | foo = foo.toUpperCase();
---
--- In both cases, Adeptsense recognizes that the variable "foo" is of class type
--- "String" and displays a list of known methods in the "String" class (which
--- includes the appropriate one shown above) after the user types "foo.". Upon
--- request, Adeptsense also displays any known documentation for the symbol
--- under the caret, such as the "upcase!" and "toUpperCase" methods, in the form
--- of a calltip.
---
--- The first part of this document deals with constructing a simple Adeptsense.
--- The second part deals with more advanced techniques for "fine-tuning"
--- Adeptsenses, such as overriding default behaviors and recognizing additional
--- language features. The last part shows you how to generate Adeptsense data
--- for any Lua modules you have so that Textadept can provide additional
--- completions and documentation while you write your scripts.
---
--- ## Adeptsense Basics
---
--- Adeptsenses exist per-language so [language modules][] typically define them.
--- Before attempting to write an Adeptsense, first determine if the module for
--- your language has an Adeptsense. Textadept's official language modules have
--- Adeptsenses and are good reference sources. If your language is similar to
--- any of Textadept's, you may be able to copy and modify that language's
--- Adeptsense, saving some time and effort.
---
--- [language modules]: _M.html#Language.Modules
---
--- Creating a new instance of an Adeptsense from within a language module is
--- easy. Just replace the '?' with the name of your language:
---
--- M.sense = textadept.adeptsense.new('?')
---
--- ### Terminology
---
--- Since some programming languages like Lua are not object-oriented, the terms
--- "classes" and "methods" may not mean anything to those languages. In an
--- attempt to cater to all languages, Adeptsense adopts the terms "class",
--- "function", and "field". However, "classes" are simply containers for
--- "functions" and "fields" while "functions" and "fields" are just entities
--- distinguishable only by an icon in the autocompletion list. The Lua
--- Adeptsense considers modules and tables as "classes", functions as
--- "functions", and module/table keys as "fields".
---
--- ### Syntax Options
---
--- Take a moment to think about your programming language and its syntax. How
--- do you declare "classes"? What characters can you use in identifiers? Is the
--- language statically typed? If so, how do you declare a variable's class type?
--- If not, how might you infer a variable's class type? You must answer all of
--- these questions in an Adeptsense's [`syntax`](#syntax) table. Please see its
--- documentation for details.
---
--- #### Example Syntax Options
---
--- So, how might you define syntax options for your language? Here are some
--- examples.
---
--- **Lua**
---
--- Lua is a dynamically typed language with no built-in object-oriented
--- features. As noted earlier, the Lua Adeptsense considers modules and tables
--- as "classes" and thus uses Lua 5.1's `module()` as a "class" declaration. Lua
--- allows alphanumerics and underscores in its identifiers and uses the '.' and
--- ':' characters to access the functions and fields of "classes". Since the
--- language is dynamically typed, it has no class type declaration and instead
--- relies on type inference through assignment to entities like strings, other
--- tables, or the result of a function call like `io.open()`.
---
--- M.sense.syntax.class_definition = 'module%s*%(?%s*[\'"]([%w_%.]+)'
--- M.sense.syntax.symbol_chars = '[%w_%.:]'
--- M.sense.syntax.type_declarations = {}
--- M.sense.syntax.type_assignments = {
--- ['^[\'"]'] = 'string', -- foo = 'bar' or foo = "bar"
--- ['^([%w_%.]+)%s*$'] = '%1', -- foo = textadept.adeptsense
--- ['^io%.p?open%s*%b()%s*$'] = 'file' -- f = io.open('foo')
--- }
---
--- The beginning '^' in these type assignment patterns is necessary since
--- Adeptsense starts matching on the right-hand side of an assignment.
--- Otherwise, `local foo = bar('baz')` might infer an incorrect class type.
---
--- **Java**
---
--- Java is a statically typed, object-oriented language. It has most of the
--- default syntax features that Adeptsense assumes except for parameterized list
--- class types.
---
--- local td = M.sense.syntax.type_declarations
--- td[#td + 1] = '(%u[%w_%.]+)%b<>%s+%_' -- List<Foo> bar
---
--- The "%_" sequence in this pattern matches the symbol part of the type
--- declaration.
---
--- ### Completion Lists
---
--- Even though your Adeptsense now understands the basic syntax of your
--- programming language, it is not smart enough to parse code in order to
--- generate lists of function and field completions for classes. Instead, you
--- must supply this information to your Adeptsense's
--- [`completions`](#completions) table. The table contains string class names
--- assigned to tables that themselves contain `functions` and `fields`
--- completion tables. Here is the general form:
---
--- M.sense.completions = {
--- ['class1'] = {
--- functions = {'fun1', 'fun2', ...},
--- fields = {'f1', 'f2', ...}
--- },
--- ['class2'] = ...,
--- ...
--- }
---
--- Obviously, manually creating completion lists is incredibly time-consuming so
--- Adeptsense provides a shortcut method.
---
--- #### Ctags
---
--- Adeptsense recognizes the output from [Ctags][] and uses the output along
--- with your Adeptsense's [`ctags_kinds`](#ctags_kinds) to populate
--- `completions`. Ctags has a list of "kinds" for every language. View them by
--- running `ctags --list-kinds` in your shell. Since Adeptsense only cares about
--- classes, functions, and fields, you need to let it know which kind of tag is
--- which. After that, load your sets of tags using
--- [`load_ctags()`](#load_ctags). Here are some examples:
---
--- **C/C++**
---
--- local as = textadept.adeptsense
--- M.sense.ctags_kinds = {
--- c = as.CLASS, d = as.FUNCTION, e = as.FIELD, f = as.FUNCTION,
--- g = as.CLASS, m = as.FIELD, s = as.CLASS, t = as.CLASS
--- }
--- M.sense:load_ctags(_HOME..'/modules/cpp/tags', true)
---
--- **Lua**
---
--- Unfortunately, Lua support in Ctags is poor. Instead, Textadept has a tool
--- (*modules/lua/adeptsensedoc.lua*) to generate a more useful set of tags. The
--- tool tags functions as `'f'`, module fields as `'F'`, modules as `'m'`, and
--- table keys as `'t'`.
---
--- M.sense.ctags_kinds = {
--- f = textadept.adeptsense.FUNCTION,
--- F = textadept.adeptsense.FIELD,
--- m = textadept.adeptsense.CLASS,
--- t = textadept.adeptsense.FIELD,
--- }
--- M.sense:load_ctags(_HOME..'/modules/lua/tags', true)
---
--- [ctags]: http://ctags.sourceforge.net
---
--- ### API Documentation
---
--- Like with completion lists, Adeptsense is not smart enough to parse code to
--- generate API documentation. You must do so manually in a set of API files and
--- add them to your Adeptsense's [`api_files`](#api_files) table. The table's
--- documentation describes API file structure and format.
---
--- ### Triggers
---
--- At this point, your Adeptense understands your language's syntax, has a set
--- of completions for classes, and knows where to look up API documentation
--- from. The only thing left to do is to tell your Adeptsense what characters
--- trigger autocompletion. Use [`add_trigger()`](#add_trigger) to do this. Some
--- examples:
---
--- **C/C++**
---
--- M.sense:add_trigger('.')
--- M.sense:add_trigger('->')
---
--- **Lua**
---
--- M.sense:add_trigger('.')
--- M.sense:add_trigger(':', false, true)
---
--- ### Summary
---
--- Adeptsense is flexible enough to support code autocompletion and API
--- reference for many different programming languages. By simply setting some
--- basic syntax parameters in a new Adeptsense instance, loading a set of
--- completions and API documentation, and specifying characters that trigger
--- autocompletion, you created a powerful tool to help write code faster and
--- understand code better.
---
--- ## Advanced Techniques
---
--- ### Fine-Tuning
---
--- Adeptsense's defaults are adequate enough to provide basic autocompletion for
--- a wide range of programming languages. However, sometimes you need more
--- control. For example, when determining the class of the symbol to
--- autocomplete, Adeptsense calls [`get_class()`](#get_class). This function
--- utilizes the Adeptsense's `syntax.type_declarations` and
--- `syntax.type_assignments` to help, but those tables may not be granular
--- enough for your language. (For example, in Ruby, everything is an object --
--- even numbers. "0.to_s" is perfectly valid syntax.) Adeptsense allows you to
--- override its default functionality:
---
--- function M.sense:get_class(symbol)
--- if condition then
--- return self.super.get_class(self, symbol) -- default behavior
--- else
--- -- different behavior
--- end
--- end
---
--- Use the `self.super` table to call on default functionality.
---
--- Below are some examples of overriding default functionality for the Ruby and
--- Java languages.
---
--- **Ruby**
---
--- As mentioned earlier, everything in Ruby is an object, including numbers.
--- Since numbers may exist by themselves, those instances do not have a type
--- declaration or type assignment. In that case, the Ruby Adeptsense's
--- `get_class()` needs to return "Integer" or "Float" if the symbol is a number.
---
--- function sense:get_class(symbol)
--- local class = self.super.get_class(self, symbol)
--- if class then return class end
--- -- Integers and Floats.
--- if tonumber(symbol:match('^%d+%.?%d*$')) then
--- return symbol:find('%.') and 'Float' or 'Integer'
--- end
--- return nil
--- end
---
--- Since `syntax.symbol_chars` does not contain '+' and '-' characters, *symbol*
--- does not need to match them.
---
--- Another consequence of the "everything is an object" rule is that, like
--- numbers, strings, arrays, hashes, etc. may also exist alone. (For example,
--- "[1, 2, 3]." needs to show Array completions.) Since symbols only contain
--- alphanumerics, '_', '?', and '!' characters, the Ruby Adeptsense needs to
--- override the default [`get_symbol()`](#get_symbol) functionality.
---
--- function sense:get_symbol()
--- local line, p = buffer:get_cur_line()
--- if line:sub(1, p):match('%[.-%]%s*%.$') then
--- return 'Array', ''
--- end
--- -- More checks for strings, hashes, symbols, regexps, etc.
--- return self.super.get_symbol(self)
--- end
---
--- **Java**
---
--- Autocompletion of Java `import` statements is something nice to have. You can
--- construct an import completion list from Ctags's package tags. By default,
--- Adeptsense ignores any tags not mapped to classes, functions, or fields in
--- [`ctags_kinds`](#ctags_kinds) and passes the unknown tags to
--- [`handle_ctag()`](#handle_ctag). In this case, the Java Adeptsense needs to
--- handle package ('p') tags.
---
--- function sense:handle_ctag(tag_name, file_name, ex_cmd, ext_fields)
--- if ext_fields:sub(1, 1) ~= 'p' then return end -- not a package
--- if not self.imports then self.imports = {} end
--- local import = self.imports
--- for package in tag_name:gmatch('[^.]+') do
--- if not import[package] then import[package] = {} end
--- import = import[package]
--- end
--- import[#import + 1] = file_name:match('([^/\\]-)%.java$')
--- end
---
--- Now that the Adeptsense has a set of import completions, the '.' trigger key
--- should only autocomplete packages on a line that starts with "import". Since
--- [`get_completions()`](#get_completions) is responsible for getting the set of
--- completions for a particular symbol, the Java Adeptsense must override it.
---
--- function sense:get_completions(symbol, ofields, ofunctions)
--- if not buffer:get_cur_line():find('^%s*import') then
--- return self.super.get_completions(self, symbol, ofields, ofunctions)
--- end
--- if symbol == 'import' then symbol = '' end -- top-level import
--- local c = {}
--- local import = self.imports or {}
--- for package in symbol:gmatch('[^%.]+') do
--- if not import[package] then return nil end
--- import = import[package]
--- end
--- for k, v in pairs(import) do
--- c[#c + 1] = type(v) == 'table' and k..'?1' or v..'?2'
--- end
--- table.sort(c)
--- return c
--- end
---
--- The "?1" and "?2" appended to each completion entry tell Adeptsense which
--- icon to display for each entry in the autocompletion list. Entries do not
--- need to have icons. '1' is for fields and '2' is for functions. In this case,
--- the icons distinguish between a parent package and a package with no
--- children.
---
--- Finally the Adeptsense should clear the `imports` table it created when the
--- Adeptsense is cleared so-as to free up memory immediately. This is done in
--- [`handle_clear()`](#handle_clear).
---
--- function sense:handle_clear()
--- self.imports = {}
--- end
---
--- ### Child Language Adeptsenses
---
--- When the user triggers autocompletion, Adeptsense uses the Adeptsense for the
--- language at the *caret position*, not necessarily the Adeptsense for the
--- parent language. For example, when editing CSS inside of an HTML file, the
--- user expects CSS completions. However, Textadept does not automatically load
--- child language Adeptsenses. The parent language must do this. For example:
---
--- -- In file *modules/html/init.lua*.
--- -- Load CSS Adeptsense.
--- if not _M.css then _M.css = require('css') end
---
--- ## Generating Lua Adeptsense
---
--- You can generate Lua Adeptsense for your own modules using the Lua language
--- module's *adeptsensedoc.lua* module with [LuaDoc][]:
---
--- luadoc -d . --doclet _HOME/modules/lua/adeptsensedoc [module(s)]
---
--- with `_HOME` being where you installed Textadept. LuaDoc outputs *tags* and
--- *api* files to the current directory. Load them via
--- [`load_ctags()`](#load_ctags) and [`api_files`](#api_files), respectively.
---
--- [LuaDoc]: http://keplerproject.github.com/luadoc/
---
--- #### Module Fields
---
--- Not only does the Lua Adeptsense generator recognize functions and tables
--- within modules, but it also recognizes module fields and their class types
--- with a certain syntax:
---
--- <pre><code>---
--- -- Module documentation.
--- -- &#64;field field_name (type)
--- -- Field documentation.
--- </code></pre>
---
--- or
---
--- <pre><code>---
--- -- Module documentation
--- -- * `field_name` (type)
--- -- Field documentation.
--- -- Multiple documentation lines must be indented.
--- </code></pre>
---
--- The latter ``-- * `field_name` `` syntax may appear anywhere inside a module,
--- not just the module LuaDoc.
--- @field always_show_globals (bool)
--- Include globals in the list of completions offered.
--- Globals are classes, functions, and fields that do not belong to another
--- class. They are contained in `sense.completions['']`.
--- The default value is `true`.
--- @field FUNCTION_IMAGE (string)
--- XPM image for Adeptsense functions.
--- @field FIELD_IMAGE (string)
--- XPM image for Adeptsense fields.
--- @field CLASS (string)
--- Ctags kind for Adeptsense classes.
--- @field FUNCTION (string)
--- Ctags kind for Adeptsense functions.
--- @field FIELD (string)
--- Ctags kind for Adeptsense fields.
-module('textadept.adeptsense')]]
-
-local senses = {}
-
-M.FUNCTION_IMAGE = not CURSES and '/* XPM */\nstatic char *function[] = {\n/* columns rows colors chars-per-pixel */\n"16 16 5 1",\n" c #000000",\n". c #E0BC38",\n"X c #F0DC5C",\n"o c #FCFC80",\n"O c None",\n/* pixels */\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOO OOOO",\n"OOOOOOOOO oo OO",\n"OOOOOOOO ooooo O",\n"OOOOOOO ooooo. O",\n"OOOO O XXoo.. O",\n"OOO oo XXX... O",\n"OO ooooo XX.. OO",\n"O ooooo. X. OOO",\n"O XXoo.. O OOOO",\n"O XXX... OOOOOOO",\n"O XXX.. OOOOOOOO",\n"OO X. OOOOOOOOO",\n"OOOO OOOOOOOOOO"\n};' or '*'
-M.FIELD_IMAGE = not CURSES and '/* XPM */\nstatic char *field[] = {\n/* columns rows colors chars-per-pixel */\n"16 16 5 1",\n" c #000000",\n". c #8C748C",\n"X c #9C94A4",\n"o c #ACB4C0",\n"O c None",\n/* pixels */\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOOOOOOOOO",\n"OOOOOOOOO OOOOO",\n"OOOOOOOO oo OOO",\n"OOOOOOO ooooo OO",\n"OOOOOO ooooo. OO",\n"OOOOOO XXoo.. OO",\n"OOOOOO XXX... OO",\n"OOOOOO XXX.. OOO",\n"OOOOOOO X. OOOO",\n"OOOOOOOOO OOOOO",\n"OOOOOOOOOOOOOOOO"\n};' or '+'
-
-M.CLASS = 'classes'
-M.FUNCTION = 'functions'
-M.FIELD = 'fields'
-
----
--- Returns the full symbol and the current symbol part behind the caret.
--- For example: `buffer.cur` would return `'buffer'` and `'cur'`.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @return symbol or `''`
--- @return part or `''`
--- @name get_symbol
-function M.get_symbol(sense)
- local line, p = buffer:get_cur_line()
- local sc, wc = sense.syntax.symbol_chars, sense.syntax.word_chars
- local patt = string.format('(%s-)[^%s%%s]+([%s]*)$', sc, wc, wc)
- local symbol, part = line:sub(1, p):match(patt)
- if not symbol then part = line:sub(1, p):match('(['..wc..']*)$') end
- return symbol or '', part or ''
-end
-
----
--- Returns the class type of *symbol* name.
--- If *symbol* is `sense.syntax.self` and occurs inside a class definition that
--- matches `sense.syntax.class_definition`, that class is returned. Otherwise,
--- the buffer is searched backwards for either a type declaration of *symbol*
--- according to the patterns in `sense.syntax.type_declarations`, or for a type
--- assignment of *symbol* according to `sense.syntax.type_assignments`,
--- whichever comes first.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param symbol The symbol name to get the class of.
--- @return class or `nil`
--- @see syntax
--- @name get_class
-function M.get_class(sense, symbol)
- local buffer = buffer
- local self = sense.syntax.self
- local class_definition = sense.syntax.class_definition
- local completions = sense.completions
- local symbol_chars = sense.syntax.symbol_chars
- local type_declarations = sense.syntax.type_declarations
- local exclude = sense.syntax.type_declarations_exclude
- local type_assignments = sense.syntax.type_assignments
- local assignment_patt = symbol..'%s*=%s*([^\r\n]+)'
- local class, superclass, assignment
- for i = buffer:line_from_position(buffer.current_pos), 0, -1 do
- local s, e
- if symbol == self or symbol == '' then
- -- Determine type from the class declaration.
- s, e, class, superclass = buffer:get_line(i):find(class_definition)
- if class and not completions[class] then
- class = completions[superclass] and superclass or nil
- end
- else
- -- Search for a type declaration or type assignment.
- local line = buffer:get_line(i)
- if line:find(symbol) then
- for _, patt in ipairs(type_declarations) do
- s, e, class = line:find(patt:gsub('%%_', symbol))
- if class and exclude[class] then class = nil end
- if class then break end
- 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
- end
- end
- end
- end
- if class then
- -- The type declaration should not be in a comment or string.
- local pos = buffer:position_from_line(i)
- local style = buffer.style_name[buffer.style_at[pos + s - 1]]
- if style ~= 'comment' and style ~= 'string' then break end
- class = nil
- end
- end
- return class
-end
-
--- Adds an inherited class's completions to the given completion list.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param class The name of the class to add inherited completions from.
--- @param only_fields If `true`, adds only fields to the completion list. The
--- default value is `false`.
--- @param only_funcs If `true`, adds only functions to the completion list. The
--- default value is `false`.
--- @param c The completion list to add completions to.
--- @param added Table that keeps track of what inherited classes have been
--- added. This prevents stack overflow errors. Should be `{}` on the initial
--- call to `add_inherited()`.
-local function add_inherited(sense, class, only_fields, only_funcs, c, added)
- local inherited_classes = sense.inherited_classes[class]
- if not inherited_classes or added[class] then return end
- local completions = sense.completions
- for _, inherited_class in ipairs(inherited_classes) do
- local inherited_completions = completions[inherited_class]
- if inherited_completions then
- if not only_fields then
- for _, v in ipairs(inherited_completions.functions) do c[#c + 1] = v end
- end
- if not only_funcs then
- for _, v in ipairs(inherited_completions.fields) do c[#c + 1] = v end
- end
- end
- added[class] = true
- add_inherited(sense, inherited_class, only_fields, only_funcs, c, added)
- end
-end
-
----
--- Returns the list of completions for string *symbol*.
--- If either *only_fields* or *only_functions* is `true`, returns the
--- appropriate subset of completions.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param symbol The symbol name to get completions for.
--- @param only_fields Optional flag indicating whether or not to return a list
--- of only fields. The default value is `false`.
--- @param only_functions Optional flag indicating whether or not to return a
--- list of only functions. The default value is `false`.
--- @return completion_list or `nil`
--- @name get_completions
-function M.get_completions(sense, symbol, only_fields, only_functions)
- if only_fields and only_functions or not symbol then return nil end
- local compls = sense.completions
- local class = compls[symbol] and symbol or sense:get_class(symbol)
- if not compls[class] then return nil end
-
- -- If there is no symbol, try to determine the context class. If one exists,
- -- display its completions in addition to global completions.
- local include_globals = false
- if symbol == '' then
- local context_class = sense:get_class(symbol)
- if context_class and compls[context_class] then
- class = context_class
- include_globals = sense.always_show_globals and compls[''] ~= nil
- end
- end
-
- -- Create list of completions.
- local c = {}
- if not only_fields then
- for _, v in ipairs(compls[class].functions) do c[#c + 1] = v end
- if include_globals and class ~= '' then
- for _, v in ipairs(compls[''].functions) do c[#c + 1] = v end
- end
- end
- if not only_functions then
- for _, v in ipairs(compls[class].fields) do c[#c + 1] = v end
- if include_globals and class ~= '' then
- for _, v in ipairs(compls[''].fields) do c[#c + 1] = v end
- end
- end
- add_inherited(sense, class, only_fields, only_functions, c, {})
-
- -- Remove duplicates and non-toplevel classes (if necessary).
- if not buffer.auto_c_ignore_case then
- table.sort(c)
- else
- table.sort(c, function(a, b) return a:upper() < b:upper() end)
- end
- local table_remove, nwc = table.remove, '[^'..sense.syntax.word_chars..'%?]'
- for i = #c, 2, -1 do
- if c[i] == c[i - 1] or c[i]:find(nwc) then table_remove(c, i) end
- end
- return c
-end
-
----
--- Shows an autocompletion list for the symbol behind the caret, returning
--- `true` on success.
--- If either *only_fields* or *only_functions* is `true`, displays the
--- appropriate subset of completions.
--- @param sense The Adeptsense returned by `adeptsense.new()`. If `nil`, uses
--- the current language's Adeptsense (if it exists).
--- @param only_fields Optional flag indicating whether or not to return a list
--- of only fields. The default value is `false`.
--- @param only_functions Optional flag indicating whether or not to return a
--- list of only functions. The default value is `false`.
--- @return `true` on success or `false`.
--- @see get_symbol
--- @see get_completions
--- @name complete
-function M.complete(sense, only_fields, only_functions)
- sense = sense or (_M[buffer:get_lexer(true)] or {}).sense
- if not sense then return end
- local symbol, part = sense:get_symbol()
- local completions = sense:get_completions(symbol, only_fields, only_functions)
- if not completions then return false end
- buffer:register_image(1, M.FIELD_IMAGE)
- buffer:register_image(2, M.FUNCTION_IMAGE)
- if not buffer.auto_c_choose_single or #completions ~= 1 then
- buffer.auto_c_order = 0 -- pre-sorted
- buffer:auto_c_show(#part, table.concat(completions, ' '))
- else
- -- Scintilla does not emit `AUTO_C_SELECTION` in this case. This is
- -- necessary for autocompletion with multiple selections.
- local text = completions[1]:sub(#part + 1):match('^(.+)%?%d+$')
- events.emit(events.AUTO_C_SELECTION, text, buffer.current_pos)
- end
- return true
-end
-
----
--- Allows the user to autocomplete the symbol behind the caret by typing
--- character(s) *c*.
--- If either *only_fields* or *only_functions* is `true`, displays the
--- appropriate subset of completions.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param c The character(s) that triggers the autocompletion. You can have up
--- to two characters.
--- @param only_fields Optional flag indicating whether or not this trigger only
--- completes fields. The default value is `false`.
--- @param only_functions Optional flag indicating whether or not this trigger
--- only completes functions. The default value is `false`.
--- @usage sense:add_trigger('.')
--- @usage sense:add_trigger(':', false, true) -- only functions
--- @usage sense:add_trigger('->')
--- @name add_trigger
-function M.add_trigger(sense, c, only_fields, only_functions)
- if #c > 2 then return end -- TODO: warn
- local c1, c2 = c:match('.$'):byte(), #c > 1 and c:sub(1, 1):byte()
- sense.events[#sense.events + 1] = function(char)
- if char == c1 and buffer:get_lexer(true) == sense.lexer then
- if c2 and buffer.char_at[buffer.current_pos - 2] ~= c2 then return end
- sense:complete(only_fields, only_functions)
- end
- end
- events.connect(events.CHAR_ADDED, sense.events[#sense.events])
-end
-
----
--- Returns the list of API documentation strings for string *symbol*.
--- A `pos` key in that list holds the index of the documentation string that
--- should be shown.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param symbol The symbol name to get apidocs for.
--- @return list of apidocs or `nil`
--- @name get_apidoc
-function M.get_apidoc(sense, symbol)
- if not symbol then return nil end
- local apidocs = {pos = 1}
- local word_chars = sense.syntax.word_chars
- local patt = string.format('^(.-)[^%s]*([%s]+)$', word_chars, word_chars)
- local entity, func = symbol:match(patt)
- if not func then return nil end
- local c = func:sub(1, 1) -- for quick comparison
- local patt = '^'..func:gsub('([%.%-%?])', '%%%1')..'%s+(.+)$'
- for _, file in ipairs(sense.api_files) do
- if lfs.attributes(file) then
- for line in io.lines(file) do
- if line:sub(1, 1) == c then apidocs[#apidocs + 1] = line:match(patt) end
- end
- end
- end
- if #apidocs == 0 then return nil end
- -- Try to display the type-correct apidoc by getting the entity the function
- -- is being called on and attempting to determine its class type. Otherwise,
- -- fall back to the entity itself. In order for this to work, the first line
- -- in the apidoc must start with the entity (e.g. Class.function).
- local class = sense.completions[entity] or sense:get_class(entity)
- if entity == '' then class = sense:get_class(entity) end
- if type(class) ~= 'string' then class = entity end -- fall back to entity
- for i, apidoc in ipairs(apidocs) do
- if apidoc:sub(1, #class) == class then apidocs.pos = i break end
- end
- return apidocs
-end
-
-local apidocs = nil
-
----
--- Shows a call tip with API documentation for the symbol behind the caret.
--- If a call tip is already shown, cycles to the next one if it exists.
--- @param sense The Adeptsense returned by `adeptsense.new()`. If `nil`, uses
--- the current language's Adeptsense (if it exists).
--- @return list of apidocs on success or `nil`.
--- @see get_symbol
--- @see get_apidoc
--- @name show_apidoc
-function M.show_apidoc(sense)
- if buffer:call_tip_active() then events.emit(events.CALL_TIP_CLICK) return end
- sense = sense or (_M[buffer:get_lexer(true)] or {}).sense
- if not sense then return end
- local symbol
- local s, e = buffer.selection_start, buffer.selection_end
- if s == e then
- buffer:goto_pos(buffer:word_end_position(s, true))
- local line, p = buffer:get_cur_line()
- line = line:sub(1, p)
- symbol = line:match('('..sense.syntax.symbol_chars..'+)%s*$') or
- line:match('('..sense.syntax.symbol_chars..'+)%s*%([^()]*$') or ''
- buffer:goto_pos(e)
- else
- symbol = buffer:text_range(s, e)
- end
- apidocs = sense:get_apidoc(symbol)
- if not apidocs then return nil end
- for i, doc in ipairs(apidocs) do
- doc = doc:gsub('\\\\', '%%esc%%'):gsub('\\n', '\n'):gsub('%%esc%%', '\\')
- if #apidocs > 1 then
- if not doc:find('\n') then doc = doc..'\n' end
- doc = '\001'..doc:gsub('\n', '\n\002', 1)
- end
- apidocs[i] = doc
- end
- buffer:call_tip_show(buffer.current_pos, apidocs[apidocs.pos or 1])
- return apidocs
-end
-
--- Cycle through apidoc calltips.
-events.connect(events.CALL_TIP_CLICK, function(position)
- if not apidocs then return end
- apidocs.pos = apidocs.pos + (position == 1 and -1 or 1)
- if apidocs.pos > #apidocs then apidocs.pos = 1 end
- if apidocs.pos < 1 then apidocs.pos = #apidocs end
- buffer:call_tip_show(buffer.current_pos, apidocs[apidocs.pos])
-end)
-
----
--- Generates a set of symbol completion lists from Ctags file *tag_file* and
--- adds the set to the Adeptsense.
--- *no_locations* indicates whether or not to store the location part of tags.
--- If `true`, `sense:goto_ctag()` cannot be used with this set of tags. It is
--- recommended to pass `-n` to `ctags` in order to use line numbers instead of
--- text patterns to locate tags. This will greatly reduce memory usage for a
--- large number of symbols if *no_locations* is `false`.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param tag_file The path of the Ctags file to load.
--- @param no_locations Optional flag indicating whether or not to discard the
--- locations of the tags for use by `sense:goto_ctag()`. The default value is
--- `false`.
--- @name load_ctags
-function M.load_ctags(sense, tag_file, no_locations)
- local ctags_kinds = sense.ctags_kinds
- local completions = sense.completions
- local locations = sense.locations
- local inherited_classes = sense.inherited_classes
- local ctags_fmt = '^(%S+)\t([^\t]+)\t(.-);"\t(.*)$'
- for line in io.lines(tag_file) do
- local tag_name, file_name, ex_cmd, ext_fields = line:match(ctags_fmt)
- if tag_name then
- local k = ext_fields:sub(1, 1)
- local kind = ctags_kinds[k]
- if kind == M.FUNCTION or kind == M.FIELD then
- -- Update completions.
- -- If no class structure is found, the global namespace is used.
- for _, key in ipairs{'class', 'interface', 'struct', 'union', ''} do
- local class = (key == '') and '' or ext_fields:match(key..':(%S+)')
- if class then
- if not completions[class] then
- completions[class] = {fields = {}, functions = {}}
- end
- local t = completions[class][kind]
- t[#t + 1] = tag_name..(kind == M.FIELD and '?1' or '?2')
- -- Update locations.
- if not no_locations then
- if not locations[k] then locations[k] = {} end
- locations[k][class..'#'..tag_name] = {file_name, ex_cmd}
- end
- break
- end
- end
- elseif kind == M.CLASS then
- -- Update class list.
- local inherits = ext_fields:match('inherits:(%S+)')
- if not inherits then inherits = ext_fields:match('struct:(%S+)') end
- if inherits then
- inherited_classes[tag_name] = {}
- for class in inherits:gmatch('[^,]+') do
- local t = inherited_classes[tag_name]
- t[#t + 1] = class
- -- Even though this class inherits fields and functions from others,
- -- an empty completions table needs to be added to it so
- -- get_completions() does not return prematurely.
- if not completions[tag_name] then
- completions[tag_name] = {fields = {}, functions = {}}
- end
- end
- end
- -- Update completions.
- -- Add the class to the global namespace.
- if not completions[''] then
- completions[''] = {fields = {}, functions = {}}
- end
- local t = completions[''].fields
- t[#t + 1] = tag_name..'?1'
- -- Update locations.
- if not no_locations then
- if not locations[k] then locations[k] = {} end
- locations[k][tag_name] = {file_name, ex_cmd}
- end
- else
- sense:handle_ctag(tag_name, file_name, ex_cmd, ext_fields)
- end
- end
- end
- for _, v in pairs(completions) do
- table.sort(v.functions)
- table.sort(v.fields)
- end
-end
-
----
--- Prompts the user to select a known symbol of kind *kind* to jump to.
--- If *kind* is `nil`, displays all known symbols. *title* is the filtered list
--- dialog prompt's title.
--- @param sense The Adeptsense returned by `adeptsense.new()`. If `nil`, uses
--- the current language's Adeptsense (if it exists).
--- @param kind Optional Ctag character kind (e.g. `'f'` for a Lua function).
--- @param title Optional title for the filtered list dialog.
--- @name goto_ctag
-function M.goto_ctag(sense, kind, title)
- sense = sense or (_M[buffer:get_lexer(true)] or {}).sense
- if not sense then return end
- -- Get the tags for the given kind or all kinds.
- local kinds, items = kind and {kind} or {}, {}
- if #kinds == 0 then
- for kind in pairs(sense.locations) do kinds[#kinds + 1] = kind end
- end
- local adeptsense_kind = sense.ctags_kinds[kind] or M.FUNCTION
- for i = 1, #kinds do
- for kind, v in pairs(sense.locations[kinds[i]] or {}) do
- items[#items + 1] = kind:match('[^#]+$') -- symbol name
- if adeptsense_kind == M.FUNCTION or adeptsense_kind == M.FIELD then
- items[#items + 1] = kind:match('^[^#]*') -- class name
- end
- items[#items + 1] = v[1]:iconv('UTF-8', _CHARSET)..':'..v[2]
- end
- end
- -- Prompt the user to select a tag to jump to.
- local columns = {_L['Name'], 'Location'}
- if adeptsense_kind == M.FUNCTION or adeptsense_kind == M.FIELD then
- table.insert(columns, 2, 'Class')
- end
- local button, i = ui.dialogs.filteredlist{
- title = title or _L['Go To'], columns = columns, items = items,
- width = CURSES and ui.size[1] - 2 or nil
- }
- if button ~= 1 or not i then return end
- -- Jump to the tag.
- local path, line = items[i * #columns]:match('^(%a?:?[^:]+):(.+)$')
- io.open_file(path:iconv(_CHARSET, 'UTF-8'))
- if not tonumber(line) then
- -- /^ ... $/
- buffer.target_start, buffer.target_end = 0, buffer.length
- if buffer:search_in_target(line:sub(3, -3)) >= 0 then
- buffer:goto_pos(buffer.target_start)
- end
- else
- textadept.editing.goto_line(tonumber(line))
- end
-end
-
----
--- Handles unrecognized Ctag kinds in `load_ctags()`.
--- The parameters are extracted from Ctags' [tag format][]. This method should
--- be replaced with your own that is specific to the language.
---
--- [tag format]: http://ctags.sourceforge.net/ctags.html#TAG%20FILE%20FORMAT
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @param tag_name The tag name.
--- @param file_name The name of the file the tag belongs to.
--- @param ex_cmd The `ex_cmd` returned by Ctags.
--- @param ext_fields The `ext_fields` returned by Ctags.
--- @name handle_ctag
-function M.handle_ctag(sense, tag_name, file_name, ex_cmd, ext_fields) end
-
----
--- Clears the Adeptsense for loading new Ctags or project files.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @name clear
-function M.clear(sense)
- sense.inherited_classes = {}
- sense.completions = {}
- sense.locations = {}
- sense:handle_clear()
- collectgarbage('collect')
-end
-
----
--- Helps clear the Adeptsense along with `clear()`.
--- This function should be replaced with your own if you have any persistant
--- objects that need to be deleted.
--- @param sense The Adeptsense returned by `adeptsense.new()`.
--- @name handle_clear
-function M.handle_clear(sense) end
-
----
--- Creates and returns a new Adeptsense for lexer name *lexer*.
--- Only one sense can exist per language.
--- @param lang The lexer language name to create an Adeptsense for.
--- @return adeptsense
--- @usage local lua_sense = textadept.adeptsense.new('lua')
--- @name new
-function M.new(lang)
- local sense = senses[lang]
- if sense then
- sense.ctags_kinds = nil
- sense.api_files = nil
- for _, f in ipairs(sense.events) do
- events.disconnect(events.CHAR_ADDED, f)
- end
- sense.events = nil
- sense:clear()
- end
-
- sense = setmetatable({
- lexer = lang,
- events = {},
- always_show_globals = true,
-
----
--- A map of Ctags kinds to Adeptsense types.
--- Recognized types are `FUNCTION`, `FIELD`, and `CLASS`. Classes are quite
--- simply containers for functions and fields so Lua modules would count as
--- classes. Any other kinds will be passed to `handle_ctag()` for user-defined
--- handling.
--- @usage luasense.ctags_kinds = {f = textadept.adeptsense.FUNCTION}
--- @usage csense.ctags_kinds = {m = textadept.adeptsense.FIELD,
--- f = textadept.adeptsense.FUNCTION, c = textadept.adeptsense.CLASS,
--- s = textadept.adeptsense.CLASS}
--- @usage javasense.ctags_kinds = {f = textadept.adeptsense.FIELD,
--- m = textadept.adeptsense.FUNCTION, c = textadept.adeptsense.CLASS,
--- i = textadept.adeptsense.CLASS}
--- @class table
--- @name ctags_kinds
--- @see handle_ctag
-ctags_kinds = {},
-
----
--- A map of classes and a list of their inherited classes, normally populated by
--- `load_ctags()`.
--- @class table
--- @name inherited_classes
-inherited_classes = {},
-
----
--- A list containing lists of possible completions for known symbols.
--- Each symbol key has a table value that contains a list of field completions
--- with a `fields` key and a list of functions completions with a `functions`
--- key. This table is normally populated by `load_ctags()`, but can also be set
--- by the user.
--- @class table
--- @name completions
-completions = {},
-
----
--- A list of the locations of known symbols, normally populated by
--- `load_ctags()`.
--- @class table
--- @name locations
-locations = {},
-
----
--- A list of api files used by `show_apidoc()`.
--- Each line in the api file contains a symbol name (not the full symbol)
--- followed by a space character and then the symbol's documentation. Since
--- there may be many duplicate symbol names, it is recommended to put the full
--- symbol and arguments, if any, on the first line. (e.g. `Class.function(arg1,
--- arg2, ...)`). This allows the correct documentation to be shown based on the
--- current context. In the documentation, newlines are represented with "\n". A
--- '\' before "\n" escapes the newline.
--- @class table
--- @name api_files
-api_files = {},
-
----
--- Map of language-specific syntax settings.
--- @field self The language's syntax-equivalent of "self". The default value is
--- `'self'`.
--- @field class_definition A Lua pattern representing the language's class
--- definition syntax. The first capture returned must be the class name. A
--- second, optional capture contains the class's superclass (if any). If no
--- completions are found for the class name, completions for the superclass
--- are shown (if any). Completions will not be shown for both a class and
--- superclass unless defined in a previously loaded Ctags file. Also, multiple
--- superclasses cannot be recognized by this pattern; use a Ctags file
--- instead. The default value is `'class%s+([%w_]+)'`.
--- @field word_chars A Lua pattern of characters allowed in a word.
--- The default value is `'%w_'`.
--- @field symbol_chars A Lua pattern of characters allowed in a symbol,
--- including member operators. The pattern should be a character set.
--- The default value 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.
--- Use `%_` to match the symbol.
--- The default value is `'(%u[%w_%.]+)%s+%_'`.
--- @field type_declarations_exclude A table of class types to exclude, even if
--- they match a `type_declarations` pattern. Each excluded type is a table key
--- and has a `true` boolean value. For example, `{Foo = true}` excludes any
--- class type whose name is `Foo`.
--- The default value is `{}`.
--- @field type_assignments A map of Lua patterns to class types for variable
--- assignments, typically used for dynamically typed languages. For example,
--- `sense.syntax.type_assignments['^"'] = 'string'` would recognize string
--- assignments in Lua so the `foo` in `foo = "bar"` would be recognized as
--- class type `string`. The class type value may contain `%n` pattern
--- captures.
--- @class table
--- @name syntax
--- @see get_class
-syntax = {
- self = 'self',
- class_definition = 'class%s+([%w_]+)',
- word_chars = '%w_',
- symbol_chars = '[%w_%.]',
- type_declarations = {'(%u[%w_%.]+)%s+%_'}, -- Foo bar
- type_declarations_exclude = {},
- type_assignments = {}
-},
-
- super = setmetatable({}, {__index = M})
- }, {__index = M})
-
- senses[lang] = sense
- return sense
-end
-
-return M
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 7e81ce20..dee32a1a 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -47,6 +47,36 @@ M.INDIC_BRACEMATCH = _SCINTILLA.next_indic_number()
M.INDIC_HIGHLIGHT = _SCINTILLA.next_indic_number()
---
+-- Map of image names to registered image numbers.
+-- @field CLASS The image number for classes.
+-- @field NAMESPACE The image number for namespaces.
+-- @field METHOD The image number for methods.
+-- @field SIGNAL The image number for signals.
+-- @field SLOT The image number for slots.
+-- @field VARIABLE The image number for variables.
+-- @field STRUCT The image number for structures.
+-- @field TYPEDEF The image number for type definitions.
+-- @class table
+-- @name XPM_IMAGES
+M.XPM_IMAGES = {
+ '/* XPM */static char *class[] = {/* columns rows colors chars-per-pixel */"16 16 10 1 "," c #000000",". c #001CD0","X c #008080","o c #0080E8","O c #00C0C0","+ c #24D0FC","@ c #00FFFF","# c #A4E8FC","$ c #C0FFFF","% c None",/* pixels */"%%%%% %%%%%%%%%","%%%% ## %%%%%%%","%%% ###++ %%%%%%","%% +++++. %%%%","%% oo++.. $$ %%","%% ooo.. $$$@@ %","%% ooo. @@@@@X %","%%% . OO@@XX %","%%% ## OOOXXX %","%% ###++ OOXX %%","% +++++. OX %%%","% oo++.. % %%%%","% ooo... %%%%%%%","% ooo.. %%%%%%%%","%% o. %%%%%%%%%","%%%% %%%%%%%%%%"};',
+ '/* XPM */static char *namespace[] = {/* columns rows colors chars-per-pixel */"16 16 7 1 "," c #000000",". c #1D1D1D","X c #393939","o c #555555","O c #A8A8A8","+ c #AAAAAA","@ c None",/* pixels */"@@@@@@@@@@@@@@@@","@@@@+@@@@@@@@@@@","@@@.o@@@@@@@@@@@","@@@ +@@@@@@@@@@@","@@@ +@@@@@@@@@@@","@@+.@@@@@@@+@@@@","@@+ @@@@@@@o.@@@","@@@ +@@@@@@+ @@@","@@@ +@@@@@@+ @@@","@@@.X@@@@@@@.+@@","@@@@+@@@@@@@ @@@","@@@@@@@@@@@+ @@@","@@@@@@@@@@@+ @@@","@@@@@@@@@@@X.@@@","@@@@@@@@@@@+@@@@","@@@@@@@@@@@@@@@@"};',
+ '/* XPM */static char *method[] = {/* columns rows colors chars-per-pixel */"16 16 5 1 "," c #000000",". c #E0BC38","X c #F0DC5C","o c #FCFC80","O c None",/* pixels */"OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOO OOOO","OOOOOOOOO oo OO","OOOOOOOO ooooo O","OOOOOOO ooooo. O","OOOO O XXoo.. O","OOO oo XXX... O","OO ooooo XX.. OO","O ooooo. X. OOO","O XXoo.. O OOOO","O XXX... OOOOOOO","O XXX.. OOOOOOOO","OO X. OOOOOOOOO","OOOO OOOOOOOOOO"};',
+ '/* XPM */static char *signal[] = {/* columns rows colors chars-per-pixel */"16 16 6 1 "," c #000000",". c #FF0000","X c #E0BC38","o c #F0DC5C","O c #FCFC80","+ c None",/* pixels */"++++++++++++++++","++++++++++++++++","++++++++++++++++","++++++++++ ++++","+++++++++ OO ++","++++++++ OOOOO +","+++++++ OOOOOX +","++++ + ooOOXX +","+++ OO oooXXX +","++ OOOOO ooXX ++","+ OOOOOX oX +++","+ ooOOXX + ++++","+ oooXXX +++++++","+ oooXX +++++..+","++ oX ++++++..+","++++ ++++++++++"};',
+ '/* XPM */static char *slot[] = {/* columns rows colors chars-per-pixel */"16 16 5 1 "," c #000000",". c #E0BC38","X c #F0DC5C","o c #FCFC80","O c None",/* pixels */"OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOO OOOO","OOOOOOOOO oo OO","OOOOOOOO ooooo O","OOOOOOO ooooo. O","OOOO O XXoo.. O","OOO oo XXX... O","OO ooooo XX.. OO","O ooooo. X. OOO","O XXoo.. O OOOO","O XXX... OOOOOOO","O XXX.. OOOOO ","OO X. OOOOOO O ","OOOO OOOOOOO "};',
+ '/* XPM */static char *variable[] = {/* columns rows colors chars-per-pixel */"16 16 5 1 "," c #000000",". c #8C748C","X c #9C94A4","o c #ACB4C0","O c None",/* pixels */"OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOOOOOOOOO","OOOOOOOOO OOOOO","OOOOOOOO oo OOO","OOOOOOO ooooo OO","OOOOOO ooooo. OO","OOOOOO XXoo.. OO","OOOOOO XXX... OO","OOOOOO XXX.. OOO","OOOOOOO X. OOOO","OOOOOOOOO OOOOO","OOOOOOOOOOOOOOOO"};',
+ '/* XPM */static char *struct[] = {/* columns rows colors chars-per-pixel */"16 16 14 1 "," c #000000",". c #008000","X c #00C000","o c #00FF00","O c #808000","+ c #C0C000","@ c #FFFF00","# c #008080","$ c #00C0C0","% c #00FFFF","& c #C0FFC0","* c #FFFFC0","= c #C0FFFF","- c None",/* pixels */"----- ---------","---- && -------","--- &&&oo ------","-- ooooo. ----","-- XXoo.. == --","-- XXX.. ===%% -","-- XXX. %%%%%# -","--- . $$%%## -","--- ** $$$### -","-- ***@@ $$## --","- @@@@@O $# ---","- ++@@OO - ----","- +++OOO -------","- +++OO --------","-- +O ---------","---- ----------"};',
+ '/* XPM */static char *typedef[] = {/* columns rows colors chars-per-pixel */"16 16 10 1 "," c #000000",". c #404040","X c #6D6D6D","o c #777777","O c #949494","+ c #ACACAC","@ c #BBBBBB","# c #DBDBDB","$ c #EEEEEE","% c None",/* pixels */"%%%%% %%%%%%%%%","%%%% ## %%%%%%%","%%% ###++ %%%%%%","%% +++++. %%%%","%% oo++.. $$ %%","%% ooo.. $$$@@ %","%% ooo. @@@@@X %","%%% . OO@@XX %","%%% ## OOOXXX %","%% ###++ OOXX %%","% +++++. OX %%%","% oo++.. % %%%%","% ooo... %%%%%%%","% ooo.. %%%%%%%%","%% o. %%%%%%%%%","%%%% %%%%%%%%%%"};',
+ CLASS = 1, NAMESPACE = 2, METHOD = 3, SIGNAL = 4, SLOT = 5, VARIABLE = 6,
+ STRUCT = 7, TYPEDEF = 8
+}
+events.connect(events.VIEW_NEW, function()
+ for name, i in pairs(M.XPM_IMAGES) do
+ if type(name) == 'string' then buffer:register_image(i, M.XPM_IMAGES[i]) end
+ end
+end)
+
+---
-- Map of lexer names to line comment strings for programming languages, used by
-- the `block_comment()` function.
-- Keys are lexer names and values are either the language's line comment
@@ -93,15 +123,27 @@ M.typeover_chars = {[41] = 1, [93] = 1, [125] = 1, [39] = 1, [34] = 1}
---
-- Map of autocompleter names to autocompletion functions.
+-- Names are typically lexer names and autocompletion functions typically
+-- autocomplete symbols.
-- Autocompletion functions must return two values: the number of characters
-- behind the caret that are used as the prefix of the entity to autocomplete,
--- and a list of completions to show. Autocompletion lists are automatically
--- sorted.
+-- and a list of completions to show. Autocompletion lists are sorted
+-- automatically.
-- @class table
-- @name autocompleters
-- @see autocomplete
M.autocompleters = {}
+---
+-- Map of lexer names to API documentation file tables.
+-- Each line in an API file consists of the name of a symbol (not the full
+-- symbol), a space character, and that symbol's documentation. '\n' represents
+-- a newline character.
+-- @class table
+-- @name api_files
+-- @see show_documentation
+M.api_files = {}
+
-- Matches characters specified in char_matches.
events.connect(events.CHAR_ADDED, function(c)
if not M.AUTOPAIR then return end
@@ -547,4 +589,54 @@ M.autocompleters.word = function()
return #word, list
end
+local api_docs
+---
+-- Displays a call tip with documentation for the symbol under or directly
+-- behind the caret.
+-- If a call tip is already shown, cycles to the next one if it exists.
+-- Documentation is stored in API files in the `api_files` table.
+-- Symbols are determined by using `buffer.word_chars`.
+-- @name show_documentation
+-- @see api_files
+-- @see buffer.word_chars
+function M.show_documentation()
+ if buffer:call_tip_active() then events.emit(events.CALL_TIP_CLICK) return end
+ local lang = buffer:get_lexer(true)
+ if not M.api_files[lang] then return end
+ local s = buffer:word_start_position(buffer.current_pos, true)
+ local e = buffer:word_end_position(buffer.current_pos, true)
+ local symbol = buffer:text_range(s, e)
+ if symbol == '' then return nil end
+ api_docs = {}
+ local symbol_patt = '^'..symbol:gsub('(%p)', '%%%1')
+ for i = 1, #M.api_files[lang] do
+ if lfs.attributes(M.api_files[lang][i]) then
+ for line in io.lines(M.api_files[lang][i]) do
+ if line:find(symbol_patt) then
+ api_docs[#api_docs + 1] = line:match(symbol_patt..'%s+(.+)$')
+ end
+ end
+ end
+ end
+ if #api_docs == 0 then return end
+ for i = 1, #api_docs do
+ local doc = api_docs[i]:gsub('%f[\\]\\n', '\n'):gsub('\\\\', '\\')
+ if #api_docs > 1 then
+ if not doc:find('\n') then doc = doc..'\n' end
+ doc = '\001'..doc:gsub('\n', '\n\002', 1)
+ end
+ api_docs[i] = doc
+ end
+ if not api_docs.pos then api_docs.pos = 1 end
+ buffer:call_tip_show(buffer.current_pos, api_docs[api_docs.pos])
+end
+-- Cycle through apidoc calltips.
+events.connect(events.CALL_TIP_CLICK, function(position)
+ if not api_docs then return end
+ api_docs.pos = api_docs.pos + (position == 1 and -1 or 1)
+ if api_docs.pos > #api_docs then api_docs.pos = 1 end
+ if api_docs.pos < 1 then api_docs.pos = #api_docs end
+ buffer:call_tip_show(buffer.current_pos, api_docs[api_docs.pos])
+end)
+
return M
diff --git a/modules/textadept/init.lua b/modules/textadept/init.lua
index b0d9643a..795768b6 100644
--- a/modules/textadept/init.lua
+++ b/modules/textadept/init.lua
@@ -9,7 +9,6 @@ textadept = M
-- It provides utilities for editing text in Textadept.
module('textadept')]]
-M.adeptsense = require('textadept.adeptsense')
M.bookmarks = require('textadept.bookmarks')
require('textadept.command_entry')
M.editing = require('textadept.editing')
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 781d8860..c7689605 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -226,6 +226,9 @@ M.utils = {
textadept.editing.select_word()
buffer:delete_back()
end,
+ autocomplete_symbol = function()
+ textadept.editing.autocomplete(buffer:get_lexer(true))
+ end,
enclose_as_xml_tags = function()
textadept.editing.enclose('<', '>')
local pos = buffer.current_pos
@@ -472,11 +475,6 @@ keys[not OSX and (not CURSES and 'cae' or 'mx')
or 'cme'] = {textadept.run.goto_error, false, true}
keys[not OSX and (not CURSES and 'caE' or 'mX')
or 'cmE'] = {textadept.run.goto_error, false, false}
--- Adeptsense.
-keys[not OSX and ((not CURSES or WIN32) and 'c ' or 'c@')
- or 'aesc'] = textadept.adeptsense.complete
-keys[not CURSES and 'ch' or 'mh'] = textadept.adeptsense.show_apidoc
-if CURSES then keys.mH = keys.mh end -- in case mh is used by GUI terminals
-- Snippets.
keys[not OSX and (not CURSES and 'ck' or 'mk')
or 'a\t'] = textadept.snippets._select
@@ -498,6 +496,11 @@ keys[not OSX and 'cu' or 'mu'] = {io.snapopen, _USERHOME}
keys[not OSX and (not CURSES and 'caO' or 'mO')
or 'cmO'] = utils.snapopen_filedir
keys[not OSX and (not CURSES and 'caP' or 'cmp') or 'cmP'] = io.snapopen
+-- Other.
+keys[not OSX and ((not CURSES or WIN32) and 'c ' or 'c@')
+ or 'aesc'] = utils.autocomplete_symbol
+keys[not CURSES and 'ch' or 'mh'] = textadept.editing.show_documentation
+if CURSES then keys.mH = keys.mh end -- in case mh is used by GUI terminals
if not CURSES then keys[not OSX and 'ci' or 'mi'] = utils.show_style end
-- Buffer.
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 6dc3bc1b..4aac1eff 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -108,10 +108,6 @@ local menubar = {
{_L['_Next Error'], {textadept.run.goto_error, false, true}},
{_L['_Previous Error'], {textadept.run.goto_error, false, false}},
SEPARATOR,
- { title = _L['_Adeptsense'],
- {_L['_Complete Symbol'], textadept.adeptsense.complete},
- {_L['Show _Documentation'], textadept.adeptsense.show_apidoc},
- },
{ title = _L['_Bookmark'],
{_L['_Toggle Bookmark'], textadept.bookmarks.toggle},
{_L['_Clear Bookmarks'], textadept.bookmarks.clear},
@@ -132,6 +128,8 @@ local menubar = {
{_L['_Cancel Snippet'], textadept.snippets._cancel_current},
},
SEPARATOR,
+ {_L['_Complete Symbol'], utils.autocomplete_symbol},
+ {_L['Show _Documentation'], textadept.editing.show_documentation},
{_L['Show St_yle'], utils.show_style},
},
{ title = _L['_Buffer'],