I am using prettier with the plugin prettier-plugin-organize-imports. Using it with Zed is causing the format command to remove all generics from a tsx file.
Before:
import * as Headless from '@headlessui/react';
import { Link as RemixLink, type LinkProps } from '@remix-run/react';
import React, { forwardRef } from 'react';
export const Link = forwardRef(function Link(
props: { href: string | LinkProps['to'] } & Omit<LinkProps, 'to'>,
ref: React.ForwardedRef<HTMLAnchorElement>,
) {
return (
<Headless.DataInteractive>
<RemixLink {...props} to={props.href} ref={ref} />
</Headless.DataInteractive>
);
});
After formatting with Zed:
import * as Headless from '@headlessui/react';
import { Link as RemixLink, type LinkProps } from '@remix-run/react';
import React, { forwardRef } from 'react';
export const Link = forwardRef(function Link(
props: { href: string | LinkProps['to'] } & Omit,
ref: React.ForwardedRef,
) {
return (
<Headless.DataInteractive>
<RemixLink {...props} to={props.href} ref={ref} />
</Headless.DataInteractive>
);
});
This seems to work fine with the prettier cli. Output of npx prettier frontend/app/components/ui/link.tsx:
import * as Headless from '@headlessui/react';
import { Link as RemixLink, type LinkProps } from '@remix-run/react';
import React, { forwardRef } from 'react';
export const Link = forwardRef(function Link(
props: { href: string | LinkProps['to'] } & Omit<LinkProps, 'to'>,
ref: React.ForwardedRef<HTMLAnchorElement>,
) {
return (
<Headless.DataInteractive>
<RemixLink {...props} to={props.href} ref={ref} />
</Headless.DataInteractive>
);
});
Removing the plugin from my prettier config fixes the behaviour in Zed. Prettier config:
Note my prettier config is inside ./package.json, whereas the file is inside ./frontend/app/components/, the ./frontend folder also has a package.json.
Check for existing issues
Describe the bug / provide steps to reproduce it
I am using prettier with the plugin prettier-plugin-organize-imports. Using it with Zed is causing the format command to remove all generics from a
tsx
file.Before:
After formatting with Zed:
This seems to work fine with the prettier cli. Output of
npx prettier frontend/app/components/ui/link.tsx
:Removing the plugin from my prettier config fixes the behaviour in Zed. Prettier config:
Note my prettier config is inside
./package.json
, whereas the file is inside./frontend/app/components/
, the./frontend
folder also has a package.json.Environment
Zed: v0.145.0 (Zed Preview) OS: macOS 14.4.1 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log