tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
482 stars 38 forks source link

ENHANCEMENT: prop autofill #12

Closed CreaturesInUnitards closed 5 years ago

CreaturesInUnitards commented 5 years ago

It would be great if a component's exported parameters would be included in the HTML autocompletion. So f.e. if this is my component:

// MyComponent.svelte
<script>
  export let foo
  export let bar
</script>

When I type

<MyCom

into a consuming component and accept the autocompletion, I would then get

<MyComponent foo="" bar="" />

Some related nice-to-haves:

  1. the completions behave as Live Templates, with tab stops in between the quotes, e.g. foo="$foo$"
  2. the completions lay out any existing slots, or self-close the tag if there are none
tomblachut commented 5 years ago

Depends on #5.

A fine suggestion, yet some people (me included) would prefer to simply display completion dropdown after inserting consecutive props. Similar to handling of arguments to a function. One could also scan local identifiers and suggest for example

<MyComponent {foo} {bar} />
tomblachut commented 5 years ago

Hmm I'm gonna close this issue. @unlocomqx handled actual title in #28 Outstanding issue is

the completions lay out any existing slots, or self-close the tag if there are none Which is another thing altogether - a nice idea of course!