Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-imports not working for extension members #4143

Closed
DanTup opened this issue Sep 5, 2022 · 2 comments
Closed

Auto-imports not working for extension members #4143

DanTup opened this issue Sep 5, 2022 · 2 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@DanTup
Copy link
Member

DanTup commented Sep 5, 2022

Using a recent nightly (which uses NotImportedContributor), completing on firstOrNull from package:collection does not add the import statement:

Screenshot 2022-09-05 at 16 56 06

Importing on something else (like calculate() from the default command line project) does insert the import statement.

@DanTup DanTup added is bug in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server labels Sep 5, 2022
@DanTup DanTup added this to the v3.50.0 milestone Sep 5, 2022
@DanTup
Copy link
Member Author

DanTup commented Sep 5, 2022

Seems to be failing to resolve. Completion:

{
	"data": {
		"file": "/Users/danny/Desktop/dart_samples/autoimportextension/lib/a.dart",
		"libraryUri": "package:collection/collection.dart"
	},
	"detail": "T?",
	"kind": 10,
	"label": "firstOrNull",
	"sortText": "9999497",
	"textEdit": {
		"newText": "firstOrNull",
		"range": {
			"end": {
				"character": 19,
				"line": 2
			},
			"start": {
				"character": 12,
				"line": 2
			}
		}
	}
}

Resolve response:

{
	"id": 10,
	"jsonrpc": "2.0",
	"error": {
		"code": -32602,
		"data": "firstOrNull",
		"message": "No such element: firstOrNull in package:collection/collection.dart"
	}
}

@DanTup DanTup changed the title auto-imports not working for extension members Auto-imports not working for extension members Sep 5, 2022
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Sep 6, 2022
…tension members

Fixes Dart-Code/Dart-Code#4143.

Change-Id: I3c5a6d3bd60a6e1b5b4e432367c24deb41309f6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@DanTup
Copy link
Member Author

DanTup commented Sep 6, 2022

Fixed by dart-lang/sdk@1c8bb85.

@DanTup DanTup closed this as completed Sep 6, 2022
@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Sep 6, 2022
@DanTup DanTup modified the milestones: v3.50.0, Requires SDK Release Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

1 participant