Re: [code] Multiline error patterns

From: Mitchell <m.att.foicica.com>
Date: Wed, 23 Apr 2014 09:27:11 -0400 (Eastern Daylight Time)

Hi Carlos,

On Tue, 22 Apr 2014, Carlos Pita wrote:

>> Both, actually. When you double-click an error message, Textadept only
>> parses the clicked line for an error message. While this makes things
>> simple, it's still a limitation.
>
> Ok, I guess I find the decision sensible but, just out of curiosity,
> would a generalization to multiline patterns make anything more
> complex besides the multiline patterns themselves?

It's just a matter of how far to look ahead in the buffer to match a
multi-line pattern against. However, then Textadept would sometimes need
two patterns. First, some background: Textadept parses process stdout line
by line, matching error patterns against those lines; any recognized
errors are marked. The double-clicking on errors utilizes the same
matching technique to obtain line numbers and error messages. Now, going
back to Textadept needing two patterns: the editor still needs the
patterns that match incoming stdout (which must be line-based for
technical reasons), but then it may need another set to match multi-line
errors. This introduces another level of complexity and potential for
false positives (e.g. including the first few lines of a big stack trace
as an error message, or skipping the last couple lines of a long text
message). In short, I don't think there is an elegant and effective way of
supporting your generalization without caveats.

Now, if you wanted to specifically target Python, you could connect to the
`events.DOUBLE_CLICK` event (either from a Python `post_init.lua` or your
`init.lua`) and attempt to match a multi-line error message. The end of
`modules/textadept/run.lua` contains some code that may be of help. Don't
forget to connect with index 1 and return `true` on a successful handling.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 23 Apr 2014 - 09:27:11 EDT

This archive was generated by hypermail 2.2.0 : Thu 24 Apr 2014 - 06:26:05 EDT