How to add CSS autocomplete to eclipse

32,791

Solution 1

Go:

Window -> Preferences -> Web -> CSS files -> Editor -> Content assist.

And make sure the checkboxes are checked

EDIT: Ok... Then try with these:

Window -> Preferences -> General -> Content Types -> Text -> JSP -> Add (*.css)

OR

Window -> Preferences -> General -> Content Types -> Text -> Java Source File -> Add (*.css)

Try with these and see if it solves your problem

EDIT 2: Plus try this:

Window -> Preferences -> General -> Editors -> File Association -> Add (*.css)

EDIT 3:

Window -> Preferences -> General -> Editors -> File Association

make sure it looks like this, it works for me with the autocompletion:

enter image description here

Solution 2

You need to install a WTP extension plugin (WTP Web resources). See my answer here https://stackoverflow.com/a/43549935/2459094.

Share:
32,791
fresh_dev
Author by

fresh_dev

Updated on July 09, 2022

Comments

  • fresh_dev
    fresh_dev almost 2 years

    i am using eclipse helios 3.6 and i am developing JSF pages (Dynamic Web Project With JSF Capabilities) and sometimes i need to add style to a component in the xhtml page

    <h:commandLink style="margin-righ:10px">
    

    (not a style class) and i want to add CSS autocomplete to eclipse how to do so ? please advise, thanks.

  • fresh_dev
    fresh_dev over 12 years
    in fact they are checked, maybe that works in css files only ?
  • fresh_dev
    fresh_dev over 12 years
    you noticed that i asked for autocomplete in xhtml page not in css file ?
  • fresh_dev
    fresh_dev over 12 years
    doesn't work either no css proposal, no css template proposal, no default proposal.
  • AndroidHustle
    AndroidHustle over 12 years
    Sorry I've been away. Ok, so it's a .JSP file containing xHTML right? Look at my edit.
  • fresh_dev
    fresh_dev over 12 years
    no it's a .xhtml file that contains JSF, and i tried to open it with JSP editor and also the web page editor, and nothing works, still there's no css autocomplete, maybe i am missing something in my project configuration ?
  • AndroidHustle
    AndroidHustle over 12 years
    Ok so you've opened it with IDE's other than Eclipse and the autocompletion doesn't work there either..? If so this sounds very strange to me.
  • fresh_dev
    fresh_dev over 12 years
    after applying all above steps and restarting eclipse, i am getting this exception: stackoverflow.com/questions/7914131/… please advise
  • AndroidHustle
    AndroidHustle over 12 years
    hmm... there seems to be something really wrong with your environment configuration... this looks like an old bug that could appear in the IDE, that has been fixed, I can't see why you're getting it... I don't know honestly, re-install Eclipse? If that's not too great of an issue..?
  • AndroidHustle
    AndroidHustle over 12 years
    Allright mate, I wish you the best of luck. Those guys roaming the Eclipse forum should be able to tell you what's wrong I'm sure!
  • fresh_dev
    fresh_dev over 12 years
    BTW, what eclipse version do you use ?
  • AndroidHustle
    AndroidHustle over 12 years
    Version: 3.6.2.r362_v20110210-9gF78Gs1FrIGnHDHWkEcopoN8AmxeZflGDGKQi Build id: M20110210-1200
  • AndroidHustle
    AndroidHustle over 12 years
    So it should be pretty much the same version as you're using
  • Atheist
    Atheist about 10 years
    What tripped me, was that I had to press ctrl-space to get the suggestion box, while in the php-editor it would pop up automatically.