About attributes of the language node, in langs.xml
-
Hello, @peterjones and All,
By hazard, I was looking to my
langs.xml
file, of my8.7.5
release and I noted this line :<Language name="powershell" ext="ps1 psm1 psd1" commentLine="#" commentStart="<#" commentEnd="#>" tabSettings="-1" backspaceUnindent="no">
I also saw two other locations with the attribute :
tabSettings="132"
I know that if the
tabSettings
value is greater than128
, it refers to the number of true spaces of the leading indentationHowever, looking at the section https://npp-user-manual.org/docs/config-files/#keyword-lists-langsxml, of the official N++ manual, there is no mention about the specific value
tabSettings="-1"
and also about thebackspaceUnindent
attributeSome thoughts about this ? Thanks in advance !
Best Regards,
guy038
-
@guy038 ,
Good catch. The
backspaceUnindent
attribute was added in v8.6.9, but I didn’t think to add a description of the attribute to the details section.And the small space in the table meant that the “details” on
tabSettings="..."
was pretty scant. I will add more details below the table in the manual.I am updating that table in the manual to be more like the following:
Position Name Value format Meaning 1 name string The name of the language. 2 ext string The list of file extensions associated to this language by default. Lists are space separated, without leading periods. 3 commentLine string The character(s) that prelude a comment extending to the end of the physical line when using the Edit > Comment/Uncomment > Single line actions. Set to “” if single-line comments are not supported for the current Language. 4 commentStart string The character(s) that start a block comment when using the Edit > Comment/Uncomment > Block Comment/Uncomment actions. Set to “” if block comments are not supported for the current Language. 5 commentEnd string The character(s) that end a block comment when using the Edit > Comment/Uncomment > Block Comment/Uncomment actions. Set to “” if block comments are not supported for the current Language. 6 exclude "yes"
/"no"
Set to "yes"
to hide this Language from the Language menu; otherwise, set to"no"
or don’t include this attribute. Reflects the Settings > Preferences > Language having the Language in the Disabled list ("yes"
) vs Available list ("no"
).7 tabSettings integer If present, the attribute value encodes the number of spaces a tab is equivalent to, reflecting Settings > Preferences > Indentation > Indent Settings for the active language. (More on this attribute, below) 8 backspaceUnindent "yes"
/"no"
If present, reflects the state of the Settings > Preferences > Indentation > Indent Settings > ☐ Backspace key unindents...
checkbox. (New to v8.6.9)The value used in the
tabSettings
attribute value depends on the Settings > Preferences > Indentation > Indent Settings:- If it is set to use
☑ Tab character
, then the value stored in this XML attribute is the same as in the preference’s Indent Size value. - If it is set to use
☑ Space character(s)
, then the value stored in this XML attribute is 128 higher than the preference’s Indent Size value (so a value of4
in the preference dialog would be stored here astabSettings="132"
). - If it is set to use
☑ Use Default Value
, then this attribute will betabSettings="-1"
. - If this
<Language...>
entry is missing thetabSettings
attribute, it will behave as if it hadtabSettings="-1"
.
- If it is set to use
-
Hello, @peterjones and All,
Thanks you so much, Peter for the update of the documentation regarding my questions !
Here is a summary of all the languages used in the default
Langs.xml
file of the last portable releasev8.7.5
Notes :
-
In the first line, I wrote the exact names of the attributes
-
Each time that the
attribute=""
syntax is used, for a specific language, I wrote EMPTY in the corresponding attribute column -
Each time that an attribute is totally absent, for a specific language, I left the corresponding attribute column blank
| name | ext | commentLine | commentStart | commentEnd | tabSettings | backspaceUnindent | •--------------•---------------------------------------------------------------------•-------------•--------------•------------•-------------•-------------------• | normal | txt | | | | | | actionscript | as mx | // | /* | */ | | | ada | ada ads adb | -- | EMPTY | EMPTY | | | asm | asm | ; | EMPTY | EMPTY | | | asn1 | mib | EMPTY | EMPTY | EMPTY | | | asp | asp aspx | ' | | | | | autoit | au3 | ; | #CS | #CE | | | avs | avs avsi | # | /* | */ | | | baanc | bc cln | | | | | | | bash | bash sh bsh csh bash_profile bashrc profile | # | | | | | batch | bat cmd nt | REM | | | | | blitzbasic | bb | EMPTY | EMPTY | EMPTY | | | c | c lex | // | /* | */ | | | caml | ml mli sml thy | EMPTY | (* | *) | | | cmake | cmake | # | | | | | cobol | cbl cbd cdb cdc cob cpy copy lst | *> | | | | | csound | orc sco csd | ; | EMPTY | EMPTY | | | coffeescript | coffee litcoffee | # | EMPTY | EMPTY | | | cpp | cpp cxx cc h hh hpp hxx ino | // | /* | */ | | | cs | cs | // | /* | */ | | | css | css | | /* | */ | | | d | d | // | /* | */ | | | diff | diff patch | | | | | | erlang | erl hrl | % | EMPTY | EMPTY | | | escript | src em | EMPTY | EMPTY | EMPTY | | | forth | forth | \ | ( | ) | | | fortran | f for f90 f95 f2k f23 | ! | | | | | fortran77 | f77 | C | | | | | freebasic | bas bi | EMPTY | EMPTY | EMPTY | | | go | go | // | /* | */ | | | gui4cli | gui | // | | | | | haskell | hs lhs las | -- | | | | | hollywood | hws | ; | /* | */ | | | html | html htm shtml shtm xhtml xht hta | EMPTY | <!-- | --> | | | ini | ini inf url wer | ; | | | | | inno | iss | ; | EMPTY | EMPTY | | | ihex | hex | | | | | | java | java | // | /* | */ | | | javascript | EMPTY | // | /* | */ | | | javascript.js| js jsm jsx mjs | // | /* | */ | | | json | json | EMPTY | EMPTY | EMPTY | | | json5 | json5 jsonc | // | /* | */ | | | jsp | jsp | // | /* | */ | | | kix | kix | ; | EMPTY | EMPTY | | | lisp | lsp lisp | ; | | | | | latex | tex sty | % | EMPTY | EMPTY | | | lua | lua | -- | | | | | makefile | mak mk | # | | | | | matlab | m | % | EMPTY | EMPTY | | | mssql | tsql | -- | /* | */ | | | mmixal | mms | % | EMPTY | EMPTY | | | nim | nim | # | EMPTY | EMPTY | | | nncrontab | tab spf | \ | EMPTY | EMPTY | | | nfo | nfo | | | | | | nsis | nsi nsh | ; | /* | */ | | | oscript | osx | // | /* | */ | | | objc | mm | // | /* | */ | | | pascal | pas pp p inc lpr | | { | } | | | perl | pl pm plx t | # | | | | | php | php php3 php4 php5 phps phpt phtml | // | /* | */ | | | postscript | ps | % | | | | | powershell | ps1 psm1 psd1 | # | <# | #> | -1 | no | | props | properties conf cfg gitattributes gitconfig gitmodules editorconfig | # | | | | | purebasic | pb | EMPTY | EMPTY | EMPTY | | | python | py pyw pyx pxd pxi | # | | | 132 | | gdscript | gd | # | | | | | r | r s splus | # | | | | | raku | raku rakumod rakudoc rakutest p6 pm6 pod6 t6 | # | `{ | } | | | rebol | r2 r3 reb | ; | EMPTY | EMPTY | | | registry | reg | ;; | EMPTY | EMPTY | | | rc | rc | // | /* | */ | | | ruby | rb rbw | # | | | | | rust | rs | // | /* | */ | | | scheme | scm smd ss | ; | | | | | smalltalk | st | | '"' | '"'| | | spice | scp out | * | EMPTY | EMPTY | | | sql | sql | -- | /* | */ | | | srec | mot srec | | | | | | swift | swift | // | /* | */ | | | tcl | tcl | # | | | | | tehex | tek | | | | | | tex | tex | % | | | | | toml | toml | # | | | | | vb | vb vba vbs | ' | EMPTY | EMPTY | | | txt2tags | t2t | EMPTY | EMPTY | EMPTY | | | typescript | ts tsx | // | /* | */ | | | verilog | v sv vh svh | // | /* | */ | | | vhdl | vhd vhdl | -- | /* | */ | | | visualprolog | pro cl i pack ph | % | /* | */ | | | xml | xml xaml xsl xslt xsd xul kml svg mxml xsml wsdl xlf xliff xbl sxbl | EMPTY | <!-- | --> | | | xml | sitemap gml gpx plist vcproj vcxproj csproj csxproj vbproj dbproj | EMPTY | <!-- | --> | | | yaml | yml yaml | # | | | 132 | | searchResult | EMPTY | | | | |
Some observations or weird things about the
Langs.xml
file :- Regarding the
Lua
language, the first line is :
<Language commentLine="--" ext="lua" name="lua">
I hope that it still works with this layout. Personally, I would expect this syntax :
<Language name ="lua" ext="lua" commentLine="--">
- For the two languages
mssql
andsql
, thecommentLine
attribute is moved at end of current line, after thecommentStart
andcommentEnd
attributes
I suppose that it doesn’t matter, but to be coherent with the other languages, we could use, instead :
<Language name="mssql" ext="tsql" commentLine="--" commentStart="/*" commentEnd="*/">
And :
<Language name="sql" ext="sql" commentLine="--" commentStart="/*" commentEnd="*/">
-
The embedded
Javascript
andSearchResult
languages do not have any extension ! I suppose that it’s on purpose ? -
More generally, for a specific attribute, is the
attribute=""
syntax identical to the total absence of this attribute ? -
As you said, in the documentation :
If this
<Language...>
entry is missing thetabSettings
attribute, it will behave as if it hadtabSettings="-1"
. Thus, I suppose that it could be omitted, for thepowershell
language- Regarding the
backspaceUnindent
attribute, it doesn’t seem used, by default, even for the two languagespython
andyaml
which use the fourspace
indentation
Thus, the
no
status, for thepowershell
language seems useless, too !Oh… ,however, looking at the
langs.model.xml
file, for thepowershell
language, I just see :<Language name="powershell" ext="ps1 psm1 psd1" commentLine="#" commentStart="<#" commentEnd="#>">
So, this may be a mistake on my part, although I don’t use the
powershell
language, yet !Thanks in advance for your head-ups !
Best Regards,
guy038
-
-
@guy038, said in About attributes of the language node, in langs.xml:
- Regarding the
Lua
language, the first line is :
I hope that it still works with this layout. Personally, I would expect this syntax :
… - For the two languages
mssql
andsql
, thecommentLine
attribute is moved at end of current line, after thecommentStart
andcommentEnd
attributes
Order of attributes is irrelevant to XML (even when parsed by the outdated tinyxml library used in N++)
- The embedded
Javascript
andSearchResult
languages do not have any extension ! I suppose that it’s on purpose ?
Since embedded Javascript is only for JavaScript embedded in HTML and similar files, it makes sense to not populate the
ext
attribute. And SearchResult even more so.- More generally, for a specific attribute, is the
attribute=""
syntax identical to the total absence of this attribute ?
As far as I know or can determine.
- Regarding the
backspaceUnindent
attribute, it doesn’t seem used, by default, even for the two languagespython
andyaml
which use the fourspace
indentation
Don didn’t bother updating the XML to include the default value for all languages, because the code already assumes the default value.
That attribute will only show up on languages that you change the state of that option – or perhaps on languages where you change any of the langs.xml-related options in the GUI (I haven’t tested that).
Thus, the
no
status, for thepowershell
language seems useless, too !If you toggle it on and then back off (there might have to be an exit/reload between; again, I haven’t tested specifically), it will first populate the attribute with the
yes
when you toggle it on (and then save settings), then it will populate withno
when you toggle it back off (and then save settings).Once Notepad++ has started tracking a given attribute in its XML settings, it will always write that value when it writes the associated XML on exit; the attribute-is-missing case is just to simplify handling installations that are being upgraded (so a person doesn’t have to re-create their
langs.xml
in order to be able to toggle that option), and Don made use of this to save the effort of adding that attribute to every language in the model XML file.… however, looking at the
langs.model.xml
file, for thepowershell
language, I just see :
…
So, this may be a mistake on my part, although I don’t use thepowershell
language, yet !Right now, the most recent commit for
langs.model.xml
is here, and it shows that powershell does not include that attribute. Which means for theno
value to have shown up in your XML, you either toggled that option or you made some other change for powershell (knowingly or unknowingly). - Regarding the