1. Takeshi NISHIDA
  2. vim-autocomplpop
  3. Issues
Issue #37 new

Undefined variable: classlines, E15: Invalid expression: classlines

stardiviner
created an issue

I use AutoComplPop in a HTML file, complete belowing: <p class="c

Error detected while processing function htmlcomplete#CompleteTags: line 304: E121: Undefined variable: classlines Press ENTER or type command to continue Error detected while processing function htmlcomplete#CompleteTags: line 304: E15: Invalid expression: classlines Press ENTER or type command to continue

Comments (4)

  1. Ryan Westphal

    You can fix this issue by inserting the following above line 288 of autoload/htmlcomplete.vim:

    let classlines = []
    

    The for loop will now look like this:

    for file in cssfiles
     let classlines = []
     if filereadable(file)
      let stylesheet = readfile(file)
      let stylefile = join(stylesheet, ' ')
      let stylefile = substitute(stylefile, '+>\*[,', ' ', 'g')
      if search_for == 'class'
       let stylesheet = split(stylefile)
       let classlines = filter(copy(stylesheet), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
      else
       let stylesheet = split(stylefile, '[{}]')
       " Get all lines which fit id syntax
       let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
       " Filter out possible color definitions
       call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
       " Filter out complex border definitions
       call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
       let templines = join(classlines, ' ')
       let stylelines = split(templines)
       let classlines = filter(stylelines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
    
      endif
     endif
     " We gathered classes definitions from all external files
     let classes += classlines
    endfor
    
  2. Ivan Alejandro

    Thanks a lot! That line solves it. In my system (Linux Mint 12) the file is in: /usr/share/vim/vim73/autoload/htmlcomplete.vim

    The steps to reproduce my bug are this...

    I'm working with bootstrap editing html (set filetype=html) in a *.php file (CodeIgniter)

    Editing this code:

    <div class="btn-group">                                                                                                              
      <button class="btn">Edit</button>
      <button class="btn">Delete</button>
    </div>
    

    When I try to put id="toolbar" after the class="btn-group" gives me a lot of errors. But if I write id='toolbar' no errors appear.

    Should I report this to vim's developers? Where i do so?

    Cheers

  3. Log in to comment