Skip to content

Show exported functions in auto-complete menu #307

@geoffrich

Description

@geoffrich

Is your feature request related to a problem? Please describe.
When binding to a component instance, I would like to have any exported functions available for auto-completion.

Describe the solution you'd like
Given the following components:

<!-- App.svelte -->
<script>
  import ClickTracker from "./ClickTracker.svelte";

  let componentRef;
</script>

<main>
  <ClickTracker bind:this={componentRef} />
  <button on:click={componentRef.track}>Click me</button>
</main>

<!-- ClickTracker.svelte -->
<script>
  export function track() {
    clicks++;
  }

  let clicks = 0;
</script>

<p>Clicks: {clicks}</p>

When operating on componentRef, I would like to see the track function show in the auto-complete menu.
image

Additional context
When using TypeScript with svelte-preprocess, referencing the track function shows the warning "Property 'track' does not exist on type 'ClickTracker__SvelteComponent_'.ts(2339)" under the componentRef.track reference. I think this could be related.

<!-- App.svelte -->
<script lang="ts">
  import ClickTracker from "./ClickTracker.svelte";

  let componentRef: ClickTracker;
</script>

<main>
  <ClickTracker bind:this={componentRef} />
  <button on:click={componentRef.track}>Click me</button>
</main>

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.feature requestNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions