Shougo / neocomplete.vim

Next generation completion framework after neocomplcache
2.74k stars 203 forks source link

Sass variable ctags that begin with dollar signs aren't included in completion popups #609

Closed jsit closed 5 years ago

jsit commented 5 years ago

Problems summary

If your tags file has some Sass variable tags that start with a dollar sign, those tags won't show up in neocomplete's autocompletion.

Expected

That Sass variable tags starting with dollar signs will show up in neocomplete's autocompletion.

Environment Information

Provide a minimal .vimrc with less than 50 lines (Required!)

" Your minimal .vimrc
let g:neocomplete#enable_at_startup = 1

The reproduce ways from Vim starting (Required!)

  1. Set up a tags file with this:
    $margins-vertical   vars.scss   /^$margins-vertical: 10px;$/;"  v
    1. Open a new file and set ft=scss.
    2. Insert $marg and see that $margins-vertical doesn't appear in the autocomplete popup.

A lot of .ctags config files on GitHub exclude the dollar sign from the matching string in Sass variables. You'll find a lot of lines like this:

--regex-scss=/^[ \t]*\$([A-Za-z0-9_-]+)/\1/v,variable,variables/

Note that the initial dollar sign is outside of the parentheses, which means it would not be included in the string in the tags file; you'd get something like this:

margins-vertical    vars.scss   /^$margins-vertical: 10px;$/;"  v

This configuration works fine with neocomplete, because neocomplete will work for this tags file, but wouldn't work if the dollar sign were present.

However, this has the undesirable side-effect that variable names will be suggested to the user even if the user isn't entering a variable name.

If the user is just trying to write the margin CSS property, for instance, they will be recommended margins-vertical, even though it never makes sense to type that string without the dollar sign.

As such, "fixing" this problem by adding a dollar sign to the scss keyword patterns dictionary will mean that a lot of people's existing .ctags configs will no longer complete variable names with neocomplete, but a small change to their config will mean that their tags files will in fact work much better with neocomplete moving forward.

Shougo commented 5 years ago

It depends on g:neocomplete#keyword_patterns. You should set it properly.

Shougo commented 5 years ago

This is feature of neocomplete.vim. I don't change the behavior.

Note: deoplete does not have the problem. I recommend for you to use deoplete.

Shougo commented 5 years ago

Note: Active development on neocomplete.vim has stopped. The only future changes will be bug fixes.

It is not bug.

jsit commented 5 years ago

I recommend for you to use deoplete.

I don't like the number of requirements that deoplete has -- it requires both two additional Vim plugins and a python package. neocomplete only requires that Vim be built with Lua support.

Shougo commented 5 years ago

If so, you need to use neocomplete. But I don't change the behavior.