You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining symbols and setting up automated syntax tests for them, things (currently) work as expected. Adding symbol transformation partially breaks tests.
Implied local-definition seems to work, implied global-definition does not, when using @@@ definition "transformed-symbol" in syntax tests.
Steps to reproduce
Transform symbols, as an example we use JSON.
<!-- Packages/JSON/Symbol List - Top Level Keys.tmPreferences -->
<?xml version="1.0" encoding="UTF-8"?>
<plistversion="1.0">
<dict>
<!-- If the JSON file contains an object, add its top-level keys as symbols to the index. Transform "key" -> key. Exclude keys of objects within an object. Exclude keys of objects within a list.-->
<key>scope</key>
<string><![CDATA[source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)]]></string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<string>1</string>
<key>symbolTransformation</key>
<string><![CDATA[s/^["']|["']$//g;]]></string>
<key>showInIndexedSymbolList</key>
<string>1</string>
<key>symbolIndexTransformation</key>
<string><![CDATA[s/^["']|["']$//g;]]></string>
</dict>
</dict>
</plist>
Even though a global and a local symbol are tested for via definition, the actual test only shows local-definition being tested, not definition as stated in the line of the syntax test file which implies that both global-definition and local-definition are included in the test.
The symbol was correctly transformed.
We see here that:
The test location is wrong. The test should be "key-one" in line 6 (the symbol before the transformation), but only tests key-one in line 6 (the symbol after the transformation).
The (above seemingly ignored) global-definition is now tested for, but in the wrong location.
The symbol was correctly transformed.
Compare the following from the two images above:
Sublime Text build number
4191
Operating system & version
any
(Linux) Desktop environment and/or window manager
any
The text was updated successfully, but these errors were encountered:
Description of the bug
When defining symbols and setting up automated syntax tests for them, things (currently) work as expected. Adding symbol transformation partially breaks tests.
Implied
local-definition
seems to work, impliedglobal-definition
does not, when using@@@ definition "transformed-symbol"
in syntax tests.Steps to reproduce
Transform symbols, as an example we use JSON.
To quickly test this, use the JSON rewrite for sublimehq/Packages#3097 found at https://github.com/jrappen/sublime-json/ with the following changes:
Expected behavior
Top-level keys of a JSON object should here be added to the index even after transformation.
Actual behavior
When adding symbol transformation, previously working syntax tests break.
The symbol
"key-one"
in the test file is transformed tokey-one
and we need to add it quoted to the test line in thesyntax_test_*
file.Compare the docs at https://www.sublimetext.com/docs/syntax.html#testing:
The test binary reports the following:
We see here that:
definition
, the actual test only showslocal-definition
being tested, notdefinition
as stated in the line of the syntax test file which implies that bothglobal-definition
andlocal-definition
are included in the test.We see here that:
"key-one"
in line 6 (the symbol before the transformation), but only testskey-one
in line 6 (the symbol after the transformation).global-definition
is now tested for, but in the wrong location.Compare the following from the two images above:
Sublime Text build number
4191
Operating system & version
any
(Linux) Desktop environment and/or window manager
any
The text was updated successfully, but these errors were encountered: