plugin-swift icon indicating copy to clipboard operation
plugin-swift copied to clipboard

Potential stability issue

Open anreitersimon opened this issue 7 years ago • 0 comments

I have tried to run prettier on on our codebase and was not able to do so successfully.

The kind of errors were pretty similar to those mentioned in here. After some searching around i stumbled upon this bug report, which seemed to explain the issues i was having.

In the comment section a libSyntax contributor stated:

I intentionally introduced null to represent missing node as a part of performance optimization. For instance, every IdentifierExpr have optional DeclNameArguments (e.g. (x:y:)) node. Allocating it for every identifier expressions is definitely a waste of time and resource.

please do not use JSON representation, RawSyntax or SyntaxData directly. They are really implementation detail.

From what i could gather prettier uses swiftc -frontend -emit-syntax under the hood to obtain the JSON representation and then processes it.

Since this is not a officially supported API this might cause some problems down the road.

I thaught i should bring it up since its definitely something to be aware of.

Best regards,

Simon

anreitersimon avatar Mar 23 '18 14:03 anreitersimon