Textadept
- Home |
- Download |
- Lua API |
- Source |
- Language Modules |
- Stats |
- Wiki |
- Mailing List
Contents
_M.textadept.run
Compile and run/execute source files with Textadept.
Typically, language-specific modules populate the compile_command
,
run_command
, and error_detail
tables for a particular language’s file
extension.
Fields
_G.events.COMPILE_OUTPUT
(string)
Called after executing a language’s compile command.
By default, compiler output is printed to the message buffer. To override
this behavior, connect to the event with an index of 1
and return true
.
Arguments:
lexer
: The lexer language name.output
: The string output from the command.
_G.events.RUN_OUTPUT
(string)
Called after executing a language’s run command.
By default, output is printed to the message buffer. To override this
behavior, connect to the event with an index of 1
and return true
.
Arguments:
lexer
: The lexer language name.output
: The string output from the command.
cwd
(string, Read-only)
The working directory for the most recently executed compile or run command.
Functions
compile
()
Compiles the file based on its extension using the command from the
compile_command
table.
Emits a COMPILE_OUTPUT
event.
See also:
goto_error
(pos, line_num)
Goes to line number line_num in the file an error occurred at based on the error message at position pos in the buffer and displays an annotation with the error message. This is typically called by an event handler for when the user double-clicks on an error message.
Parameters:
pos
: The position of the caret in the buffer.line_num
: The line number the caret is on with the error message.
See also:
run
()
Runs/executes the file based on its extension using the command from the
run_command
table.
Emits a RUN_OUTPUT
event.
See also:
Tables
compile_command
Map of file extensions (excluding the leading ‘.’) to their associated “compile” shell command line strings or functions returning such strings. Command line strings may have the following macros:
%(filepath)
: The full path of the current file.%(filedir)
: The current file’s directory path.%(filename)
: The name of the file, including its extension.%(filename_noext)
: The name of the file, excluding its extension.
This table is typically populated by language-specific modules.
error_detail
Map of lexer names to their error string details, tables containing the following fields:
pattern
: A Lua pattern that matches the language’s error string, capturing the filename the error occurs in, the line number the error occurred on, and optionally the error message.filename
: The numeric index of the Lua capture containing the filename the error occurred in.line
: The numeric index of the Lua capture containing the line number the error occurred on.message
: (Optional) The numeric index of the Lua capture containing the error’s message. An annotation will be displayed if a message was captured.
When an error message is double-clicked, the user is taken to the point of error. This table is usually populated by language-specific modules.
run_command
Map of file extensions (excluding the leading ‘.’) to their associated “run” shell command line strings or functions returning such strings. Command line strings may have the following macros:
%(filepath)
: The full path of the current file.%(filedir)
: The current file’s directory path.%(filename)
: The name of the file, including its extension.%(filename_noext)
: The name of the file, excluding its extension.
This table is typically populated by language-specific modules.