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

Analysis server doesn't start up correctly on Windows #53000

Closed
DanTup opened this issue Jul 20, 2023 · 3 comments
Closed

Analysis server doesn't start up correctly on Windows #53000

DanTup opened this issue Jul 20, 2023 · 3 comments
Assignees
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures

Comments

@DanTup
Copy link
Collaborator

DanTup commented Jul 20, 2023

On my Windows PC using a bleeding edge SDK (or running server from source), the server fails to start up correctly from VS Code and no language functionality is available.

I'm still investigating, but it seems to be getting stuck waiting for watchers to become ready while building context roots:

image

There's a suspicious path format in the resource being watched which makes me suspicious about some recent changes I made to use path contexts. I also see this in some of the JSON:

{"scopeUri"::"file::///C::/C::/Dev/Test%20Projects/dart_application_3

This must be a recent break - although I don't know why no bots are failing (it's possible this is isolated to my machine, but that would be odd too).

(@bwilkerson FYI - I'm looking into this and will post back shortly)

@DanTup DanTup added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-server labels Jul 20, 2023
@DanTup DanTup self-assigned this Jul 20, 2023
@pq pq added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Jul 20, 2023
@DanTup
Copy link
Collaborator Author

DanTup commented Jul 20, 2023

Seems like pathContext.fromUri doesn't like encoded colons for the drive letter:

Future<void> test_danny() async {
  final fileUris = [
    'file:///C%3A/Dev/Test%20Projects/dart_application_3',
    'file:///C:/Dev/Test%20Projects/dart_application_3'
  ];
  for (final fileUri in fileUris) {
    final path1 = Uri.parse(fileUri).toFilePath();
    final path2 = pathContext.fromUri(fileUri);
    print('Uri.parse($fileUri).toFilePath():\n    $path1');
    print('pathContext.fromUri($fileUri):\n    $path2');
  }
}
Uri.parse(file:///C%3A/Dev/Test%20Projects/dart_application_3).toFilePath():
    C:\Dev\Test Projects\dart_application_3

pathContext.fromUri(file:///C%3A/Dev/Test%20Projects/dart_application_3):
    \C:\Dev\Test Projects\dart_application_3

Uri.parse(file:///C:/Dev/Test%20Projects/dart_application_3).toFilePath():
    C:\Dev\Test Projects\dart_application_3

pathContext.fromUri(file:///C:/Dev/Test%20Projects/dart_application_3):
    C:\Dev\Test Projects\dart_application_3

Probably the reason no tests failed is that we're not encoding the colon, but VS Code is. I'm struggling to find info on whether it's valid or not. If it is, package:path should handle it. If it's not, the LSP client

@DanTup
Copy link
Collaborator Author

DanTup commented Jul 20, 2023

I'm going to partially revert 77799f6. The whole change doesn't revert cleanly, and we only need to not use pathContext.fromUri() in the LSP server for now. A smaller revert will be easier to re-land later if we can address the issue in package:path or similar later.

@DanTup
Copy link
Collaborator Author

DanTup commented Jul 20, 2023

https://dart-review.googlesource.com/c/sdk/+/315260 reverts use of pathContext.fromUri() in LSP, and https://dart-review.googlesource.com/c/sdk/+/315280 adds some tests that use VS Code's path formatting.

I'll try and find some concrete info on whether the escaped colon is valid or not (if it is, we need to fix package:path, and if it's not, we need the VS Code LSP client fixing).

copybara-service bot pushed a commit that referenced this issue Jul 21, 2023
See #53000

Committing separately to the revert of pathContext.fromUri() so if in future that CL is reverted (to re-land the change), it doesn't remove these tests.

Change-Id: I922e5e770a0c8dfcfc6a1cd41f6734d88c2edf7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

2 participants