Skip to content

React support for useCodeSnippetsOnMethodSuggest #48562

Closed
@lifehackett

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?

Metadata

Metadata

Assignees

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