Shayan Sh
Shayan Sh

Reputation: 105

code style for velocity template files in IntelliJ

Problem

The automatic indents in .vm files don't behave as I want them to. Below I add the auto formatted file and also the formatting I want.

The following code snippet is auto formatted by IntelliJ:

#styleTitle('sample-title')

#@styleDescription()
A short description of the component
#end


#@styleComponent('/components/molecules/sampleComponent/sampleComponent', {
    "headline": 'A headline title',
    "alertText": "Alert text example",
    "link" : {
    "href": "www.stackoverflow.com",
    "text": "Click here!"
}
})#end

What I want:

#styleTitle('sample-title')

#@styleDescription()
    A short description of the component
#end


#@styleComponent('/components/molecules/sampleComponent/sampleComponent', {
    "headline": 'A headline title',
    "alertText": "Alert text example",
    "link" : {
        "href": "www.stackoverflow.com",
        "text": "Click here!"
    }
})#end

Question

I couldn't find any additional configuration under IntelliJ IDEA | Preferences | Editor | Code Style | Velocity to adjust indention for different code blocks.

How can I configure the code style manually for a specific file type in IntelliJ and how does such a configuration file look like?

Upvotes: 3

Views: 951

Answers (0)

Related Questions