New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS auto complete popup no longer working #283

Closed
onetrev opened this Issue May 9, 2014 · 23 comments

Comments

8 participants
@onetrev

onetrev commented May 9, 2014

Previously, in Sublime Text 2, you could type the beginning of a class name (or ID) in your CSS file and a pop-up box with related class names would appear, as per attached image. Now in Sublime Text 3, this box can only be brought up through the "Ctrl + Space" command.

selector-pop

OS: Windows 7 SP1 & Windows 8.1 Update 1
Sublime: Build 3059

There is a thread discussing this issue here: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=15037&p=57978. In my testing at least the posted temporary fix for this doesn't work on either machine I have tried it on.

** EDIT ** -> actually no CSS auto complete popup is working. This is both for class names and element names, ie. "article, fieldset, etc". The only way to bring up any auto-complete window in CSS documents is with "Ctrl+Space", so clearly the auto-complete is there it's just not auto any more.

Edit by @FichteFoll: temporary solution

@nickfmc

This comment has been minimized.

Show comment
Hide comment
@nickfmc

nickfmc Jul 8, 2014

I would love to see this issue resolved, I can also confirm the fix not working on win8.1 sublime build 3059

nickfmc commented Jul 8, 2014

I would love to see this issue resolved, I can also confirm the fix not working on win8.1 sublime build 3059

@onetrev onetrev changed the title from CSS selector completion popup no longer automatic to CSS auto complete popup no longer working Jul 25, 2014

@onetrev

This comment has been minimized.

Show comment
Hide comment
@onetrev

onetrev Jul 25, 2014

Sorry to add on to this issue, but just thinking about it again and having continue to work around it, I really to feel this bug status should be upgraded beyond "trivial". This auto complete functionality is a huge time saver and would be a big loss to any file format it is missing from. Luckily it's only CSS from what I've seen so far. Thanks!!

onetrev commented Jul 25, 2014

Sorry to add on to this issue, but just thinking about it again and having continue to work around it, I really to feel this bug status should be upgraded beyond "trivial". This auto complete functionality is a huge time saver and would be a big loss to any file format it is missing from. Luckily it's only CSS from what I've seen so far. Thanks!!

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Aug 1, 2014

Member

Did some investigation. The problem is this file called CSS/Completion Rules.tmPreferences with this content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>scope</key>
    <string>source.css meta.selector</string>
    <key>settings</key>
    <dict>
        <key>cancelCompletion</key>
        <string>.*</string>
    </dict>
</dict>
</plist>

It effectively means that auto completion is cancelled when editing or adding css selectors. You can retrieve the current setting for the first cursor with the following command line: view.meta_info("cancelCompletion", view.sel()[0].a), however I have not yet been successful at overriding that. The usual method (by copying the file to Packages/CSS and editing there) doesn't trigger the change immediately, I have to change a seperate file in Packages/User to make ST regenerate its meta info summary ...

I can't make any sense of this right now, but this is a different issue.


Anyway, even after removing everything in the <dict> tags and verifying (with the console command) that the changes triggered, I still don't get a popup. And even with ctrl+space I don't get word completions, only the pre-defined ones. The latter is caused by the way ST provides the (dynamic) CSS
completions via plugin (Packages/CSS/css_completions.py) and particularly by the lines 156, 185 and 194:

        if (view.match_selector(locations[0], "meta.property-value.css") or
            # This will catch scenarios like .foo {font-style: |}
            view.match_selector(locations[0] - 1, "meta.property-value.css")):
            # [...]
        else:
            # [...]
            return (l, sublime.INHIBIT_WORD_COMPLETIONS)

I don't know about the first problem though.

Member

FichteFoll commented Aug 1, 2014

Did some investigation. The problem is this file called CSS/Completion Rules.tmPreferences with this content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>scope</key>
    <string>source.css meta.selector</string>
    <key>settings</key>
    <dict>
        <key>cancelCompletion</key>
        <string>.*</string>
    </dict>
</dict>
</plist>

