mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[analysis_server]/[analyzer] Change package_path alias -> path
Change-Id: Ia4848e6b87433401be95a4e74c7681a1c983c12f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313568 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
d3e5252c01
commit
ea790e901c
|
@ -14,7 +14,7 @@ import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
|
|||
import 'package:analyzer/src/dart/element/type_system.dart';
|
||||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// Computer for dart:ui/Flutter Color references.
|
||||
class ColorComputer {
|
||||
|
@ -23,7 +23,7 @@ class ColorComputer {
|
|||
final List<ColorReference> _colors = [];
|
||||
final Flutter _flutter = Flutter.instance;
|
||||
|
||||
ColorComputer(this.resolvedUnit, package_path.Context pathContext)
|
||||
ColorComputer(this.resolvedUnit, path.Context pathContext)
|
||||
: _linterContext = LinterContextImpl(
|
||||
[], // unused
|
||||
LinterContextUnit(resolvedUnit.content, resolvedUnit.unit),
|
||||
|
|
|
@ -14,7 +14,7 @@ import 'package:analyzer/dart/element/element.dart';
|
|||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer/source/line_info.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// A computer for LSP Inlay Hints.
|
||||
///
|
||||
|
@ -22,7 +22,7 @@ import 'package:path/path.dart' as package_path;
|
|||
/// argument names where they are not already explicitly present in the source
|
||||
/// but are being inferred.
|
||||
class DartInlayHintComputer {
|
||||
final package_path.Context pathContext;
|
||||
final path.Context pathContext;
|
||||
final LineInfo _lineInfo;
|
||||
final CompilationUnit _unit;
|
||||
final bool _isNonNullableByDefault;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import 'package:analysis_server/src/computer/computer_hover.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// Provides access to both global and resource-specific client configuration.
|
||||
///
|
||||
|
@ -19,7 +19,7 @@ import 'package:path/path.dart' as package_path;
|
|||
/// still in development and users are not encouraged to try (but may be useful
|
||||
/// for Dart developers to enable for development/testing).
|
||||
class LspClientConfiguration {
|
||||
final package_path.Context pathContext;
|
||||
final path.Context pathContext;
|
||||
|
||||
/// Global settings for the workspace.
|
||||
///
|
||||
|
@ -111,8 +111,8 @@ class LspClientConfiguration {
|
|||
}
|
||||
|
||||
/// Normalises a folder path to never have a trailing path separator.
|
||||
String _normaliseFolderPath(String path) =>
|
||||
path.replaceAll(_trailingSlashPattern, '');
|
||||
String _normaliseFolderPath(String filePath) =>
|
||||
filePath.replaceAll(_trailingSlashPattern, '');
|
||||
}
|
||||
|
||||
/// Wraps the client (editor) configuration to provide stronger typing and
|
||||
|
|
|
@ -19,7 +19,7 @@ import 'package:analyzer/src/util/performance/operation_performance.dart';
|
|||
import 'package:analyzer/src/utilities/cancellation.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol.dart';
|
||||
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
export 'package:analyzer/src/utilities/cancellation.dart';
|
||||
|
||||
|
@ -72,7 +72,7 @@ mixin Handler<T> {
|
|||
/// Provides some helpers for request handlers to produce common errors or
|
||||
/// obtain resolved results after waiting for in-progress analysis.
|
||||
mixin HandlerHelperMixin<S extends AnalysisServer> {
|
||||
package_path.Context get pathContext => server.resourceProvider.pathContext;
|
||||
path.Context get pathContext => server.resourceProvider.pathContext;
|
||||
|
||||
S get server;
|
||||
|
||||
|
@ -106,7 +106,7 @@ mixin HandlerHelperMixin<S extends AnalysisServer> {
|
|||
}
|
||||
try {
|
||||
final context = server.resourceProvider.pathContext;
|
||||
final isWindows = context.style == package_path.Style.windows;
|
||||
final isWindows = context.style == path.Style.windows;
|
||||
|
||||
// Use toFilePath() here and not context.fromUri() because they're not
|
||||
// quite the same. `toFilePath()` will throw for some kinds of invalid
|
||||
|
|
|
@ -51,7 +51,7 @@ import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin;
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// Instances of the class [LspAnalysisServer] implement an LSP-based server
|
||||
/// that listens on a [CommunicationChannel] for LSP messages and processes
|
||||
|
@ -247,7 +247,7 @@ class LspAnalysisServer extends AnalysisServer {
|
|||
};
|
||||
}
|
||||
|
||||
package_path.Context get pathContext => resourceProvider.pathContext;
|
||||
path.Context get pathContext => resourceProvider.pathContext;
|
||||
|
||||
@override
|
||||
set pluginManager(PluginManager value) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import 'package:analyzer/src/dart/analysis/search.dart' as server
|
|||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin;
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
const languageSourceName = 'dart';
|
||||
|
||||
|
@ -96,7 +96,7 @@ lsp.WorkspaceEdit createPlainWorkspaceEdit(
|
|||
|
||||
/// Create a [WorkspaceEdit] that renames [oldPath] to [newPath].
|
||||
WorkspaceEdit createRenameEdit(
|
||||
package_path.Context pathContext, String oldPath, String newPath) {
|
||||
path.Context pathContext, String oldPath, String newPath) {
|
||||
final changes =
|
||||
<Either4<CreateFile, DeleteFile, RenameFile, TextDocumentEdit>>[];
|
||||
|
||||
|
@ -518,7 +518,7 @@ lsp.LocationLink? navigationTargetToLocationLink(
|
|||
}
|
||||
|
||||
lsp.Diagnostic pluginToDiagnostic(
|
||||
package_path.Context pathContext,
|
||||
path.Context pathContext,
|
||||
server.LineInfo? Function(String) getLineInfo,
|
||||
plugin.AnalysisError error, {
|
||||
required Set<lsp.DiagnosticTag>? supportedTags,
|
||||
|
@ -567,7 +567,7 @@ lsp.Diagnostic pluginToDiagnostic(
|
|||
}
|
||||
|
||||
lsp.DiagnosticRelatedInformation? pluginToDiagnosticRelatedInformation(
|
||||
package_path.Context pathContext,
|
||||
path.Context pathContext,
|
||||
server.LineInfo? Function(String) getLineInfo,
|
||||
plugin.DiagnosticMessage message) {
|
||||
final file = message.location.file;
|
||||
|
@ -995,7 +995,7 @@ lsp.CompletionItem toCompletionItem(
|
|||
}
|
||||
|
||||
lsp.Diagnostic toDiagnostic(
|
||||
package_path.Context pathContext,
|
||||
path.Context pathContext,
|
||||
server.ResolvedUnitResult result,
|
||||
server.AnalysisError error, {
|
||||
required Set<lsp.DiagnosticTag> supportedTags,
|
||||
|
@ -1088,8 +1088,8 @@ List<lsp.DocumentHighlight> toHighlights(
|
|||
.toList();
|
||||
}
|
||||
|
||||
lsp.Location toLocation(package_path.Context pathContext,
|
||||
server.Location location, server.LineInfo lineInfo) =>
|
||||
lsp.Location toLocation(path.Context pathContext, server.Location location,
|
||||
server.LineInfo lineInfo) =>
|
||||
lsp.Location(
|
||||
uri: pathContext.toUri(location.file),
|
||||
range: toRange(
|
||||
|
|
|
@ -34,7 +34,7 @@ import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dar
|
|||
import 'package:analyzer_plugin/utilities/change_builder/change_workspace.dart';
|
||||
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
|
||||
import 'package:analyzer_plugin/utilities/range_factory.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// An object that can compute a correction (fix or assist) in a Dart file.
|
||||
abstract class CorrectionProducer<T extends ParsedUnitResult>
|
||||
|
@ -320,7 +320,7 @@ abstract class ResolvedCorrectionProducer
|
|||
return null;
|
||||
}
|
||||
|
||||
LinterContext getLinterContext(package_path.Context pathContext) {
|
||||
LinterContext getLinterContext(path.Context pathContext) {
|
||||
return LinterContextImpl(
|
||||
[], // unused
|
||||
LinterContextUnit(unitResult.content, unitResult.unit),
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'dart:io';
|
|||
|
||||
import 'package:analysis_server/src/utilities/process.dart';
|
||||
import 'package:analyzer/instrumentation/service.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// A class for interacting with the `pub` command.
|
||||
///
|
||||
|
@ -25,7 +25,7 @@ class PubCommand {
|
|||
'DART_SERVER_DISABLE_PUB_COMMAND';
|
||||
|
||||
final InstrumentationService _instrumentationService;
|
||||
final package_path.Context _pathContext;
|
||||
final path.Context _pathContext;
|
||||
late final ProcessRunner _processRunner;
|
||||
late final String _pubEnvironmentValue;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import 'package:analysis_server/lsp_protocol/protocol.dart';
|
||||
import 'package:analysis_server/src/lsp/constants.dart';
|
||||
import 'package:analysis_server/src/services/user_prompts/dart_fix_prompt_manager.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
@ -200,7 +200,7 @@ class ServerTest extends AbstractLspAnalysisServerTest {
|
|||
// file:///foo/bar.dart
|
||||
// is valid for non-Windows platforms, but not valid on Windows as it does
|
||||
// not have a drive letter.
|
||||
if (pathContext.style != package_path.Style.windows) {
|
||||
if (pathContext.style != path.Style.windows) {
|
||||
return;
|
||||
}
|
||||
// This code deliberately does not use pathContext because we're testing a
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:analyzer/file_system/file_system.dart';
|
|||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer_utilities/package_root.dart' as package_root;
|
||||
import 'package:analyzer_utilities/verify_tests.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
void main() {
|
||||
var provider = PhysicalResourceProvider.INSTANCE;
|
||||
|
@ -42,7 +42,7 @@ class _VerifyTests extends VerifyTests {
|
|||
}
|
||||
|
||||
// Allow for updating textual expectations.
|
||||
if (package_path.url.basename(uri) == 'text_expectations.dart') {
|
||||
if (path.url.basename(uri) == 'text_expectations.dart') {
|
||||
if (folder.path ==
|
||||
pathContext.join(testDirPath, 'services', 'completion', 'dart')) {
|
||||
return true;
|
||||
|
|
|
@ -40,7 +40,7 @@ import 'package:analyzer/src/workspace/workspace.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:convert/convert.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:pub_semver/pub_semver.dart';
|
||||
|
||||
/// The file has a `library augment` directive.
|
||||
|
@ -1166,7 +1166,7 @@ class FileSystemState {
|
|||
_testView = FileSystemStateTestView(this);
|
||||
}
|
||||
|
||||
package_path.Context get pathContext => resourceProvider.pathContext;
|
||||
path.Context get pathContext => resourceProvider.pathContext;
|
||||
|
||||
@visibleForTesting
|
||||
FileSystemStateTestView get test => _testView;
|
||||
|
|
|
@ -49,7 +49,7 @@ import 'package:analyzer/src/services/lint.dart';
|
|||
import 'package:analyzer/src/task/strong/checker.dart';
|
||||
import 'package:analyzer/src/util/performance/operation_performance.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
class AnalysisForCompletionResult {
|
||||
final CompilationUnit parsedUnit;
|
||||
|
@ -67,7 +67,7 @@ class LibraryAnalyzer {
|
|||
final DeclaredVariables _declaredVariables;
|
||||
final LibraryFileKind _library;
|
||||
final InheritanceManager3 _inheritance;
|
||||
final package_path.Context _pathContext;
|
||||
final path.Context _pathContext;
|
||||
|
||||
final LibraryElementImpl _libraryElement;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import 'package:analyzer/src/generated/engine.dart';
|
|||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:analyzer/src/workspace/workspace.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
/// Instances of the class `BestPracticesVerifier` traverse an AST structure
|
||||
/// looking for violations of Dart best practices.
|
||||
|
@ -105,7 +105,7 @@ class BestPracticesVerifier extends RecursiveAstVisitor<void> {
|
|||
required DeclaredVariables declaredVariables,
|
||||
required AnalysisOptions analysisOptions,
|
||||
required WorkspacePackage? workspacePackage,
|
||||
required package_path.Context pathContext,
|
||||
required path.Context pathContext,
|
||||
}) : _nullType = typeProvider.nullType,
|
||||
_typeSystem = typeSystem,
|
||||
_isNonNullableByDefault = typeSystem.isNonNullableByDefault,
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:analyzer/file_system/file_system.dart';
|
|||
import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer_utilities/package_root.dart' as package_root;
|
||||
import 'package:analyzer_utilities/verify_tests.dart';
|
||||
import 'package:path/path.dart' as package_path;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
main() {
|
||||
var provider = PhysicalResourceProvider.INSTANCE;
|
||||
|
@ -26,7 +26,7 @@ class _VerifyTests extends VerifyTests {
|
|||
@override
|
||||
bool isOkAsAdditionalTestAllImport(Folder folder, String uri) {
|
||||
// This is not really a test, but a helper to update expectations.
|
||||
if (package_path.url.basename(uri) == 'node_text_expectations.dart') {
|
||||
if (path.url.basename(uri) == 'node_text_expectations.dart') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue