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
MARK_ERROR_BACK
(number)
The background color, in “0xBBGGRR” format, used for a line containing a recognized run or compile error.
_G.events.COMPILE_OUTPUT
(string)
Emitted 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)
Emitted 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. It is used for going to error messages with relative file paths.
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
(line, next)
Goes to the source of the recognized compile/run error on line number line in the message buffer or the next or previous recognized error depending on boolean next. Displays an annotation with the error message, if available.
Parameters:
line
: The line number in the message buffer that contains the compile/run error to go to.next
: Optional flag indicating whether to go to the next recognized error or the previous one. Only applicable when line isnil
orfalse
.
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.