Hello
Using Notepad++ with the plugin Indent By Fold, it is noticed that Scintilla does not understand HTML code style very well. With HTML in this case is meant a file that also contains CSS-styling and Javascript.
The matter is somewhat described at IndentByFold FAQ here:
https://indentbyfold.readthedocs.io/en/latest/faq.html
Q: In CSS, } brackets don’t indent left like they do in the C-styled languages. Between
<style>tags in HTML, indentation doesn’t happen at all.Q: The plugin indents wrong in certain if else situations in various languages
For instance this gets indented as such:
<style>
* {
margin: 0;
padding: 0;
border: 0;
}
While this is the desired result:
<style>
* {
margin: 0;
padding: 0;
border: 0;
}
JavaScript code indents like this:
<script>
let center = [6.58979, 45.40107];
const map = new mapboxgl.Map({
container: 'map',
zoom: 13,
center: center,
pitch: 76,
bearing: 150,
style: 'mapbox://styles/mapbox/outdoors-v11',
hash: false
});
function myFunction(args) {
if (checkSomething(arg)) {
doSomething(arg);
} else {
doSomethingElse(arg);
}
}
The expected result are:
<script>
let center = [6.58979, 45.40107];
const map = new mapboxgl.Map({
container: 'map',
zoom: 13,
center: center,
pitch: 76,
bearing: 150,
style: 'mapbox://styles/mapbox/outdoors-v11',
hash: false
});
function myFunction(args) {
if (checkSomething(arg)) {
doSomething(arg);
} else {
doSomethingElse(arg);
}
}
Which is support by MDN Web Docs, Google JavaScript Style Guide and more:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
https://google.github.io/styleguide/jsguide.html
https://google.github.io/styleguide/htmlcssguide.html#Block_Content_Indentation
I am aware that SciTE FAQ mentions explicit folds here .
Lexers are now part of the Lexilla project https://www.scintilla.org/Lexilla.html and issues are tracked on https://github.com/ScintillaOrg/lexilla
CSS inside HTML is lexed in one style, the default style, 0. So the braces aren't seen as syntax.
The
const mapline should be seen as start of a fold - it appears foldable to me.For the
} else {something like the cpp lexer'sfold.at.elseproperty could be copied.Duplicate of [bugs:#341], [feature-requests:#470] and [feature-requests:#1438] for CSS highlighting.
Related
Bugs: #341
Feature Requests: #1438
Feature Requests: #470