Plugin EdComplete: Complete fragment with parts of full text

This is command plugin for SynWrite editor. It gives five commands:

This is lexer-independant.

Fragment for completion is selected expression (limited types) or a word before caret.

Commands details

Commands "next"/"prev"

If fragment is a word, then these commands suggest to complete this fragment to longer word. (Examples below show "|" char for caret position and underline for selected text.)

Initial text:	str11 st| str22
1st next:	str11 str11| str22
2nd next:	str11 str22| str22

If the selected fragment is like "fun(" or "smth[", then these commands suggest to complete to end of expression.

Initial text:	fun(11) fun(| fun(22,'')
1st next:	fun(11) fun(11)| fun(22,'')   
2nd next:	fun(22) fun(22,'')| fun(22,'')

Command "wider"

This command tries to find complex variants for completion.
wider suggests only first of found variants. Others are suggested by commands next / prev / view.

Initial text:	fun(0) fun| fun(0,'')
call wider:	fun(0) fun(0)| fun(0,'') fun()
1st next:	fun(0) fun(0,'')| fun(0,'') fun()
2nd next:	fun(0) fun()| fun(0,'') fun()

Command "view"

view shows full list or subset of variants which are found with commands next/prev or wider.
If variants are not found yet then it uses default command next.

There are two methods for view the list - in popup menu or in dialog menu. Default method is popup and it can be changed with command config.

Popup method. If too much variants then it shows four series: some at top, some around last shown, some around caret, some at bottom.
Size of series (block) by default is 3 and may be changed with command config.

Start text:	s1 s22 s333 s44 s555 s| s66 s7777
1st next:	s1 s22 s333 s44 s555 s1| s66 s7777
2nd next:	s1 s22 s333 s44 s555 s22| s66 s7777
3rd next:	s1 s22 s333 s44 s555 s333| s66 s7777
call view:	  1. s1      (at top, block=1)
		  --------
		√ 3. s333    (around the last, block=1, "√" points to last used variant)
		  --------
		  5. s555    (around caret, block=1)
		  --------
		  7. s7777   (at bottom, block=1)

Dialog method. It shows all found variants.

Command "config"

config shows popup menu to change some plugin constants.

• Normal order of variants: top down
  Inverted order for upper variants and normal for lower ones
  Inverted order for upper variants and skip lower ones
  -----------------
√ Wrap suggestions
  Show line numbers
  Word-chars are common [a-zA-Z0-9_] and extra [.]. Change extra...
  Menu block size is 4x3. Change...
  -----------------
• Variants as popup menu
  Variants as dialog 
  Variants as popup if a few, otherwize as dialog

How to install

Just open zip-file with plugin in SynWrite, and confirm installation.
You may change plugin hotkeys in "SynPlugins.ini", using SynWrite command "Options - Advanced - Edit file SynPlugins.ini".

Example:

EdCompleteNext=py:syn_ed_complete;next;;Alt+0;
EdCompletePrev=py:syn_ed_complete;prev;;Alt+9;
EdCompleteWider=py:syn_ed_complete;wider;;Shift+Alt+0;
EdCompleteView=py:syn_ed_complete;view;;Shift+Alt+9;
EdCompleteConfig=py:syn_ed_complete;config;;;

About

Author: kvichans (SynWrite forum)

License: MIT.