[Feature Request] An equivalent of parseString
but only for imports/exports (NamespaceDirective
).
#53498
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
[ 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 theparseString
function. The performance was 3-4x times faster than analyzing the full file (I only want theNamespaceDirective
in the code in my case).The text was updated successfully, but these errors were encountered: