-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting properties inside test example files #62
Comments
Makes me consider the SciTE.properties file and how it is basically a skeleton of settings for testing with TestLexer. This can make viewing in SciTE as an unclear indication of how the test file looks in a test user state. So perhaps a Theme.properties or another fixed name like that can be imported by the SciTE.properties for the good of viewing in SciTE and that TestLexer could ignore the import line and ignore the Theme.properties file so that it only uses the skeleton of settings. This idea would allow Theme.properties to have stylings, with background colourings..., suitable to see the issues or successes in SciTE. Even if not having Theme.properties commited, it may allow a tester to make the file, add the import line and test with it without TestLexer complaining about Theme.properties, as it does with extra unknown files present. Theme.properties could also possibly be any name defined by the import statement and that TestLexer will recognize, so can allow for multiple property files if needed. This may help for a imported file with the properties that are embedded in the source file to be read and viewed in SciTE. Yeah, starting to get into possible file modification to change the later properties etc, though the imported files are for SciTE and will not affect the operation of TestLexer. Testing of properties files in the folder properties that does not yet exist, could cause problems so perhaps atleast the imported files could require a prefix of This idea has not been tried so it is untested. Maybe too early to know if needed. Maybe too much, though can be regarded as optional to make use of. P.S. This line for example:
is not needed for TestLexer in my opinon, so perhaps could be in Theme.properties if preferred. Perhaps with a more extensive theme suitable for testing purposes. Example with background colourings to show where styles start and end. |
I forgot about HTML tag usage for comments in Markdown, although the lexer does not process them as actual comments, so could be
which should make the styling as
For Markdown, it probably means little difference between HTML tags or just backquotes as it is going to be styled anyway. JSON in comparison might be tricky as styling can go red if is invalid JSON, so perhaps embed the properties as string values may possibly work, though probably undesirable to embed into the data itself. |
While there's no standard implementation of JSON comments beyond the json5 npm library, it seems LexJSON already offers this feature: Lines 125 to 126 in 5bb83ae
|
@mpheath :
The simple properties file reader in TestLexers doesn't process For testing the |
Another approach would add an optional companion For testing the properties lexer, a different extension can be used for the example files. |
If import feature is wanted, then a new recognizable option would be TestLexer.properties and SciTE.properties. It should be obvious which file is for which program. The default line in SciTE.properties would be SciTE does not know about HeaderEOLFill_0.md.properties unless you are referring to importing it, unless otherwise referring to properties read by TestLexer which may double the amount of files. Makes me now consider that the multiple import idea I mentioned previously might be a bad idea as it could lead to too many properties files. Or, perhaps you having second thoughts about the source embedded properties to be moved into multiple properties files. New extension without any association does not seem like a benefit. I am uncertain on this new extension idea. My thoughts are to have it work with SciTE with existing loading techniques. Whatever is implemented, if implemented, it should not be complex, else testing could become uncertain. That, I hope, can be mutually agreed. |
File name conditional expressions could be added inside if $(= $(FileNameExt);HeaderEOLFill_1.md)
lexer.markdown.header.eolfill=1 This isn't quite valid in SciTE but would be if propsLocal.Clear();
propsLocal.Set("FileNameExt", FileNameExt().AsUTF8().c_str());
propsLocal.Read(propfile, propfile.Directory(), filter, nullptr, 0); If this was just for TestLexers, not for SciTE, a simpler syntax could be used similar to EditorConfig [HeaderEOLFill_1.md]
lexer.markdown.header.eolfill=1 |
So presuming, SciTE.properties might be:
The and TestLexer.properties or other name might be similar:
Can be differenced with WinMerge or similar program to compare and update the common settings if needed. It will work with SciTE and TestLexer. Some duplication of settings with the 2 files, though should give good testing and viewing results. Click to view image of SciTE with *HeaderEOLFill_0.md* viewed on the left and *HeaderEOLFill_1.md* viewed on the right:Currently, I comment the I like this idea as it should work well with the various options associated with the test files. 👍 Edit: Those 2 md files are also duplicates, just different naming, perhaps an idea to use the same file? I don't consider it would work good with the view in SciTE. Perhaps 2 separate md files is needed. |
To save duplication of properties, could go back to the 1 file SciTE.properties to read. Example:
TestLexer will check for lines starting with SciTE should read all of the file and will exclude the sections after the lines starting with Perhaps |
There could be an code.page=65001
lexer.*.md=markdown
fold=1
alias HeaderEOLFill_1.md=HeaderEOLFill_0.md
if $(= $(FileNameExt);HeaderEOLFill_0.md)
lexer.markdown.header.eolfill=0
if $(= $(FileNameExt);HeaderEOLFill_1.md)
lexer.markdown.header.eolfill=1
# Level-one header=6
style.markdown.6=fore:#5183C4,bold,$(font.monospace),eolfilled,back:#FFFFCC
# Level-two header=7
style.markdown.7=$(style.markdown.6),back:#CCFFFF When working on a particular file, a copy could be made with the alias name so it is easy to compare the two cases. Then when the work is complete, the copy is removed and not committed to git. It might even be possible to add alias support to SciTE with a menu to choose between different aliases of a file and thus different features but that may be excessive. |
I am settled on this at this point, unless anyone has some more ideas. Looks like the later ideas are worth testing. The alias idea seems interesting and would like to see how that works. The alias set in Gui idea is too early to consider implementing, though is another interesting idea. The Hopefully the warnings output can still be concise working with aliases. I am sure you can handle this. ;) |
File name testing and alias are separate features and alias can be implemented later as its not essential to achieve the goals here. An implementation of It is sufficient for both selection statements in: if $(= $(FileNameExt);AllStyles.md)
lexer.markdown.header.eolfill=1
match Bug1216.md
lexer.markdown.header.eolfill=1 I'll propose these on the SciTE mailing list. |
…and "FileNameExt" property in TestLexers to allow varying lexer properties over different files.
Committed the basic 'match' feature with 2c9e004. This replaces the original plan of allowing properties to be set inside the example files. 'alias' may become a separate issue in the future if it seems beneficial. |
Requiring a new subdirectory for each property change test is unwieldy. It would be better to allow test example files to set properties that differ from SciTE.properties. These could be placed in comments at the start of the test example file similar to:
# Test with f-strings disabled: [|lexer.python.strings.f=0|]
The
[|...|]
syntax was chosen as these sequences are unusual so should avoid unexpected matches.An implementation is available from 62InlineProperties.patch.
Adding a subdirectory may still be worthwhile for properties that have complex effects or interactions.
The text was updated successfully, but these errors were encountered: