Skip to content

[Bug] 无法解析含多个 YAML fragment 的 .clangd(YAML.parse 遇到 ---) #581

Description

@KyriosChern

复现步骤

  1. 在工程根目录放入下面这份 .clangd
CompileFlags:
  Add:
    - -Wall
Diagnostics:
  Suppress: "*"
---
If:
  PathMatch: tests/.*
Index:
  Background: Skip
  1. 用 EIDE 打开工程
  2. 打开 Output 面板的 eide-log

实际结果

日志出现

YAMLParseError: Source contains multiple documents; please use YAML.parseAllDocuments() at line 6, column 1:

  Suppress: "*"
---
^

期望结果

合法的多 fragment .clangd 应能被读入,且后续写回时 保留全部 fragment(包括带 If 的条件段),而不是只处理第一段、或把多段压成一个文档。

相关文件

涉及到的源文件
https://github.com/github0null/eide/blob/master/src/clangdConfigProvider.ts

Clangd 的配置说明
https://clangd.llvm.org/config
里有提到

Each file can contain multiple fragments separated by --- lines. (This is only useful if the fragments have different If conditions).

环境信息

  • EIDE: 3.27.2
  • OS: Windows 10
  • 已启用 EIDE.Option.EnableClangdConfigGenerator

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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