Skip to content

React support for useCodeSnippetsOnMethodSuggest #48562

Closed

Description

@lifehackett
  • VSCode Version: 1.22.2
  • OS Version: macOS High Sierra 10.13.4
  • Does this issue occur when all extensions are disabled?: Yes

I would like to propose support for the "useCodeSnippetsOnMethodSuggest" capability with React components. Given a TS definition like this

import React from 'react';

interface LabelProps {
  text: string;
  onClick(): void;
  color?: string;
}

declare class Label extends React.Component<LabelProps, any> {}

export default Label;

I would like to be able to import Label into another component, type <Label and press TAB, like you can for regular JS functions, and have it enter a snippet with all required props (i.e. not optional) prefilled and tab stops for each value

Example:

<Label text="$1" isDisabled={$2} $0 />

$1 - first tab stop. Surrounded by quotes because it is a string
$2 - second tab stop. Surrounded by braces because it is a function
$0 - final stop, for entering optional parameters

What are your thoughts?

Activity

  1. added
    feature-requestRequest for new features or functionality
    upstreamIssue identified as 'upstream' component related (exists outside of VS Code)
    on Jun 21, 2018
  2. mjbvz commented on Jun 25, 2018

    @mjbvz
    Contributor

    I like the idea. Requires some upstream work though: microsoft/TypeScript#25207

  3. chadgarlandscg commented on Aug 4, 2018

    @chadgarlandscg

    This would be really amazing to have! It was the best part about Webstorm, but I vastly prefer using VS Code (it's so much faster!). Matt Bierner (@mjbvz) Is there any ETA on this feature? 🙏

  4. mjbvz commented on Oct 3, 2020

    @mjbvz
    Contributor

    Closing this in favor of the upstream issue: microsoft/TypeScript#25207

    We will continue discussion there

  5. locked and limited conversation to collaborators on Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionalityjavascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)upstream-issue-linkedThis is an upstream issue that has been reported upstream

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions