ZyX_I avatar ZyX_I committed 4fbb9c3

@/fwc: Partial {optional} section completion implementation

Comments (0)

Files changed (4)


                 \'split(v:val[9:-2], "(")'),
                 \'[v:val[0]]+split(v:val[1], ", ")')
-" TODO get internal functions (from help?)
 function s:F.getinternalfunctions()
     if exists('s:vimintfuncs')
         return copy(s:vimintfuncs)


 "   {lvars} :: nextsub, addedsavemsgs
 function s:r.optional.compile(adescr, idx, caidxstr, largsstr, purgemax,
             \                 nextsub, addedsavemsgs)
-    " let hasnext=s:F.hasnext(a:adescr, 'next')
     let addedsavemsgs=a:addedsavemsgs
+    if self.type is 'complete'
+        let hasnext=s:F.hasnext(a:adescr, 'next')
+        if !hasnext && len(a:adescr.optional)==1
+            call self.compadescr(a:adescr.optional[0], a:idx.'.0(optional)')
+            return [[a:caidxstr], addedsavemsgs]
+        else
+            " TODO
+        endif
+    endif
     " XXX nodefs will be still 1 when compiling next adescr. It is intentional.
     let nodefs=empty(self.defvals)
     let lopt=len(a:adescr.optional)


 ::: Section <Built-in completion functions/first>
 ::: Section <Built-in completion functions/if>
 ::: Section <Different sections/{required}>
+::: Section <Different sections/{optional}>
 ::: Section <Different sections/{actions}>
 <<< messages


+#▶2 {optional}
+`[in list in list2 [key dict]]
+  @+
+  =s:list
+  @-+
+  =s:list2
+  @- -+
+  =sort(keys(s:dict))
 #▶2 {actions}
 `<abc in list
 + dbf in list2
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.