Skip to content

Commit

Permalink
Version 3.7.0-11.0.dev
Browse files Browse the repository at this point in the history
Merge 280fd4c into dev
  • Loading branch information
Dart CI committed Oct 10, 2024
2 parents 17c2847 + 280fd4c commit 922ce19
Show file tree
Hide file tree
Showing 37 changed files with 1,716 additions and 1,548 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ vars = {
# EOL comment after a dependency to disable this and pin it at its current
# revision.

"args_rev": "e623652744c82533829f2e62b1aba1a6cf06e291", #
"args_rev": "09c0fca1785c9df39288a48f767994eed80bed40", #
"async_rev": "5f70a996f673d625e3502597084653686c3e754c",
"bazel_worker_rev": "aa3cc9e826350b960e0c5a67e6065bcedba8b0ac",
"benchmark_harness_rev": "44f125ae1d045aa3de09fe88a8dd70cb7352d563",
Expand Down
12 changes: 9 additions & 3 deletions pkg/_fe_analyzer_shared/test/mini_ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ class Harness {

late final Map<String, _PropertyElement?> _members = {
for (var entry in _coreMemberTypes.entries)
entry.key: _PropertyElement(entry.value,
entry.key: _PropertyElement(entry.value, entry.key.split('.').last,
isPromotable: false, whyNotPromotable: null)
};

Expand Down Expand Up @@ -1769,7 +1769,7 @@ class Harness {
_members[query] = null;
return;
}
_members[query] = _PropertyElement(Type(type),
_members[query] = _PropertyElement(Type(type), memberName,
isPromotable: promotable, whyNotPromotable: whyNotPromotable);
}

Expand Down Expand Up @@ -6209,6 +6209,12 @@ class _PropertyElement {
/// The type of the property.
final Type _type;

/// The name of the property (used by toString)
final String _name;

@override
String toString() => '$_type.$_name';

/// Whether the property is promotable.
final bool isPromotable;

Expand All @@ -6223,7 +6229,7 @@ class _PropertyElement {
/// to the test.
final PropertyNonPromotabilityReason? whyNotPromotable;

_PropertyElement(this._type,
_PropertyElement(this._type, this._name,
{required this.isPromotable, required this.whyNotPromotable}) {
if (isPromotable) {
assert(whyNotPromotable == null);
Expand Down
12 changes: 6 additions & 6 deletions pkg/analysis_server/lib/src/lsp/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const dartSignatureHelpTriggerCharacters = <String>['('];
/// Characters to trigger formatting when format-on-type is enabled.
const dartTypeFormattingCharacters = ['}', ';'];

/// A [TextDocumentFilterWithScheme] for Analysis Options files.
final analysisOptionsFile = TextDocumentFilterWithScheme(
/// A [TextDocumentFilterScheme] for Analysis Options files.
final analysisOptionsFile = TextDocumentFilterScheme(
language: 'yaml', scheme: 'file', pattern: '**/analysis_options.yaml');

/// A [ProgressToken] used for reporting progress while the server is analyzing.
Expand All @@ -73,14 +73,14 @@ final fileOperationRegistrationOptions = FileOperationRegistrationOptions(
],
);

/// A [TextDocumentFilterWithScheme] for Fix Data files.
final fixDataFile = TextDocumentFilterWithScheme(
/// A [TextDocumentFilterScheme] for Fix Data files.
final fixDataFile = TextDocumentFilterScheme(
language: 'yaml',
scheme: 'file',
pattern: '**/lib/{fix_data.yaml,fix_data/**.yaml}');

/// A [TextDocumentFilterWithScheme] for Pubspec files.
final pubspecFile = TextDocumentFilterWithScheme(
/// A [TextDocumentFilterScheme] for Pubspec files.
final pubspecFile = TextDocumentFilterScheme(
language: 'yaml', scheme: 'file', pattern: '**/pubspec.yaml');

/// IDs of client-provided commands that the server knows about.
Expand Down
23 changes: 11 additions & 12 deletions pkg/analysis_server/lib/src/lsp/handlers/handler_completion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class CompletionHandler

/// Computes all supported defaults for completion items based on
/// [capabilities].
CompletionListItemDefaults? _computeCompletionDefaults(
CompletionItemDefaults? _computeCompletionDefaults(
LspClientCapabilities capabilities,
Range insertionRange,
Range replacementRange,
Expand All @@ -258,7 +258,7 @@ class CompletionHandler
return null;
}

return CompletionListItemDefaults(
return CompletionItemDefaults(
insertTextMode:
capabilities.completionDefaultTextMode ? InsertTextMode.asIs : null,
editRange: _computeDefaultEditRange(
Expand All @@ -268,7 +268,7 @@ class CompletionHandler

/// Computes the default completion edit range based on [capabilities] and
/// whether the insert/replacement ranges differ.
Either2<CompletionItemEditRange, Range>? _computeDefaultEditRange(
Either2<EditRangeWithInsertReplace, Range>? _computeDefaultEditRange(
LspClientCapabilities capabilities,
Range insertionRange,
Range replacementRange,
Expand All @@ -279,10 +279,10 @@ class CompletionHandler

if (!capabilities.insertReplaceCompletionRanges ||
insertionRange == replacementRange) {
return Either2<CompletionItemEditRange, Range>.t2(replacementRange);
return Either2<EditRangeWithInsertReplace, Range>.t2(replacementRange);
} else {
return Either2<CompletionItemEditRange, Range>.t1(
CompletionItemEditRange(
return Either2<EditRangeWithInsertReplace, Range>.t1(
EditRangeWithInsertReplace(
insert: insertionRange,
replace: replacementRange,
),
Expand All @@ -306,7 +306,7 @@ class CompletionHandler
required int offset,
required LineInfo lineInfo,
required bool Function(String input) filter,
CompletionListItemDefaults? defaults,
CompletionItemDefaults? defaults,
}) async {
var request = DartSnippetRequest(
unit: unit,
Expand Down Expand Up @@ -845,7 +845,7 @@ class CompletionRegistrations extends FeatureRegistration
previewCommitCharacters ? dartCompletionCommitCharacters : null,
resolveProvider: true,
completionItem:
CompletionOptionsCompletionItem(labelDetailsSupport: true),
ServerCompletionItemOptions(labelDetailsSupport: true),
),
),
(
Expand All @@ -862,7 +862,7 @@ class CompletionRegistrations extends FeatureRegistration
///
/// We use two dynamic registrations because for Dart we support trigger
/// characters but for other kinds of files we do not.
List<TextDocumentFilterWithScheme> get nonDartCompletionTypes {
List<TextDocumentFilterScheme> get nonDartCompletionTypes {
var pluginTypesExcludingDart =
pluginTypes.where((filter) => filter.pattern != '**/*.dart');

Expand All @@ -883,8 +883,7 @@ class CompletionRegistrations extends FeatureRegistration
allCommitCharacters:
previewCommitCharacters ? dartCompletionCommitCharacters : null,
resolveProvider: true,
completionItem:
CompletionOptionsCompletionItem(labelDetailsSupport: true),
completionItem: ServerCompletionItemOptions(labelDetailsSupport: true),
);

@override
Expand All @@ -908,7 +907,7 @@ class _CompletionResults {
/// Item defaults for completion items.
///
/// Defaults are only supported on Dart server items (not plugins).
final CompletionListItemDefaults? defaults;
final CompletionItemDefaults? defaults;

_CompletionResults({
this.rankedItems = const [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class InitializeMessageHandler

return success(InitializeResult(
capabilities: capabilities,
serverInfo: InitializeResultServerInfo(
serverInfo: ServerInfo(
name: 'Dart SDK LSP Analysis Server',
version: sdkVersion,
),
Expand Down
3 changes: 2 additions & 1 deletion pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class PrepareRenameHandler extends LspMessageHandler<TextDocumentPositionParams,
ServerErrorCodes.RenameNotValid, initStatus.problem!.message);
}

return success(TextDocumentPrepareRenameResult.t1(PlaceholderAndRange(
return success(
TextDocumentPrepareRenameResult.t1(PrepareRenamePlaceholder(
range: toRange(
unit.lineInfo,
// If the offset is set to -1 it means there is no location for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ class SemanticTokensRegistrations extends FeatureRegistration
ToJsonable? get options => SemanticTokensRegistrationOptions(
documentSelector: fullySupportedTypes,
legend: semanticTokenLegend.lspLegend,
full: Either2<bool, SemanticTokensOptionsFull>.t2(
SemanticTokensOptionsFull(delta: false),
full: Either2<bool, SemanticTokensFullDelta>.t2(
SemanticTokensFullDelta(delta: false),
),
range: Either2<bool, SemanticTokensOptionsRange>.t1(true),
);
Expand All @@ -173,7 +173,7 @@ class SemanticTokensRegistrations extends FeatureRegistration
StaticOptions get staticOptions => Either2.t1(
SemanticTokensOptions(
legend: semanticTokenLegend.lspLegend,
full: Either2.t2(SemanticTokensOptionsFull(delta: false)),
full: Either2.t2(SemanticTokensFullDelta(delta: false)),
range: Either2.t1(true),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class TextDocumentRegistrations extends FeatureRegistration
@override
bool get supportsDynamic => clientDynamic.textSync;

List<TextDocumentFilterWithScheme> get synchronisedTypes {
List<TextDocumentFilterScheme> get synchronisedTypes {
return {
...fullySupportedTypes,
pubspecFile,
Expand Down
6 changes: 3 additions & 3 deletions pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LspAnalysisServer extends AnalysisServer {

/// Information about the connected client. Will be null prior to
/// initialization or if the client did not provide it.
InitializeParamsClientInfo? _clientInfo;
ClientInfo? _clientInfo;

/// Initialization options provided by the LSP client. Allows opting in/out of
/// specific server functionality. Will be null prior to initialization.
Expand Down Expand Up @@ -213,7 +213,7 @@ class LspAnalysisServer extends AnalysisServer {

/// Information about the connected editor client. Will be `null` prior to
/// initialization.
InitializeParamsClientInfo? get clientInfo => _clientInfo;
ClientInfo? get clientInfo => _clientInfo;

/// The name of the remote when the client is running using a remote workspace.
///
Expand Down Expand Up @@ -407,7 +407,7 @@ class LspAnalysisServer extends AnalysisServer {

void handleClientConnection(
ClientCapabilities capabilities,
InitializeParamsClientInfo? clientInfo,
ClientInfo? clientInfo,
Object? initializationOptions,
) {
_clientCapabilities = LspClientCapabilities(capabilities);
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/lib/src/lsp/mapping.dart
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ lsp.CompletionItem snippetToCompletionItem(
LineInfo lineInfo,
Position position,
Snippet snippet,
CompletionListItemDefaults? defaults,
CompletionItemDefaults? defaults,
) {
assert(capabilities.completionSnippets);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ abstract class FeatureRegistration {
ClientDynamicRegistrations get clientDynamic => _context.clientDynamic;

/// A set of filters for the currently supported Dart files.
List<TextDocumentFilterWithScheme> get dartFiles => _context.dartFilters;
List<TextDocumentFilterScheme> get dartFiles => _context.dartFilters;

/// Gets all dynamic registrations for this feature.
///
Expand All @@ -69,15 +69,15 @@ abstract class FeatureRegistration {
/// File types like pubspec.yaml, analysis_options.yaml and fix_data files are
/// not included here as their support is very limited and do not provide
/// functionality in most handlers.
List<TextDocumentFilterWithScheme> get fullySupportedTypes {
List<TextDocumentFilterScheme> get fullySupportedTypes {
return {
...dartFiles,
...pluginTypes,
}.toList();
}

/// Types of documents that loaded plugins are interested in.
List<TextDocumentFilterWithScheme> get pluginTypes => _context.pluginTypes;
List<TextDocumentFilterScheme> get pluginTypes => _context.pluginTypes;

/// Whether both the client, and this feature, support dynamic registration.
bool get supportsDynamic;
Expand Down Expand Up @@ -191,7 +191,7 @@ class RegistrationContext {
final ClientDynamicRegistrations clientDynamic;

/// Types of documents that loaded plugins are interested in.
final List<TextDocumentFilterWithScheme> pluginTypes;
final List<TextDocumentFilterScheme> pluginTypes;

/// The capabilities of the client.
final LspClientCapabilities clientCapabilities;
Expand All @@ -200,7 +200,7 @@ class RegistrationContext {
final LspClientConfiguration clientConfiguration;

/// Filters for all Dart files supported by the current server.
final List<TextDocumentFilterWithScheme> dartFilters;
final List<TextDocumentFilterScheme> dartFilters;

/// Custom schemes supported for Dart files by the current server.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ServerCapabilitiesComputer {

ServerCapabilitiesComputer(this._server);

List<TextDocumentFilterWithScheme> get pluginTypes => AnalysisServer
List<TextDocumentFilterScheme> get pluginTypes => AnalysisServer
.supportsPlugins
? _server.pluginManager.plugins
.expand(
Expand All @@ -156,9 +156,9 @@ class ServerCapabilitiesComputer {
// interestingFiles. Prefix a `**/` so that the glob matches nested
// folders as well.
.map((glob) =>
TextDocumentFilterWithScheme(scheme: 'file', pattern: '**/$glob'))
TextDocumentFilterScheme(scheme: 'file', pattern: '**/$glob'))
.toList()
: <TextDocumentFilterWithScheme>[];
: <TextDocumentFilterScheme>[];

ServerCapabilities computeServerCapabilities(
LspClientCapabilities clientCapabilities,
Expand Down Expand Up @@ -194,7 +194,7 @@ class ServerCapabilitiesComputer {
typeHierarchyProvider: features.typeHierarchy.staticRegistration,
executeCommandProvider: features.executeCommand.staticRegistration,
workspaceSymbolProvider: features.workspaceSymbol.staticRegistration,
workspace: ServerCapabilitiesWorkspace(
workspace: WorkspaceOptions(
workspaceFolders: WorkspaceFoldersServerCapabilities(
supported: true,
changeNotifications: features.changeNotifications.staticRegistration,
Expand Down Expand Up @@ -336,7 +336,7 @@ class ServerCapabilitiesComputer {
'file',
..._server.uriConverter.supportedNonFileSchemes
})
TextDocumentFilterWithScheme(language: 'dart', scheme: scheme)
TextDocumentFilterScheme(language: 'dart', scheme: scheme)
],
pluginTypes: pluginTypes,
);
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/test/lsp/completion_dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4907,7 +4907,7 @@ abstract class SnippetCompletionTest extends AbstractLspAnalysisServerTest

/// Expect that there is a snippet for [prefix] with the label [label] at
/// [position] in [content].
Future<({CompletionItem snippet, CompletionListItemDefaults? defaults})>
Future<({CompletionItem snippet, CompletionItemDefaults? defaults})>
expectSnippet(
TestCode code, {
required String prefix,
Expand Down
8 changes: 4 additions & 4 deletions pkg/analysis_server/test/lsp/document_changes_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class Bar {
if (!AnalysisServer.supportsPlugins) return;
await _initializeAndOpen();
await changeFile(2, mainFileUri, [
TextDocumentContentChangeEvent.t1(TextDocumentContentChangeEvent1(
TextDocumentContentChangeEvent.t1(TextDocumentContentChangePartial(
range: Range(
start: Position(line: 0, character: 6),
end: Position(line: 0, character: 9)),
text: 'Bar',
)),
TextDocumentContentChangeEvent.t1(TextDocumentContentChangeEvent1(
TextDocumentContentChangeEvent.t1(TextDocumentContentChangePartial(
range: Range(
start: Position(line: 1, character: 21),
end: Position(line: 1, character: 24)),
Expand All @@ -63,13 +63,13 @@ class Bar {
Future<void> test_documentChange_updatesOverlay() async {
await _initializeAndOpen();
await changeFile(2, mainFileUri, [
TextDocumentContentChangeEvent.t1(TextDocumentContentChangeEvent1(
TextDocumentContentChangeEvent.t1(TextDocumentContentChangePartial(
range: Range(
start: Position(line: 0, character: 6),
end: Position(line: 0, character: 9)),
text: 'Bar',
)),
TextDocumentContentChangeEvent.t1(TextDocumentContentChangeEvent1(
TextDocumentContentChangeEvent.t1(TextDocumentContentChangePartial(
range: Range(
start: Position(line: 1, character: 21),
end: Position(line: 1, character: 24)),
Expand Down
Loading

0 comments on commit 922ce19

Please sign in to comment.