Skip to content

Commit 38a8a28

Browse files
committed
Add styles for CSS and HTML
1 parent 9b74147 commit 38a8a28

File tree

4 files changed

+87
-4
lines changed

4 files changed

+87
-4
lines changed

META-INF/plugin.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ Pull requests and issues welcome.
2525
<depends>com.intellij.modules.platform</depends>
2626

2727
<extensions defaultExtensionNs="com.intellij">
28-
<predefinedCodeStyle implementation="org.mediawiki.MediaWikiPredefinedCodeStyle"/>
29-
<!-- Add your extensions here -->
28+
<predefinedCodeStyle implementation="org.mediawiki.MediaWikiPhpPredefinedCodeStyle"/>
29+
<predefinedCodeStyle implementation="org.mediawiki.MediaWikiCssPredefinedCodeStyle"/>
30+
<predefinedCodeStyle implementation="org.mediawiki.MediaWikiHTMLPredefinedCodeStyle"/>
3031
</extensions>
3132

3233
<application-components>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU General Public License
4+
* as published by the Free Software Foundation; either version 2
5+
* of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
* GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program; if not, write to the Free Software
14+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*/
16+
17+
package org.mediawiki;
18+
19+
import com.intellij.lang.css.CSSLanguage;
20+
import com.intellij.psi.codeStyle.CodeStyleSettings;
21+
import com.intellij.psi.codeStyle.PredefinedCodeStyle;
22+
import com.intellij.psi.css.CssFileType;
23+
24+
/**
25+
* @author Reedy
26+
*/
27+
public class MediaWikiCssPredefinedCodeStyle extends PredefinedCodeStyle {
28+
public MediaWikiCssPredefinedCodeStyle() {
29+
super("MediaWiki", CSSLanguage.INSTANCE);
30+
}
31+
32+
@Override
33+
public void apply(CodeStyleSettings settings) {
34+
CodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(CssFileType.INSTANCE);
35+
indentOptions.USE_TAB_CHARACTER = true;
36+
indentOptions.SMART_TABS = true;
37+
indentOptions.TAB_SIZE = 4;
38+
indentOptions.INDENT_SIZE = 4;
39+
indentOptions.CONTINUATION_INDENT_SIZE = 4;
40+
}
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU General Public License
4+
* as published by the Free Software Foundation; either version 2
5+
* of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
* GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program; if not, write to the Free Software
14+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*/
16+
17+
package org.mediawiki;
18+
19+
import com.intellij.ide.highlighter.HtmlFileType;
20+
import com.intellij.lang.html.HTMLLanguage;
21+
import com.intellij.psi.codeStyle.CodeStyleSettings;
22+
import com.intellij.psi.codeStyle.PredefinedCodeStyle;
23+
24+
/**
25+
* @author Reedy
26+
*/
27+
public class MediaWikiHTMLPredefinedCodeStyle extends PredefinedCodeStyle {
28+
public MediaWikiHTMLPredefinedCodeStyle() {
29+
super("MediaWiki", HTMLLanguage.INSTANCE);
30+
}
31+
32+
@Override
33+
public void apply(CodeStyleSettings settings) {
34+
CodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(HtmlFileType.INSTANCE);
35+
indentOptions.USE_TAB_CHARACTER = true;
36+
indentOptions.SMART_TABS = true;
37+
indentOptions.TAB_SIZE = 4;
38+
indentOptions.INDENT_SIZE = 4;
39+
indentOptions.CONTINUATION_INDENT_SIZE = 4;
40+
}
41+
}

src/org/mediawiki/MediaWikiPredefinedCodeStyle.java renamed to src/org/mediawiki/MediaWikiPhpPredefinedCodeStyle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
/**
1111
* @author Reedy
1212
*/
13-
public class MediaWikiPredefinedCodeStyle extends PredefinedCodeStyle {
14-
public MediaWikiPredefinedCodeStyle() {
13+
public class MediaWikiPhpPredefinedCodeStyle extends PredefinedCodeStyle {
14+
public MediaWikiPhpPredefinedCodeStyle() {
1515
super("MediaWiki", PhpLanguage.INSTANCE);
1616
}
1717

0 commit comments

Comments
 (0)