It effectively means that auto completion is cancelled when editing or adding css selectors. You can retrieve the current setting for the first cursor with the following command line: view.meta_info("cancelCompletion", view.sel()[0].a), however I have not yet been successful at overriding that. The usual method (by copying the file to Packages/CSS and editing there) doesn't trigger the change immediately, I have to change a seperate file in Packages/User to make ST regenerate its meta info summary ...

I can't make any sense of this right now, but this is a different issue.


Anyway, even after removing everything in the <dict> tags and verifying (with the console command) that the changes triggered, I still don't get a popup. And even with ctrl+space I don't get word completions, only the pre-defined ones. The latter is caused by the way ST provides the (dynamic) CSS
completions via plugin (Packages/CSS/css_completions.py) and particularly by the lines 156, 185 and 194:

        if (view.match_selector(locations[0], "meta.property-value.css") or
            # This will catch scenarios like .foo {font-style: |}
            view.match_selector(locations[0] - 1, "meta.property-value.css")):
            # [...]
        else:
            # [...]
            return (l, sublime.INHIBIT_WORD_COMPLETIONS)

I don't know about the first problem though.

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Aug 10, 2014

Member

Okay, time for a solution.

  1. Get https://sublime.wbond.net/packages/PackageResourceViewer

  2. Run PackageResourceViewer: Open Resource and browse CSS/css_completions.py

  3. Apply this change (line 185):

    @@ -185,1 +185,1 @@
    -        else:
    +        elif view.match_selector(locations[0], "meta.property-list.css"):
  4. Just save.

  5. Run PackageResourceViewer: Open Resource and browse CSS/Completion Rules.tmPreferences

  6. Apply this change:

    @@ -10,1 +10,1 @@
    -            <string>.*</string>
    +            <string></string>
  7. Save to Packages/User/CSS Completion Rules.tmPreferences (because of #411).

Member

FichteFoll commented Aug 10, 2014

Okay, time for a solution.

  1. Get https://sublime.wbond.net/packages/PackageResourceViewer

  2. Run PackageResourceViewer: Open Resource and browse CSS/css_completions.py

  3. Apply this change (line 185):

    @@ -185,1 +185,1 @@
    -        else:
    +        elif view.match_selector(locations[0], "meta.property-list.css"):
  4. Just save.

  5. Run PackageResourceViewer: Open Resource and browse CSS/Completion Rules.tmPreferences

  6. Apply this change:

    @@ -10,1 +10,1 @@
    -            <string>.*</string>
    +            <string></string>
  7. Save to Packages/User/CSS Completion Rules.tmPreferences (because of #411).

@onetrev

This comment has been minimized.

Show comment
Hide comment
@onetrev

onetrev Aug 11, 2014

Patch works perfectly! Thanks for that, such a relief to finally have this fixed and working again...

onetrev commented Aug 11, 2014

Patch works perfectly! Thanks for that, such a relief to finally have this fixed and working again...

@fanathysm

This comment has been minimized.

Show comment
Hide comment
@fanathysm

fanathysm Aug 20, 2014

Doesn't work for me. I followed exactly what you wrote, FichteFoll. The file paths are also exactly as shown above. What did I do wrong?

fanathysm commented Aug 20, 2014

Doesn't work for me. I followed exactly what you wrote, FichteFoll. The file paths are also exactly as shown above. What did I do wrong?

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Aug 21, 2014

Member

@fanathysm Did you try to restart ST?

Member

FichteFoll commented Aug 21, 2014

@fanathysm Did you try to restart ST?

@fanathysm

This comment has been minimized.

Show comment
Hide comment
@fanathysm

fanathysm commented Aug 21, 2014

@FichteFoll yes I tried

@jwhitmarsh

This comment has been minimized.

Show comment
Hide comment
@jwhitmarsh

jwhitmarsh Aug 21, 2014

Same here - followed the patch exactly but it hasn't worked. I'm in build 3059 on OSX 10.9.3

jwhitmarsh commented Aug 21, 2014

Same here - followed the patch exactly but it hasn't worked. I'm in build 3059 on OSX 10.9.3

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Aug 21, 2014

Member

Can you both please check if the first file (Packages/CSS/Completion Rules.tmPreferences) exists? It could be a bug in PackageResourceViewer.

Other than that, I have no idea. Do you perhaps have other plugins installed that could interfere?

Member

FichteFoll commented Aug 21, 2014

Can you both please check if the first file (Packages/CSS/Completion Rules.tmPreferences) exists? It could be a bug in PackageResourceViewer.

Other than that, I have no idea. Do you perhaps have other plugins installed that could interfere?

@jwhitmarsh

This comment has been minimized.

Show comment
Hide comment
@jwhitmarsh

jwhitmarsh Aug 21, 2014

I had the same thought, and it does exist. Is that as expected?

I had Sublime Extend Completions installed, which I've now removed to see if that was affecting it - no difference.

jwhitmarsh commented Aug 21, 2014

I had the same thought, and it does exist. Is that as expected?

I had Sublime Extend Completions installed, which I've now removed to see if that was affecting it - no difference.

@jwhitmarsh

This comment has been minimized.

Show comment
Hide comment
@jwhitmarsh

jwhitmarsh Aug 21, 2014

I got it working by following your solution in Issue #411 so Packages/User/CSS Completion Rules.tmPreference should end up looking like this

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
      <key>scope</key>
      <string>source.css meta.selector</string>
      <key>settings</key>
      <dict>
      </dict>
  </dict>
  </plist>

jwhitmarsh commented Aug 21, 2014

I got it working by following your solution in Issue #411 so Packages/User/CSS Completion Rules.tmPreference should end up looking like this

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
      <key>scope</key>
      <string>source.css meta.selector</string>
      <key>settings</key>
      <dict>
      </dict>
  </dict>
  </plist>
@jwhitmarsh

This comment has been minimized.

Show comment
Hide comment
@jwhitmarsh

jwhitmarsh Aug 21, 2014

Thank you btw!

jwhitmarsh commented Aug 21, 2014

Thank you btw!

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Aug 21, 2014

Member

@jwhitmarsh are you sure you followed the instructions in 7.?

Save to Packages/User/CSS Completion Rules.tmPreferences

Clearing the settings key should not override any of the previously set metadata so you likely saved the changes from step 6 to the CSS package instead of User.

Member

FichteFoll commented Aug 21, 2014

@jwhitmarsh are you sure you followed the instructions in 7.?

Save to Packages/User/CSS Completion Rules.tmPreferences

Clearing the settings key should not override any of the previously set metadata so you likely saved the changes from step 6 to the CSS package instead of User.

@fanathysm

This comment has been minimized.

Show comment
Hide comment
@fanathysm

fanathysm Aug 21, 2014

I made the changes exactly according to 6) - saved everything to CSS Completion Rules.tmPreferences within Packages/User as described - but that didn't work. Do I have to do anything related to Issue #411 in addition to that?

Also I have checked. The file Packages/CSS/Completion Rules.tmPreferences does exist.

Packages I am using atm:

Advanced new File
All Autocomplete
Emmet
Package Control
Package Resource Viewer
Pyv8
Sidebar Enhancements
SublimeCodeIntel
Tag

fanathysm commented Aug 21, 2014

I made the changes exactly according to 6) - saved everything to CSS Completion Rules.tmPreferences within Packages/User as described - but that didn't work. Do I have to do anything related to Issue #411 in addition to that?

