8000 [Feature Request] An equivalent of `parseString` but only for imports/exports (`NamespaceDirective`). · Issue #53498 · dart-lang/sdk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Feature Request] An equivalent of parseString but only for imports/exports (NamespaceDirective). #53498

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

Open
gmpassos opened this issue Sep 11, 2023 · 3 comments
Labels
area-dart-model For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer. 8000 model-parser Parser issues in the analyzer/CFE P4

Comments

@gmpassos
Copy link
Contributor

[ This is related to: Dart analyzer ]

When scanning for imports in the code, the current implementation requires fully parsing a Dart file. Since imports are only present at the beginning of the file, it would be very useful to have the ability to parse only the imports (stop parsing after the last import/export is detected).

This can significantly improve the response time of tools that need to analyze the import path or provide code suggestions.

Currently, the Dart Analyzer is experiencing increased response times due to its increased complexity. For medium to large projects, it's no longer "instantaneous".

I conducted some experiments using a simple RegExp to extract the last import in the Dart code. Then, I split the file and passed only the top of the Dart file to the parseString function. The performance was 3-4x times faster than analyzing the full file (I only want the NamespaceDirective in the code in my case).

@jakemac53
Copy link
Contributor

Fwiw, we do have lots of our own tools that only want to look at directives. So some improvement here would be appreciated for sure. We actually spend a large amount of time compiling web projects (with build_web_compilers) just in parsing directives.

@gmpassos
Copy link
Contributor Author

For me this is a P1 😁

Tools that depend on analysis need to be improved ASAP.

@bwilkerson bwilkerson added area-fe-analyzer-shared and removed legacy-area-analyzer Use area-devexp instead. labels Sep 13, 2023
@gmpassos
Copy link
Contributor Author

Any update?

@johnniwinther johnniwinther added area-dart-model For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer. model-parser Parser issues in the analyzer/CFE and removed legacy-area-fe-analyzer-shared labels Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart-model For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer. model-parser Parser issues in the analyzer/CFE P4
Projects
None yet
Development

No branches or pull requests

6 participants
0