Modify

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#13067 closed defect (fixed)

Don't autocomplete if phrase starts with backtick

Reported by: Ryan J Ollos Owned by: Peter Suter
Priority: normal Component: WikiAutoCompletePlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

In #12118 I was typing:

Please post your [ticket-workflow] section.

After typing `[ the auto-complete appears, but probably shouldn't for this case.

Attachments (2)

Screen Shot 2017-02-11 at 22.54.51.png (17.0 KB) - added by Ryan J Ollos 3 years ago.
T13067_context_remove_quoted.diff (4.6 KB) - added by Peter Suter 3 years ago.

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by Ryan J Ollos

comment:1 Changed 3 years ago by Peter Suter

I think we could prevent auto-completions after `[ like this:

  • wikiautocomplete/htdocs/js/wikiautocomplete.js

    diff -r 02cfbe496117 wikiautocomplete/htdocs/js/wikiautocomplete.js
    a b  
    144144        },
    145145
    146146        { // TracLinks, InterTrac and InterWiki
    147             match: /(^|[^[])\[(\w*)$/,
     147            match: /(^|[^[`])\[(\w*)$/,
    148148            search: search_cache('linkresolvers', function(resolver, term) {
    149149                return match_string(resolver.name, term);
    150150            }),

Would you also prevent other cases like `wiki:? Or not prevent auto-completions after closing backquote like `quoted`[? I don't see an obvious need.

I think ideally we would also prevent auto-completions inside {{{ / }}}, but it's not obvious to me how to best achieve this.

comment:2 in reply to:  1 Changed 3 years ago by Ryan J Ollos

Replying to psuter:

Would you also prevent other cases like `wiki:?

Yeah, looks good.

Or not prevent auto-completions after closing backquote like `quoted`[? I don't see an obvious need.

I agree that it's probably not needed.

comment:3 Changed 3 years ago by Ryan J Ollos

Also, not sure if this is practical, but it would be nice to avoid auto-completing with local resources when typing an InterTrac prefix, e.g. trac:#, t:wiki:.

Changed 3 years ago by Peter Suter

comment:4 Changed 3 years ago by Peter Suter

A better approach might be to use a context function that removes `quoted` strings and {{{ ... }}} blocks before attempting to match.

Only the {{{#!... preprocessor completions should not use that. Unfortunately there seems to be a bug in jquery-textcomplete, but it might be possible to workaround it by handling the preprocessors first.

comment:5 Changed 2 years ago by Peter Suter

In 16270:

WikiAutoCompletePlugin: Don't autocomplete in quoted parts.

Don't use context function for "Processors" strategy.
Move "Processors" strategy up first, to avoid bug in jquery-textcomplete.
https://github.com/yuku-t/jquery-textcomplete/issues/301

(see #13067)

comment:6 Changed 2 years ago by Peter Suter

Resolution: fixed
Status: newclosed

comment:7 Changed 2 years ago by Ryan J Ollos

Thanks, I've updated plugin on trac-hacks.org.

comment:8 in reply to:  3 ; Changed 2 years ago by Ryan J Ollos

Replying to Ryan J Ollos:

Also, not sure if this is practical, but it would be nice to avoid auto-completing with local resources when typing an InterTrac prefix, e.g. trac:#, t:wiki:.

Do you have any thoughts about this one? Should I create a different ticket?

comment:9 in reply to:  8 Changed 2 years ago by Peter Suter

Also, not sure if this is practical, but it would be nice to avoid auto-completing with local resources when typing an InterTrac prefix, e.g. trac:#, t:wiki:.

Do you have any thoughts about this one? Should I create a different ticket?

Thanks for reminding me. I now created #13090.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.