Loading ...
Sorry, an error occurred while loading the content.

html completion

Expand Messages
  • ice_2001cn
    I want to call HTML completion on my own plugin. I use the following code : let l:st1 = htmlcomplete#CompleteTags(1, ) if ( l:st1 = 0 ) let l:str1 =
    Message 1 of 2 , Apr 2, 2006
    • 0 Attachment
      I want to call HTML completion on my own plugin.

      I use the following code :


      let l:st1 = htmlcomplete#CompleteTags(1,'')
      if ( l:st1>= 0 )
      let l:str1 = getline('.')
      let l:str2 = strpart(l:str1,l:st1,col('.')-l:st1)
      return htmlcomplete#CompleteTags(0,l:str2)
      else
      return ""
      endif

      When I use a <c-x><c-u> to invoke this call .

      I receive a E745 message.

      Can anyone help me ?
    • Mikolaj Machowski
      ... I can only guess. Lets see that whole construction is something like:: function! CC(a,b) let l:st1 = htmlcomplete#CompleteTags(1, ) if ( l:st1 = 0 ) let
      Message 2 of 2 , Apr 3, 2006
      • 0 Attachment
        Dnia poniedziaƂek, 3 kwietnia 2006 08:13, ice_2001cn napisaƂ:
        > I want to call HTML completion on my own plugin.
        >
        > I use the following code :
        >
        >
        > let l:st1 = htmlcomplete#CompleteTags(1,'')
        > if ( l:st1>= 0 )
        > let l:str1 = getline('.')
        > let l:str2 = strpart(l:str1,l:st1,col('.')-l:st1)
        > return htmlcomplete#CompleteTags(0,l:str2)
        > else
        > return ""
        > endif
        >
        > When I use a <c-x><c-u> to invoke this call .
        >
        > I receive a E745 message.
        >
        > Can anyone help me ?

        I can only guess. Lets see that whole construction is something like::

        function! CC(a,b)
        let l:st1 = htmlcomplete#CompleteTags(1,'')
        if ( l:st1>= 0 )
        let l:str1 = getline('.')
        let l:str2 = strpart(l:str1,l:st1,col('.')-l:st1)
        return htmlcomplete#CompleteTags(0,l:str2)
        else
        return ""
        endif
        endfunction

        But in omnicompletion completion function (here CC) is called *twice*.
        You are returning List (as for menu) for *first* time. To make this one
        problem remove you have to write something like that::

        function! CC(a,b)
        if a:a == 1
        let l:st1 = htmlcomplete#CompleteTags(1,'')
        if ( l:st1>= 0 )
        let l:str1 = getline('.')
        let l:str2 = strpart(l:str1,l:st1,col('.')-l:st1)
        let b:menu = htmlcomplete#CompleteTags(0,l:str2)
        else
        return 0
        endif
        else
        if exists("b:menu")
        return b:menu
        else
        return []
        endif
        endif
        endfunction

        But this is only beginning, you will have problems with a:base...

        m.
      Your message has been successfully submitted and would be delivered to recipients shortly.