solidjs-community / solid-snippets

VSCode extension with helpful code snippets for SolidJS.
https://marketplace.visualstudio.com/items?itemName=solidjs-community.solid-snippets
MIT License
29 stars 2 forks source link

Add snippets for NORMAL functional components in tsx #12

Open andriemc opened 1 week ago

andriemc commented 1 week ago

I myself want to use function instead of const, but there isn't any snippets to do so (atleast in the tsx version)

thetarnav commented 1 week ago

I can see that feel free to propose some, if the snippets make sense I’ll add them

andriemc commented 1 week ago

I can see that feel free to propose some, if the snippets make sense I’ll add them

scompf

function ${1:${TM_FILENAME_BASE}}() {

  return (
    <div>${1:${TM_FILENAME_BASE}}</div>
  );
}

export default ${1:${TM_FILENAME_BASE}};

scompif

import { Component } from "solid-js";

function ${1:${TM_FILENAME_BASE}}(props): Component<{$2}> {
  $0
  return <div></div>;
};

export default ${1:${TM_FILENAME_BASE}};
thetarnav commented 1 week ago

I don't think function foo(props): Component<{}> is a valid component. But I like the f suffix.

andriemc commented 1 week ago

I don't think function foo(props): Component<{}> is a valid component. But I like the f suffix.

It is, in typescript (and thus tsx)