google / google/vim-codefmt

Consider providing a standard way for formatters to report errors

未关闭
#60 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Vim Script
星标
1.1k
派生
102
PR 合并指标
30 天内没有已合并 PR

描述

Currently, if formatters want to report errors, they update the quickfix list directly. (As shipped, only the gofmt formatter does this, but it would also make sense for e.g. google-java-format, were we to add support for that.) It would be nice to make it easier for formatters to report errors.

Additionally, we have some questions around when formatters should clear the quickfix list (e.g. #58), and I'm not sure how stacked formatters (#44) would work if formatters were managing the quickfix list individually.

I've been wondering whether formatters could pass a structured error list to codefmt somehow, and then codefmt itself could be responsible for merging/populating/hiding the quickfix list as appropriate, consistently.

As a strawman, perhaps `FormatRange()` (etc) could return a list of (line, column, message)? (Or accept a callback instead, if that sounds like a restrictive API? Would the line numbers be relative to the start of the range, for range formatting?)

And/or, since most formatters can get errors by looking for "file:line:column: error" on stderr, it might even be work providing a helper that handled exactly that pattern directly.

贡献指南

打开贡献指南

调研方向

首先检查 FormatRange() 周围的 formatter API,以及 issues #58 和 #44 中讨论的行为。明确错误应以结构化方式返回,还是通过 callback 报告,包括相对于范围的位置和堆叠的 formatter。完成的标准是,codefmt 在所有受支持的 formatter 中一致地负责 quickfix 的合并、清除、填充和隐藏。

由索引模型根据 Issue 内容生成。

评估

技术栈
vim
领域
tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。