Skip to content
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

Outline Formatting not working as expected #684

Closed
nblyumberg opened this issue Mar 24, 2022 · 10 comments
Closed

Outline Formatting not working as expected #684

nblyumberg opened this issue Mar 24, 2022 · 10 comments

Comments

@nblyumberg
Copy link
Contributor

I am attempting to customize the outline view for XML files however, it does not appear to be working as expected. What I see after making my modifications...
image

I customized the settings.json and I reopen the file every time I update the settings.json
`{
"editor.fontSize": 14,
"editor.linkedEditing": true,
"workbench.colorTheme": "Default Dark+",

"remote.SSH.showLoginTerminal": true,
"remote.SSH.remotePlatform": {
    "devnixster01.imanheim.com": "linux"
},
"workbench.sideBar.location": "right",
"files.associations": {
    "*.bpml": "xml"
},
"security.workspace.trust.untrustedFiles": "open",
"redhat.telemetry.enabled": false,
"xml.codeLens.enabled": true,

"xml.symbols.enabled": true,
"xml.symbols.maxItemsComputed": 30000,
"xml.symbols.filters": [
    {
       "pattern": "*.{bpml,xml}",
       "expressions" :[
          {
            // Process Name
            "xpath": "//@name",
            "inlineAttribute" : true,
            "showAttributeName": false
         }
       ]
    }

]

}`

Sample XML I am trying to use:
`

	<operation name="Get BP MetaData">
		<participant name="BPMetaDataInfoService" />
		<output message="Xout">
			<assign to="DISPOSITION">false</assign>
			<assign to="LINKAGE">false</assign>
			<assign to="." from="*" />
		</output>
		<input message="Xin">
			<assign to="WORKSPACE/REPORT/SAVETILL" from="substring-before(BPDATA/WFD_LIFE_SPAN,' Minute(s)')" append="true"/>
			<assign to="WORKSPACE/REPORT/REPORTID" from="string(BPDATA/WFD_ID)" />
		</input>
	</operation>	</sequence>

`

@angelozerr
Copy link
Contributor

angelozerr commented Mar 25, 2022

I don't understand your XML sample. In your screenshot you show process, rule, condition, where are those elements in your XML sample?

@nblyumberg
Copy link
Contributor Author

image

I would expect the Outline to be populated with the names as this XPath test from FreeFormatter shows:
Attribute='name=my process'
Attribute='name=check condition'
Attribute='name=check condition2'
Attribute='name=Main'
Attribute='name=PreProcess'
Attribute='name=PreProcess'
Attribute='name=Invoke Business Process Service'

https://www.freeformatter.com/xpath-tester.html#ad-output

Here's the sample XML from the screenshot:

<process name="my process">
    <rule name="check condition">
        <condition>boolean(/ProcessData/NODE1</condition>
    </rule>
    <rule name="check condition2">
        <condition>boolean(/ProcessData/NODE2</condition>
    </rule>
    <sequence name="Main">
        <choice name="PreProcess">
            <select>
                <case ref="PreProcessBP"/>
            </select>
           <sequence name="PreProcess">
               <operation name="Invoke Business Process Service">
                   
               </operation>
           </sequence>
        </choice>
    </sequence>
</process>

@fbricon
Copy link
Collaborator

fbricon commented Mar 25, 2022

try with "pattern": "**/*.{bpml,xml}",

"xml.symbols.filters": [
        {
            "pattern": "**/*.{bpml,xml}",
            "expressions": [
                {
                    // Process Name
                    "xpath": "//@name",
                    "inlineAttribute": true,
                    "showAttributeName": false
                }
            ]
        }
    ]

@fbricon
Copy link
Collaborator

fbricon commented Mar 25, 2022

Screenshot 2022-03-25 at 16 27 26

@nblyumberg
Copy link
Contributor Author

Thank you, this worked...Can you explain why the directory boundry option is necessary with the extra **/ change?

@angelozerr
Copy link
Contributor

Indeed it can be annoying, perhaps we could allow to write only *.xml

@nblyumberg
Copy link
Contributor Author

@angelozerr I think an update to the documentation here:
https://github.com/redhat-developer/vscode-xml/blob/master/docs/Symbols.md#xmlsymbolsfilters

to explain the current behavior would be greatly helpful. I went by the example in that documentation where the pom.xml and bean*.xml are shown without the directory boundry configuration so I assumed *.bpml or *.xml would work that way as well.

@angelozerr
Copy link
Contributor

I totally agree with you. We need to update document. Is there any chance that you create a PR for that?

I will study why only *.xml is not working

@nblyumberg
Copy link
Contributor Author

I submitted a PR for just a "Note" added to Symbols.md for the time being since I am not sure how this will be handled (code changes, documentation clarification).

Thank you for all the help!

@angelozerr
Copy link
Contributor

angelozerr commented Sep 12, 2022

@nblyumberg I'm working again with pattern to support a new feature (validation filter which uses pattern), and after reading https://mincong.io/2019/04/16/glob-expression-understanding/#wildcard-expressions article I noticed that we can write just ** like **.{bpml,xml}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants