SciTE currently provides various domains for settings in properties files: global, user, project and directory. Some settings are made over all files that match a pattern or for files that use a particular lexer. Many settings can not currently be defined for individual files.
Lexilla’s testing system uses SciTE.properties files to define the settings to apply to each file under test. Since SciTE also uses these files, its easy to try different settings, see the result visually in SciTE and check whether it passes automated tests.
When a lexer defines a property, like the Markdown lexer’s ‘lexer.markdown.header.eolfill’, there should be tests for all valid values (0 and 1) for that property. The testing system currently requires the 0 and 1 tests to be in separate directories so that both values can be tried. It would be better to allow properties to be defined for individual files and so avoid the extra directories. This should also be added to SciTE to continue to use common SciTE.properties files.
It turns out that it is possible to support per-file settings inside SciTE.properties with a small change to SciTE. “if” tests in SciTE properties are evaluated when reading files, so setting the “FileNameExt” in the properties before reading the file allows selection statements using the existing “if” and “$(=“ features like:
if $(= $(FileNameExt);AllStyles.md)
lexer.markdown.header.eolfill=1
This works for the local (per-directory) SciTE.properties file but would also work for the optional project (per directory-tree) SciTEDirectory.properties file. It does not work for the user and global properties which may be large so are assumed to rarely change. Re-reading and re-evaluating the global and user properties may take some time so doing so on every buffer switch should be avoided.
There could be pattern matching to match multiple files (“Bug*.md”) and simpler syntax such as
match Bug1216.md
lexer.markdown.header.eolfill=1
Or, the EditorConfig (SciTE supports EditorConfig) inspired
[HeaderEOLFill_1.md]
lexer.markdown.header.eolfill=1
There is a Lexilla issue for better property setting at
https://github.com/ScintillaOrg/lexilla/issues/62
Proposal for SciTE:
(1) Insert FilePath, FileDir, FileName, FileExt, and FileNameExt into propsDirectory before reading directory or local properties so they can be used in “if” tests.
(2) Add a “match” expression that is similar to “if” but implicitly tests the file name.
(3) Support basic patterns with ‘*’ in “match”.
These may be added piece by piece over time.
Neil