Skip to content

Newline-separated comments should stay separate at document start #600

Description

@SLdragon

Describe the bug

For yaml file

# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.7/yaml.schema.json
# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file
# Visit https://aka.ms/teamsfx-actions for details on actions
version: v1.7

Use below js to parse it:

const yaml = require("yaml")
const fs = require("fs");
const yamlContent = fs.readFileSync("example.yaml", "utf8");
const parsedYaml = yaml.parseDocument(yamlContent);
console.log(parsedYaml.commentBefore);

And the commentBefore is null

To Reproduce
Just as above

Expected behaviour
commentBefore should not be null

Versions (please complete the following information):

  • Environment: 18
  • yaml: 2.7.0.

Additional context
No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions