diff options
author | 2017-02-12 17:55:07 -0500 | |
---|---|---|
committer | 2017-02-12 17:55:07 -0500 | |
commit | 36781b31377cb5f8841c7757b70656801e9808bf (patch) | |
tree | 093cc82565e226ca61ef22160a3bd44e507a3751 /modules | |
parent | c15408bbab88f63d187b2ff7166d21c229179f82 (diff) | |
download | textadept-36781b31377cb5f8841c7757b70656801e9808bf.tar.gz textadept-36781b31377cb5f8841c7757b70656801e9808bf.zip |
Print lexer initialization errors like normal errors.
Otherwise, stderr needs to be inspected.
Requires Scintillua r584 (changeset fa39221dd5ad).
Diffstat (limited to 'modules')
-rw-r--r-- | modules/textadept/file_types.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/textadept/file_types.lua b/modules/textadept/file_types.lua index ad1f7d97..bc270da9 100644 --- a/modules/textadept/file_types.lua +++ b/modules/textadept/file_types.lua @@ -62,11 +62,18 @@ end local SETDIRECTPOINTER = _SCINTILLA.properties.doc_pointer[2] local SETLEXERLANGUAGE = _SCINTILLA.properties.lexer_language[2] +local GETERROR = _SCINTILLA.properties.status[1] -- LuaDoc is in core/.buffer.luadoc. local function set_lexer(buffer, lang) if not lang then lang = detect_language(buffer) end buffer:private_lexer_call(SETDIRECTPOINTER, buffer.direct_pointer) buffer:private_lexer_call(SETLEXERLANGUAGE, lang) + local errmsg = buffer:private_lexer_call(GETERROR) + if #errmsg > 0 then + buffer:private_lexer_call(SETLEXERLANGUAGE, 'text') + ui.print(errmsg) + return -- do not error() since the stack trace implicates this function + end buffer._lexer = lang if package.searchpath(lang, package.path) then _M[lang] = require(lang) end if buffer ~= ui.command_entry then events.emit(events.LEXER_LOADED, lang) end |