Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete von available CSS classes in HTML JavaScript jQuery in Eclipse

I am using the latest Eclipse version. Right now I am coding with Javascript, jQuery, HTML, and CSS. How do I get autocomplete (show all available classes defined in CSS) for classes, which I have defined in CSS, displayed in HTML?

I have a class called "display" in my CSS file.

file.css:

.display {
background:green;
}

How to get the display class suggested with autocompletion?

HTML: enter image description here

What kind of plug-in/addon would I need?

like image 317
Gero Avatar asked Apr 13 '17 10:04

Gero


1 Answers

The default WTP plugin bundled with the Eclipse installation doesn't support this. You will have to install an extension plugin (WTP Web resources).

Go to Help -> Install New Software and add the following URL in the 'Work with' text box and press Add.

http://oss.opensagres.fr/eclipse-wtp-webresources/1.1.0/

After a while, you'll be presented with a check list. Check the plugin and click Install.

After the installation is complete, restart Eclipse. Then open up an HTML file and add a link to a CSS file like in the following example:

sample.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<link rel="stylesheet" type="text/css" href="test.css" />
</head>
<body >




</body>
</html>

sample.css

.one { padding: 10px; } 
.two { padding: 20px; }

Now add an element within the body of the HTML file - e.g. div - and add a class="" attribute. Pressing Ctrl+Space within the double quotes will bring up the content assist window showing you all the available classes from the linked CSS file.

content assist window

like image 185
chrysanthos Avatar answered Nov 17 '22 13:11

chrysanthos