typescript-vscode-plugins icon indicating copy to clipboard operation
typescript-vscode-plugins copied to clipboard

`excludeNonJsxCompletions` will also exclude `forwardRef`

Open tjx666 opened this issue 1 year ago • 4 comments

for example:

import { forwardRef } from 'react';

import { StyledSvg } from '@/components/styledElements';
import { mergeSx } from '@/utils/style';

import type { IconProps } from './types';

/**
 * @see https://icones.js.org/collection/ph?icon=ph:smiley
 * @see https://api.iconify.design/ph:smiley
 */
const PhSmiley = forwardRef<SVGSVGElement, IconProps>(function PhSmiley(
  { size, color, sx, ...props },
  ref,
) {
  const sizePx = `${size}px`;
  return (
    <StyledSvg
      ref={ref}
      xmlns="http://www.w3.org/2000/svg"
      xmlnsXlink="http://www.w3.org/1999/xlink"
      width="16"
      height="16"
      viewBox="0 0 16 16"
      sx={mergeSx(
        {
          ...(size ? { width: sizePx, height: sizePx, fontSize: sizePx } : {}),
          color,
        },
        sx,
      )}
      {...props}
    >
      <path
        fill="currentColor"
        d="M8 1.5A6.5 6.5 0 1014.5 8 6.507 6.507 0 008 1.5m0 12A5.5 5.5 0 1113.5 8 5.506 5.506 0 018 13.5M5 6.75a.75.75 0 11.75.75.75.75 0 01-.75-.75m6 0a.75.75 0 11-.75-.75.75.75 0 01.75.75m-.067 3C10.29 10.862 9.221 11.5 8 11.5s-2.29-.637-2.932-1.75a.5.5 0 11.865-.5c.466.807 1.2 1.25 2.067 1.25s1.6-.444 2.067-1.25a.5.5 0 01.866.5"
      />
    </StyledSvg>
  );
});

export default PhSmiley;

tjx666 avatar Jun 25 '24 08:06 tjx666

btw forwardRef is deprecated (read react blog/docs), you should not be using it anymore

zardoy avatar Jun 25 '24 13:06 zardoy

I know, but need time to migrate...

tjx666 avatar Jun 25 '24 15:06 tjx666

For me it also excludes Text, FlatList, etc. from React Native. It also adds interfaces/types into suggestions (seems like not always, but one time I was able to repro). And, suggests things like textarea, etc. even though I'm in RN project (could check if expo or react-native package installed to skip those maybe?). Otherwise very very useful feature is just that I do see it is experiment for sure.

svipas avatar Dec 09 '24 20:12 svipas

Yes, we never tested it with react native afaik, this feature is generally outdated and needs to be updated, but it's kind of complex

zardoy avatar Dec 09 '24 22:12 zardoy