Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Improvements to Symbols Tree in React components #21283

Closed
1 task done
maclong9 opened this issue Nov 28, 2024 · 4 comments
Closed
1 task done

Improvements to Symbols Tree in React components #21283

maclong9 opened this issue Nov 28, 2024 · 4 comments
Labels
feature [core label] javascript JavaScript programming language support language An umbrella label for all programming languages syntax behaviors outline Feedback for outline view, symbols, etc typescript TypeScript programming language support

Comments

@maclong9
Copy link

maclong9 commented Nov 28, 2024

Check for existing issues

  • Completed

Describe the feature

The symbols tree in React pages and components is a little lackluster, it would be great to have a more detailed outline of the component I am working on, for example see the Zed symbols tree compared to JetBrains Fleet's for the same file:

Screenshot 2024-11-28 at 14 37 36 Screenshot 2024-11-28 at 14 37 47

Environment

Zed: v0.163.2 (Zed)
OS: macOS 15.1.0
Memory: 18 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@JosephTLyons JosephTLyons added typescript TypeScript programming language support javascript JavaScript programming language support language An umbrella label for all programming languages syntax behaviors outline Feedback for outline view, symbols, etc and removed triage labels Dec 3, 2024
@maxbrunsfeld
Copy link
Collaborator

Can you share the source file for this example?

@maclong9
Copy link
Author

maclong9 commented Dec 5, 2024

Hey @maxbrunsfeld sorry about the delay, here is a subset of the source file as it's quite a large file:

/**
 * Builder component that renders a page based on the given `content` array.
 *
 * The `content` array is expected to be an array of objects with a `_type`
 * property that determines which component to render.
 */
const Builder = async ({ content }: BuilderProps) => {
  const siteSettings = await getSiteSettings();

  return (
    <>
      {content?.map(async (block, index) => {
        switch (block._type) {
          // Hero Carousel
          case "heroCarousel":
            return (
              <HeroCarousel
                key={index}
                slides={block.slides || []}
                isRolex={isRolex}
              />
            );

          // Featured Items
          case "featuredItems":
            return <FeaturedItems key={index} items={block.items || []} />;

          // Image Call to Action
          case "imageCta":
            return (
              <ImageCta
                key={index}
                imageSrc={
                  urlFor(block.image || { _type: "image" })?.url() as string
                }
                imageAlt={block.title as string}
                title={block.title as string}
                description={block.description as string}
                linkHref={block.href as string}
                linkText={block.text as string}
              />
            );

          default:
            return null;
        }
      })}
    </>
  )
};

export default Builder;

@maxbrunsfeld
Copy link
Collaborator

Ok, so the idea is that we'd include an outline entry for every JSX element expression?

@maclong9
Copy link
Author

maclong9 commented Dec 5, 2024

Pretty much with obvious folding at the root of each nested tree of elements.

Just makes navigating a react file a little more convenient when you can jump to symbols.

@zed-industries zed-industries locked and limited conversation to collaborators Jan 31, 2025
@JosephTLyons JosephTLyons converted this issue into discussion #24001 Jan 31, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
feature [core label] javascript JavaScript programming language support language An umbrella label for all programming languages syntax behaviors outline Feedback for outline view, symbols, etc typescript TypeScript programming language support
Projects
None yet
Development

No branches or pull requests

3 participants