Skip to content

Add better autocompletion for namespace components #2247

@kwangure

Description

@kwangure

Description

While writing compound components it's common to group them using name spaces.

Library:

// select.js
export { default as Option } from "./option.svelte";
export { default as Root } from "./select.svelte";

// index.js
export * as Select from "./select.js";

Usage:

<script>
	import { Select } from '$lib/components';
</script>

<Select.Root>
	<Select.Option>1</Select.Option>
	<Select.Option>2</Select.Option>
</Select.Root>

This issue is a request to better support namespace autocomplete for components like Select.

Proposed solution

For example, when using the select component, autocompletion should suggest Root and Option as the only options in the output. ATM the autocompletion list is not even related to the relevant namespace component being typed out.

<Select.Root>
	<!-- 
		Here `|` represents the position of the cursor. 
		Autocomplete should suggest `Option` and `Root` only 
	-->
	<Select.|
</Select.Root>

Alternatives

No response

Additional Information, eg. Screenshots

Autocompletion works fine in the <script/> but not in the markup section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions