vscode 中 proto3 的 Linting(语法高亮)
Linting (syntax highlights) of proto3 in vscode
有没有办法在 vscode 中突出显示(列出)proto3 文件的语法?我尝试使用 vscode-proto3、Protobuf Lint 插件,但到目前为止没有成功。例如,对于以下示例,它应该用红色突出显示 Date
,因为它未定义也未导入。
syntax = "proto3";
message Person {
int32 age = 1;
string first_name = 2;
string last_name = 3;
// Date IN THE FOLLOWING LINE SHOULD BE HIGHLIGHTED WITH RED
Date birthday = 9;
}
vscode-proto3 v0.5.4 为我完成了这项工作:
Date is underlined in red
您需要保存文件才能触发验证。还要确保 protoc
已安装并在您的 PATH 中可用,或者您已经 updated the extension's setting.json. According to their doc:
The validation is triggered when you save the proto file. You need protoc compiler to enable syntax validation. You also need a settings.json file to tell the extension the full path of protoc if it is not in path.
vscode-protolint 也会检查您的情况。
支持a rich set of rules backed by protolint.
确保 protolint
已安装并在您的 PATH 中可用。
注意:我一直在维护 protolint。
有没有办法在 vscode 中突出显示(列出)proto3 文件的语法?我尝试使用 vscode-proto3、Protobuf Lint 插件,但到目前为止没有成功。例如,对于以下示例,它应该用红色突出显示 Date
,因为它未定义也未导入。
syntax = "proto3";
message Person {
int32 age = 1;
string first_name = 2;
string last_name = 3;
// Date IN THE FOLLOWING LINE SHOULD BE HIGHLIGHTED WITH RED
Date birthday = 9;
}
vscode-proto3 v0.5.4 为我完成了这项工作: Date is underlined in red
您需要保存文件才能触发验证。还要确保 protoc
已安装并在您的 PATH 中可用,或者您已经 updated the extension's setting.json. According to their doc:
The validation is triggered when you save the proto file. You need protoc compiler to enable syntax validation. You also need a settings.json file to tell the extension the full path of protoc if it is not in path.
vscode-protolint 也会检查您的情况。
支持a rich set of rules backed by protolint.
确保 protolint
已安装并在您的 PATH 中可用。
注意:我一直在维护 protolint。