4afd2e10be
The session log normalizer replaces known paths/URIs in JSON but doesn't take into account different URI encoding between the client and the server. For example VS Code will encode ampersands whereas Dart does not: ``` file:///c:/uri&encoding&quirks file:///c:/uri%26encoding%26quirks ``` This means not all file URIs are correctly normalized. Adding additional groups for each potentially-encoded characters make the regex many times slower (the benchmark test here goes from around 25ms to over 1s per iteration), so instead this change has the normalizer accept the original JSON map and uses jsonEncode()s `toEncodable` option to normalize any URIs (by converting them to their file paths and then encoding using Dart's Uri class) so they will always be consistent before the replacement. (I tried doing the replacement also in `toEncodable`, but invoking the regex many times also slowed things down a lot). There is a small time increase (2-3ms) for a payload of 2MB. The "before" times quoted here are slightly higher than previously quoted, but that's because `jsonEncode()` was previously done inside `SessionLoggerFileSink` (and therefore excluded from the timings before), but is now done inside the normalizer to allow normalizing the URI escaping. Replacing 250 paths in payload of 2097152 bytes Iteration #1, First: 57ms, Rest: 40ms Iteration #2, First: 49ms, Rest: 41ms Iteration #3, First: 45ms, Rest: 41ms Iteration #4, First: 47ms, Rest: 40ms Iteration #5, First: 40ms, Rest: 40ms Replacing 250 paths in payload of 2097152 bytes Iteration #1, First: 59ms, Rest: 43ms Iteration #2, First: 53ms, Rest: 44ms Iteration #3, First: 52ms, Rest: 44ms Iteration #4, First: 49ms, Rest: 43ms Iteration #5, First: 49ms, Rest: 43ms Fixes https://github.com/dart-lang/sdk/issues/63331 Change-Id: Ice2dc7ceceaa6c08e2ff634d7564efe9f0f7de44 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/502940 Reviewed-by: Keerti Parthasarathy <keertip@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Keerti Parthasarathy <keertip@google.com>
analysis_server
A long-running process that provides analysis results to other tools.
The analysis server is designed to provide on-going analysis of one or more code bases as those code bases are changing.
Using the server
The analysis server is not intended to be used stand-alone, and therefore does not have a human-friendly user interface.
Clients (typically tools, such as an editor) are expected to run the analysis
server in a separate process and communicate with it using a JSON protocol. The
original protocol is specified in the file analysis_server/doc/api.html
and Language Server Protocol support is documented in
tool/lsp_spec/README.md.
Features and bugs
Please file feature requests and bugs at the issue tracker.