On Thu, Oct 19, 2017 at 2:02 AM, vitalije <[email protected]> wrote:
> > > On Friday, October 13, 2017 at 8:53:10 PM UTC+2, Terry Brown wrote: >> >> Hmm, some unforeseen challenges. >> >> I have slightly change algorithm for detecting headline in extractDef > method. Now it checks the first line of selection and only if there is no > match, checks the whole selection. As you have witnessed, in some languages > like javascript and coffeescript there are often nested function > definitions and it makes difficult to find the right headline. My solution > is far from being complete, but I believe it reduces number of false > positives. > > As I write this, I think the proper solution would be to find all matches > and then to choose one with the lowest indentation. Presumably, it would be > the most common thing to do, something that most users would expect, I > imagine. Am I wrong in this assumption? > Hmm. I am uneasy with complex solutions to this problem. They could easily lead to confusion and unintended behavior. The simplest thing that could possibly work would be to pick the first identifier of the first line of the selection as the headline of the new node, assuming no regex matched. This could be done by adding one last default regex to extractDef, to be matched after all extractDef_patterns patterns and all user patterns. Finally, the user can always changed the newly-created node by hand, using all of her natural pattern-matching abilities ;-) What do you think? Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
