Skip to content

Provide settings to disable snippets in completion lists #2625

@svipas

Description

@svipas

As I can see you have this class https://github.com/Dart-Code/Dart-Code/blob/684a3ad5f15529e507139f95b9617240ec20a56a/src/extension/providers/snippet_completion_item_provider.ts which registers snippets to the completion provider. And you're using snippets/dart.json and snippets/flutter.json in here

// Snippets are language-specific
. In my opinion this is redundant because VS Code handles snippets automatically if you add them into package.json file like this:

		"snippets": [
			{
				"language": "dart",
				"path": "./snippets/dart.json"
			},
			{
				"language": "dart",
				"path": "./snippets/flutter.json"
			}
		]

The issue with registering them inside extension itself by using completion provider removes ability to use Control Snippets extension which gives ability to disable/enable snippets.

My suggestions is to simply remove SnippetCompletionItemProvider class and also registration in extension.ts for flutter and dart snippets and simply add snippets in package.json as mentioned above. This gives ability to easy control snippets and it uses default VS Code mechanism.

Also, it would be cool to separate snippets for dart and flutter into their repos/extension dirs. Keep snippets/dart.json in this repo https://github.com/Dart-Code/Dart-Code and move snippets/flutter.json to this repo https://github.com/Dart-Code/Flutter since they are different tools and it gives ability to easily disable/enable snippets for Dart and Flutter separately.

I hope it makes sense, if needed I could provide a PR. Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions