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

Does not work properly for jsx/tsx react components #74

Open
evelant opened this issue Jul 18, 2024 · 1 comment
Open

Does not work properly for jsx/tsx react components #74

evelant opened this issue Jul 18, 2024 · 1 comment

Comments

@evelant
Copy link

evelant commented Jul 18, 2024

Describe the bug
When opening a .tsx file containing react (native) components Outline Map does not display correctly. It lists every attribute of every jsx prop as a top level property of the function returning the component.

To Reproduce
Open a .tsx file with content such as:

import { View, Text } from "react-native"
function Test() {
    const foo = "bar"
    return (
        <View style={{ marginLeft: 20, marginRight: 20 }}>
            <Text ref={{current: null}}>{foo}</Text>
        </View>
    )
}

Expected behavior
Outline map shows "Test" and "foo".

Actual Behavior
Outline map shows "Test", "foo", "marginLeft", "marginRight", "current"

Screenshots
image

@joshua-dean
Copy link
Contributor

The built-in vscode outline also produces these symbols, which means they're getting returned by vscode.executeDocumentSymbolProvider.
You can disable properties specifically for the vscode outline with the outline.showProperties setting, but this doesn't appear to apply to outline-map.
I'm guessing it would be a simple enough expansion to make outline-map read the outline. or breadcrumbs. settings, or expand outline-map.workspace.excludes to be able to filter by symbol type.

These aren't really complete solutions as they would hide all properties, including ones in object declarations. Excluding properties just in JSX/TSX is tricky - I don't know if the existing vscode API can provide everything necessary, or if a custom Document Symbol Provider would have to be built.

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

2 participants