atishay / vscode-allautocomplete

Autocomplete from open files for VSCode
MIT License
104 stars 25 forks source link

Hyphenated class names #14

Closed pavlvs closed 6 years ago

pavlvs commented 6 years ago

It would be useful to have suggestions for hyphenated class names from an HTML file while working in a CSS or JavaScript file that references them. For example: class name="collection-item" appears in CSS and JavaScript suggestions separately as "collection" and "item". It would more useful if it showed as "collection-item" in the list of suggestions.

atishay commented 6 years ago

This issue should not be there in the latest version. Please share the values of the following settings if you have overwritten them:

hillcoatt commented 6 years ago

I've got the same problem. I'm on Mac, OSX 11.11.6, VSCode 1.21.1. All hyphenated classes in php or html files won't show up. Values of the setting you mention:

1.

"AllAutocomplete.languageWhitespace": {
    "ruby": "[^\\w\\-_\\$:]+",
    "javascript": "[^\\w_\\$]+",
    "javascriptreact": "[^\\w_\\-\\$\\@]+",
    "typescript": "[^\\w_\\-\\$\\@]+",
    "php": "[^\\w_\\$]+",
    "css": "[^\\w\\-_\\$]+",
    "scss": "[^\\w\\-_\\$\\@]+",
    "html": "[^\\w\\-_\\$]+",
    "python": "[^\\w\\-_]+"
  },

2.

"AllAutocomplete.whitespace": "[^\\w\\-_\\$]+"
atishay commented 6 years ago

Can you check updating php to "php" to "[^\w\-_\$]+". That should fit this. I will update the list and create a new version once you can confirm this is not an issue with this setting.

hillcoatt commented 6 years ago

The html works as expected by the way.

I tried replacing with your string. Still doesn't work in php. And I get an error "Invalid escape character in string". I tried putting the html-regex under php, but that won't fix it:

"php": "[^\\w\\-_\\$]+",

Thanks for trying to sort this out though!

hillcoatt commented 6 years ago

I tried to change the order of the regex character list, and now everything works as expected. This is the regex variant in my preferences (switched places between \\- and \\w) :

"php": "[^\\-\\w_\\$]+",
atishay commented 6 years ago

Thank you for the update. I will set the defaults correctly in the next version.

atishay commented 6 years ago

Updated in 0.0.12. Please reopen if you are still facing issues.