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

No way to format document symbols and outline with custom symbol filters #633

Closed
twoseascharlie opened this issue Jan 7, 2022 · 5 comments
Milestone

Comments

@twoseascharlie
Copy link
Contributor

There doesn't appear to be a way to control the way custom symbol filter rules are displayed in the outline.

Ex:
using this config:

        {
            "pattern": "build*.xml",
            "expressions" :[
                {
                    "xpath": "//target/@name"
                },
                {
                    "xpath": "//text()"
                }
            ]
        }

If I have a symbol filter for text, it is shown next to the element in the outline:

text

If I have a symbol filter for an attribute, it is shown as a child element in the outline:

targetAttribute

For an extension that has great customizability, this seems like a missing customization point. I would love the ability to move the attribute in the outline to the same line as the xml element.

@angelozerr
Copy link
Contributor

What is your suggestion to customize that?

@twoseascharlie
Copy link
Contributor Author

I think I would see it working 1 of 2 ways:

Option 1:
Introduce a new preference that allows for single attribute symbol filters to be on the same line as their element.
ex:
xml.symbols.filters.singleAttributePosition: 'sameLine' | 'nestedLine'

Or
2. Introduce a new "format" field to the "expression" object for attribute selectors that could control the position and whether to show the attribute value only (and not the attribute name).
ex:

        {
            "pattern": "build*.xml",
            "expressions" :[
                {
                    "xpath": "//target/@name",
                    "format": 
                            {
                                // keep the value of the attribute "name" on the same line
                                // as the target element, and only show the attribute value
                                "position": "sameLine",
                                "valueOnly": true
                            }
                },
                {
                    "xpath": "//text()"
                }
            ]
        }

Example mocked up screenshot:

targetAttribute2

I would think this specific case would only be applied when there is only 1 attribute being shown in the outline. For cases where there is more than 1 attribute, I certainly understand it making sense to show them nested under their elements.

For my specific use of this, it would be very helpful to be able to quickly see all the target names in my build.xml file (and it would be nice for all the property names too). But I could certainly see this kind of customization point being useful for other xml based files as well.

@angelozerr
Copy link
Contributor

angelozerr commented Jan 10, 2022

Ok I see the idea thanks. For the moment, I don't know when we will able to implement this feature.

@twoseascharlie
Copy link
Contributor Author

Ok sounds good, I appreciate you taking a look at this :)

twoseascharlie added a commit to twoseascharlie/lemminx that referenced this issue Jan 13, 2022
proposed server side fix for:
redhat-developer/vscode-xml#633

if the change looks like a good approach, automated tests
and documentation updates will follow in a separate commit
twoseascharlie added a commit to twoseascharlie/vscode-xml that referenced this issue Jan 18, 2022
client side documentation update for:
redhat-developer#633

this PR is dependent on the server side PR:
eclipse/lemminx#1151
twoseascharlie added a commit to twoseascharlie/vscode-xml that referenced this issue Jan 19, 2022
client side documentation update for:
redhat-developer#633

this PR is dependent on the server side PR:
eclipse/lemminx#1151

updating commits for gpg sig, sorry for the noise
fbricon pushed a commit to eclipse/lemminx that referenced this issue Jan 24, 2022
proposed server side fix for: 
redhat-developer/vscode-xml#633


Signed-off-by: Charlie Cadwell <twoseascharlie@gmail.com>
fbricon pushed a commit that referenced this issue Jan 24, 2022
client side documentation update for:
#633

this PR is dependent on the server side PR:
eclipse/lemminx#1151
@twoseascharlie
Copy link
Contributor Author

Closing this issue as this has been implemented with:
#636
eclipse/lemminx/#1151

@rgrunber rgrunber added this to the 0.18.3 milestone Jan 28, 2022
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