notskm / vscode-clang-tidy

MIT License
48 stars 26 forks source link

regular expression #48

Closed caichencn closed 3 years ago

caichencn commented 3 years ago

In source code file tidy.ts,I can not understand line 175,What is this regular expression searching for?

const yamlIndex = clangTidyOutput.search(/^---$/m);

Does it search for three consecutive ‘-’ ? why?

notskm commented 3 years ago

Does it search for three consecutive ‘-’ ? why?

Yes. If I remember correctly, clang-tidy outputs a bunch of human readable diagnostic information before the yaml that the extension needs. The three dashes mark the start of the yaml.

caichencn commented 3 years ago

Does it search for three consecutive ‘-’ ? why?

Yes. If I remember correctly, clang-tidy outputs a bunch of human readable diagnostic information before the yaml that the extension needs. The three dashes mark the start of the yaml.

Ok, That's it,I need to learn more, thank you!