diff --git a/pkg/analysis_server/benchmark/perf/memory_tests.dart b/pkg/analysis_server/benchmark/perf/memory_tests.dart index ecfbb91d76be..4fb1ae9f38e1 100644 --- a/pkg/analysis_server/benchmark/perf/memory_tests.dart +++ b/pkg/analysis_server/benchmark/perf/memory_tests.dart @@ -183,7 +183,6 @@ class LspAnalysisServerBenchmarkTest extends AbstractBenchmarkTest _test.instrumentationService = InstrumentationLogAdapter(_logger); await _test.setUp(); _test.projectFolderPath = roots.single; - _test.projectFolderUri = Uri.file(_test.projectFolderPath); await _test.initialize(); } diff --git a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart index 8d4ace2b979e..0dc4d689b528 100644 --- a/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart +++ b/pkg/analysis_server/test/integration/lsp_server/integration_tests.dart @@ -125,11 +125,8 @@ abstract class AbstractLspAnalysisServerIntegrationTest .resolveSymbolicLinksSync(); newFolder(projectFolderPath); newFolder(join(projectFolderPath, 'lib')); - projectFolderUri = Uri.file(projectFolderPath); mainFilePath = join(projectFolderPath, 'lib', 'main.dart'); - mainFileUri = Uri.file(mainFilePath); analysisOptionsPath = join(projectFolderPath, 'analysis_options.yaml'); - analysisOptionsUri = Uri.file(analysisOptionsPath); var client = LspServerClient(instrumentationService); this.client = client; diff --git a/pkg/analysis_server/test/lsp/completion_dart_test.dart b/pkg/analysis_server/test/lsp/completion_dart_test.dart index 6a597ef58124..fe0452f8909b 100644 --- a/pkg/analysis_server/test/lsp/completion_dart_test.dart +++ b/pkg/analysis_server/test/lsp/completion_dart_test.dart @@ -4472,7 +4472,6 @@ void f() { Future test_snippets_testBlock() async { mainFilePath = join(projectFolderPath, 'test', 'foo_test.dart'); - mainFileUri = pathContext.toUri(mainFilePath); var content = ''' void f() { test^ @@ -4497,7 +4496,6 @@ void f() { Future test_snippets_testGroupBlock() async { mainFilePath = join(projectFolderPath, 'test', 'foo_test.dart'); - mainFileUri = pathContext.toUri(mainFilePath); var content = ''' void f() { group^ diff --git a/pkg/analysis_server/test/lsp/server_abstract.dart b/pkg/analysis_server/test/lsp/server_abstract.dart index 195284a403eb..9570f461ef77 100644 --- a/pkg/analysis_server/test/lsp/server_abstract.dart +++ b/pkg/analysis_server/test/lsp/server_abstract.dart @@ -293,18 +293,14 @@ abstract class AbstractLspAnalysisServerTest server.pluginManager = pluginManager; projectFolderPath = convertPath('/home/my_project'); - projectFolderUri = toUri(projectFolderPath); newFolder(projectFolderPath); newFolder(join(projectFolderPath, 'lib')); // Create a folder and file to aid testing that includes imports/completion. newFolder(join(projectFolderPath, 'lib', 'folder')); newFile(join(projectFolderPath, 'lib', 'file.dart'), ''); mainFilePath = join(projectFolderPath, 'lib', 'main.dart'); - mainFileUri = toUri(mainFilePath); nonExistentFilePath = join(projectFolderPath, 'lib', 'not_existing.dart'); - nonExistentFileUri = toUri(nonExistentFilePath); pubspecFilePath = join(projectFolderPath, file_paths.pubspecYaml); - pubspecFileUri = toUri(pubspecFilePath); analysisOptionsPath = join(projectFolderPath, 'analysis_options.yaml'); newFile(analysisOptionsPath, ''' analyzer: @@ -313,7 +309,6 @@ analyzer: - wildcard-variables '''); - analysisOptionsUri = pathContext.toUri(analysisOptionsPath); writeTestPackageConfig(); } @@ -804,11 +799,7 @@ mixin LspAnalysisServerTestMixin nonExistentFilePath, pubspecFilePath, analysisOptionsPath; - late Uri projectFolderUri, - mainFileUri, - nonExistentFileUri, - pubspecFileUri, - analysisOptionsUri; + final String simplePubspecContent = 'name: my_project'; /// The client capabilities sent to the server during initialization. @@ -845,6 +836,9 @@ mixin LspAnalysisServerTestMixin /// server. bool failTestOnErrorDiagnostic = true; + /// [analysisOptionsPath] as a 'file:///' [Uri]. + Uri get analysisOptionsUri => pathContext.toUri(analysisOptionsPath); + /// A stream of [NotificationMessage]s from the server that may be errors. Stream get errorNotificationsFromServer { return notificationsFromServer.where(_isErrorNotification); @@ -867,6 +861,12 @@ mixin LspAnalysisServerTestMixin /// The URI for the macro-generated contents for [mainFileUri]. Uri get mainFileMacroUri => mainFileUri.replace(scheme: macroClientUriScheme); + /// [mainFilePath] as a 'file:///' [Uri]. + Uri get mainFileUri => pathContext.toUri(mainFilePath); + + /// [nonExistentFilePath] as a 'file:///' [Uri]. + Uri get nonExistentFileUri => pathContext.toUri(nonExistentFilePath); + /// A stream of [NotificationMessage]s from the server. @override Stream get notificationsFromServer { @@ -883,6 +883,9 @@ mixin LspAnalysisServerTestMixin path.Context get pathContext; + /// [projectFolderPath] as a 'file:///' [Uri]. + Uri get projectFolderUri => pathContext.toUri(projectFolderPath); + /// A stream of diagnostic notifications from the server. Stream get publishedDiagnostics { return notificationsFromServer @@ -892,6 +895,9 @@ mixin LspAnalysisServerTestMixin notification.params as Map)); } + /// [pubspecFilePath] as a 'file:///' [Uri]. + Uri get pubspecFileUri => pathContext.toUri(pubspecFilePath); + /// A stream of [RequestMessage]s from the server. Stream get requestsFromServer { return serverToClient diff --git a/pkg/analysis_server/test/src/services/refactoring/move_top_level_to_file_test.dart b/pkg/analysis_server/test/src/services/refactoring/move_top_level_to_file_test.dart index 3c1f1eabae77..bda1e6ccfe25 100644 --- a/pkg/analysis_server/test/src/services/refactoring/move_top_level_to_file_test.dart +++ b/pkg/analysis_server/test/src/services/refactoring/move_top_level_to_file_test.dart @@ -316,9 +316,6 @@ class A {} // Put the file in tool/ so we can use a package: import for the file // above but get a relative import back to src. mainFilePath = join(projectFolderPath, 'tool', 'main.dart'); - // TODO(dantup): Make these URIs getters to avoid setting these twice in - // each test. - mainFileUri = pathContext.toUri(mainFilePath); newFile(libFilePath, 'mixin PackageMixin {};'); var originalSource = '''