Also I have checked. The file Packages/CSS/Completion Rules.tmPreferences does exist.

Packages I am using atm:

Advanced new File
All Autocomplete
Emmet
Package Control
Package Resource Viewer
Pyv8
Sidebar Enhancements
SublimeCodeIntel
Tag

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Aug 21, 2014

Member

Try disabling Emmet and see if it helps. Otherwise I'm lost, without digging through like everything.

Member

FichteFoll commented Aug 21, 2014

Try disabling Emmet and see if it helps. Otherwise I'm lost, without digging through like everything.

@fanathysm

This comment has been minimized.

Show comment
Hide comment
@fanathysm

fanathysm Aug 21, 2014

Nope that did not work either :(
At least snippets would be working in css then, but without Emmet, that's not a solution for me. Also autocompletion does not pop up.
But why does it work for onetrev c and jwhitmarsh and not for me? I am using win7 and latest version of ST3.

fanathysm commented Aug 21, 2014

Nope that did not work either :(
At least snippets would be working in css then, but without Emmet, that's not a solution for me. Also autocompletion does not pop up.
But why does it work for onetrev c and jwhitmarsh and not for me? I am using win7 and latest version of ST3.

@jwhitmarsh

This comment has been minimized.

Show comment
Hide comment
@jwhitmarsh

jwhitmarsh Aug 22, 2014

@FichteFoll yeah I definitely saved it with that name, at that location.

I just reset everything to see if I could get it to work following your initial instructions, but no luck, and then it didn't work using the #411 fix either!

I've now got it working again, using your initial code and I think the issue is a part of Sublime not loading in the User config file - initially I was leaving User/CSS Completion Rules.tmPreferences open when restarting Sublime, and it was only when I closed that file BEFORE the restart that it started working again.

I'm not au fait enough with native app dev, so that deduction might be completely wrong, but that's what appears to be the issue.

jwhitmarsh commented Aug 22, 2014

@FichteFoll yeah I definitely saved it with that name, at that location.

I just reset everything to see if I could get it to work following your initial instructions, but no luck, and then it didn't work using the #411 fix either!

I've now got it working again, using your initial code and I think the issue is a part of Sublime not loading in the User config file - initially I was leaving User/CSS Completion Rules.tmPreferences open when restarting Sublime, and it was only when I closed that file BEFORE the restart that it started working again.

I'm not au fait enough with native app dev, so that deduction might be completely wrong, but that's what appears to be the issue.

@fanathysm

This comment has been minimized.

Show comment
Hide comment
@fanathysm

fanathysm Aug 22, 2014

@jwhitmarsh Ok so does it work for you correctly now?
Edit:
In my case only the manual completion works if I am using Emmet. Disabling Emmet only makes snippets usable in css-files, but not autocompletion.

fanathysm commented Aug 22, 2014

@jwhitmarsh Ok so does it work for you correctly now?
Edit:
In my case only the manual completion works if I am using Emmet. Disabling Emmet only makes snippets usable in css-files, but not autocompletion.

@jonathanphz

This comment has been minimized.

Show comment
Hide comment
@jonathanphz

jonathanphz Sep 7, 2014

This worked. Finally!!

jonathanphz commented Sep 7, 2014

This worked. Finally!!

@benfrain

This comment has been minimized.

Show comment
Hide comment
@benfrain

benfrain Mar 10, 2015

Tried the solutions here to no avail. CTRL+Space still brings them up but no default auto-complete. Running dev build 3075 Mac

benfrain commented Mar 10, 2015

Tried the solutions here to no avail. CTRL+Space still brings them up but no default auto-complete. Running dev build 3075 Mac

@PierBover

This comment has been minimized.

Show comment
Hide comment
@PierBover

PierBover Mar 21, 2015

How is this a minor bug? I simply can't use ST3 without this.

Patching css_completions.pyand modifying CSS Completion Rules.tmPreferences solution didn't work for me either.

PierBover commented Mar 21, 2015

How is this a minor bug? I simply can't use ST3 without this.

Patching css_completions.pyand modifying CSS Completion Rules.tmPreferences solution didn't work for me either.

@FichteFoll

This comment has been minimized.

Show comment
Hide comment
@FichteFoll

FichteFoll Mar 21, 2015

Member

It is definitely minor.

Also ... it's actually an issue for the default packages repo.

Edit: It actually is already. Seems @titoBouzout just forgot to close this one.
Refer to SublimeTextIssues/DefaultPackages#79.

Edit2: It's also not a bug actually. It's explicitly disabled.

Member

FichteFoll commented Mar 21, 2015

It is definitely minor.

Also ... it's actually an issue for the default packages repo.

Edit: It actually is already. Seems @titoBouzout just forgot to close this one.
Refer to SublimeTextIssues/DefaultPackages#79.

Edit2: It's also not a bug actually. It's explicitly disabled.

@FichteFoll FichteFoll closed this Mar 21, 2015

@SublimeTextIssues SublimeTextIssues locked and limited conversation to collaborators Mar 21, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.