Skip to content

support adding import statements for entities reference in comments. #4792

Closed
@bsutton

Description

@bsutton

dart-code is very helpful when offering to add a missing import for a class of function.

However, if I reference an entity in a comment dart-code doesn't offer to import the required library.

/// see also: [PanelClipboards]

A lint error is generated:

[{
	"resource": "dvault_ui/lib/src/view/clipboard/clipboard_summary_card.dart",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": {
		"value": "comment_references",
		"target": {
			"$mid": 1,
			"external": "https://dart.dev/lints/comment_references",
			"path": "/lints/comment_references",
			"scheme": "https",
			"authority": "dart.dev"
		}
	},
	"severity": 2,
	"message": "The referenced name isn't visible in scope.\nTry adding an import for the referenced name.",
	"source": "dart",
	"startLineNumber": 11,
	"startColumn": 16,
	"endLineNumber": 11,
	"endColumn": 31
}]
`

To fix this we need a quick fix for `comment_references' that offers to import the required library.


Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris enhancementrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions