forked from apache/netbeans
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#3314 from matthiasblaesing/css_formatting2
Exclude less (@{}) and scss (#{}) string interpolation from formatting
- Loading branch information
Showing
9 changed files
with
213 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.@{my-selector} { font-weight: bold; line-height: 40px; margin: 0 auto; } |
5 changes: 5 additions & 0 deletions
5
ide/css.editor/test/unit/data/testfiles/case005.less.formatted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.@{my-selector} { | ||
font-weight: bold; | ||
line-height: 40px; | ||
margin: 0 auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@mixin corner-icon($name, $top-or-bottom, $left-or-right) { | ||
.icon-#{$name} { | ||
background-image: url("/icons/#{$name}.svg"); position: absolute; | ||
#{$top-or-bottom}: 0; #{$left-or-right}: 0; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ide/css.editor/test/unit/data/testfiles/case006.scss.formatted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@mixin corner-icon($name, $top-or-bottom, $left-or-right) { | ||
.icon-#{$name} { | ||
background-image: url("/icons/#{$name}.svg"); | ||
position: absolute; | ||
#{$top-or-bottom}: 0; | ||
#{$left-or-right}: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
ide/css.editor/test/unit/src/org/netbeans/modules/css/editor/indent/LessIndenterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.css.editor.indent; | ||
|
||
import org.netbeans.modules.css.editor.test.*; | ||
import org.netbeans.modules.csl.api.Formatter; | ||
import org.netbeans.modules.csl.api.test.CslTestBase; | ||
import org.netbeans.modules.csl.spi.DefaultLanguageConfig; | ||
import org.netbeans.modules.css.editor.csl.CssLanguage; | ||
|
||
|
||
public class LessIndenterTest extends CslTestBase { | ||
|
||
private static final String PROP_MIME_TYPE = "mimeType"; //NOI18N | ||
|
||
public LessIndenterTest(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
protected DefaultLanguageConfig getPreferredLanguage() { | ||
return new CssLanguage(); | ||
} | ||
|
||
@Override | ||
protected String getPreferredMimeType() { | ||
return "text/less"; | ||
} | ||
|
||
@Override | ||
public Formatter getFormatter(IndentPrefs preferences) { | ||
return null; | ||
} | ||
|
||
public void testFormattingCase5() throws Exception { | ||
reformatFileContents("testfiles/case005.less", new IndentPrefs(4, 4)); | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
ide/css.editor/test/unit/src/org/netbeans/modules/css/editor/indent/ScssIndenterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.netbeans.modules.css.editor.indent; | ||
|
||
import org.netbeans.editor.BaseDocument; | ||
import org.netbeans.modules.csl.api.Formatter; | ||
import org.netbeans.modules.csl.api.test.CslTestBase; | ||
import org.netbeans.modules.csl.spi.DefaultLanguageConfig; | ||
import org.netbeans.modules.css.editor.csl.CssLanguage; | ||
import org.netbeans.modules.css.lib.TestUtil; | ||
import org.netbeans.modules.parsing.api.Source; | ||
import org.openide.filesystems.FileObject; | ||
|
||
|
||
public class ScssIndenterTest extends CslTestBase { | ||
|
||
private static final String PROP_MIME_TYPE = "mimeType"; //NOI18N | ||
|
||
public ScssIndenterTest(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
protected DefaultLanguageConfig getPreferredLanguage() { | ||
return new CssLanguage(); | ||
} | ||
|
||
@Override | ||
protected String getPreferredMimeType() { | ||
return "text/scss"; | ||
} | ||
|
||
@Override | ||
public Formatter getFormatter(IndentPrefs preferences) { | ||
return null; | ||
} | ||
|
||
public void testFormattingCase6() throws Exception { | ||
reformatFileContents("testfiles/case006.scss", new IndentPrefs(4, 4)); | ||
} | ||
|
||
} |