Closed Serhioromano closed 4 years ago
I have successfully accomplished highlights of ST language in markdown. Now I want to do the same in XML.
I have this example
<?xml version="1.0" encoding="utf-8"?> <TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.0"> <DUT Name="ST_StateMachine" Id="{55662db1-7baf-4d79-8020-5daec45ea678}"> <Declaration><![CDATA[TYPE ST_StateMachine : STRUCT uiInit : UINT; uiReady : UINT; uiBusy : UINT; uiWaiting : UINT; uiIdle : UINT; uiError : UINT; END_STRUCT END_TYPE ]]></Declaration> </DUT> </TcPlcObject>
xml.codeblock.json
{ "fileTypes": [], "injectionSelector": "L:text.xml", "patterns": [ { "include": "#xml-code-block" } ], "repository": { "xml-code-block": { "begin": "(<)(Declaration|ST)(>)\\s*", "end": "\\s*(<\\/)(\\2)(>)$", "beginCaptures": { "1": { "name": "punctuation.definition.tag.xml" }, "3": { "name": "punctuation.definition.tag.xml" }, "2": { "name": "entity.name.tag.localname.xml" } }, "endCaptures": { "1": { "name": "punctuation.definition.tag.xml" }, "3": { "name": "punctuation.definition.tag.xml" }, "2": { "name": "entity.name.tag.localname.xml" } }, "patterns": [ { "begin": "\\s*(<!\\[CDATA\\[)\\s*", "end": "\\s*(\\]\\]>)", "beginCaptures": { "1": { "name": "string.unquoted.cdata.xml" } }, "endCaptures": { "1": { "name": "string.unquoted.cdata.xml" } }, "contentName": "meta.embedded.block.iecst", "patterns": [ { "include": "source.st" } ] } ] } }, "scopeName": "xml.iecst.codeblock" }
project.json
"grammars": [ { "scopeName": "source.st", "language": "st", "path": "./syntaxes/st.tmLanguage.json" }, { "scopeName": "markdown.iecst.codeblock", "path": "./syntaxes/md.codeblock.json", "injectTo": [ "text.html.markdown" ], "embeddedLanguages": { "meta.embedded.block.iecstmd": "st" } }, { "scopeName": "xml.iecst.codeblock", "path": "./syntaxes/xml.codeblock.json", "injectTo": [ "text.xml" ], "embeddedLanguages": { "meta.embedded.block.iecstxml": "st" } } ],
Everything works fine except thing I cannot understand.
Look somehow second declaration tag does not work and if I change PROTECTED key it works. If I change LIBRARY to FUNCTION_BLOCK for example it works.
LIBRARY
FUNCTION_BLOCK
I have no idea where to dig. Could you please help me?
Try asking for help on Stack Overflow. I don't have time to debug the grammar but if you feel there is a bug with this project, please create a minimal repo so we can investigate
I have successfully accomplished highlights of ST language in markdown. Now I want to do the same in XML.
I have this example
xml.codeblock.json
fileproject.json
Everything works fine except thing I cannot understand.
Look somehow second declaration tag does not work and if I change PROTECTED key it works. If I change
LIBRARY
toFUNCTION_BLOCK
for example it works.I have no idea where to dig. Could you please help me?