CSS classname autocompletion?

Answered

Is there some trick or requirements to getting css classnames to autocomplete/suggest in IDEA?  For example, if I have an html file and it has <link>s to style sheets, I'd like to have those come up as options in the class attribute.  Or does it not work with remotely hosted files?

7 comments
Comment actions Permalink

In .html files, only those CSS classes/IDs that are available in local .css files explicitly linked to HTML via <link> tag are available in completion.  CDN links to online resources, as well as dynamically generated links, can't be resolved.
So you have to download the css and reference it using the relative URL to make the completion work.

1
Comment actions Permalink

 Boo!  I don't like that answer - I want another one.

0
Comment actions Permalink

I know this is a year old, but...  IntelliJ asks to downloads remote files like this locally. Wouldn't it follow that IntelliJ might consider utilizing the locally stored files (if available) for auto-completion?

What other uses to IJ make of the locally stored file?

 

0
Comment actions Permalink

>IntelliJ asks to downloads remote files like this locally

 

it does this for .js files - they are downloaded to Idea configuration directory and set up as JavaScript Libraries for completion, etc. (see https://blog.jetbrains.com/webstorm/2014/07/how-webstorm-works-completion-for-javascript-libraries/)

But this doesn't work for stylesheet references (https://youtrack.jetbrains.com/issue/WEB-10023), you have to download .css manually in browser and save it to your project directory to make completion work

0
Comment actions Permalink

IntelliJ does download the css files locally as well.

However, I realize it does not work. That's the main reason for the comment. Is web-10023 officially a feature request?

0
Comment actions Permalink

>Is web-10023 officially a feature request?

sure.

0

Please sign in to leave a comment.