Comments (4)
The current rule of attaching leading/middle comments is to attach them to the largest node next to it, for example the following comment is attached to mapping
instead of mappingItem
/mappingKey
/plain
, breaking the consistency does not seem to be a good idea IMO.
# comment
key: value
And the linked issue seems to be unrelated to this issue, where the ignore comment already worked with sequence.leadingComments
, it just did not recognize the sequence.middleComments
case.
from yaml-unist-parser.
In that Prettier issue, it seems user mean to ignore that sequenceItem
, and prettier-ignore
normally in leadingComments
, should this special case handle in Prettier or here?
Does sequence.middleComments
only appear before the first child?
from yaml-unist-parser.
In that Prettier issue, it seems user mean to ignore that
sequenceItem
, ...
There is only one sequence item in the sequence so I'm not sure if they meant sequence
or sequenceItem
given that both of them have the exact same range. And changing the comment attaching from sequence
to sequenceItem
would be a breaking change for Prettier since the prettier-ignore
range would be wider.
...and
prettier-ignore
normally inleadingComments
, should this special case handle in Prettier or here?
Since the ignore comment is a Prettier-specific feature, I'd say it should be handled on the Prettier side.
Does
sequence.middleComments
only appear before the first child?
Since the tag/anchor can only appear in front of the node, Yes.
from yaml-unist-parser.
Thank you! I'll try to fix that issue.
from yaml-unist-parser.
Related Issues (18)
- Comment inside map crashes with CRLF line endings
- yaml-unist-stringify? HOT 3
- Use `new YAML.Document().parse(ast)` to find syntax errors
- Can you update `yaml` HOT 1
- Please update `tslib` version requirement
- Update `yaml` HOT 2
- Comments in `flowMapping` and `flowSequence` not correctly attched HOT 1
- Incorrect documentHead position HOT 1
- Support YAML Inline Extend syntax HOT 1
- Comment attach seems wired HOT 1
- Type compatibility with `unist-util-visit`
- Update `yaml` to v2 HOT 2
- Update typescript & jest HOT 1
- Drop Node.js <= 12.x ?
- Migrate to typescript-eslint from tslint
- Comments at the end of a collection
- EndComment mis-attaching in nested mapping
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yaml-unist-parser.