clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
629 stars 106 forks source link

Problem about alert displayed in clangd #561

Open COMAC919 opened 10 months ago

COMAC919 commented 10 months ago

In the Diagnostics.cpp file of the clangd module in LLVM, there is a function called getDiagnosticDocURI that retrieves the URL address of a rule check. The code is as follows: case Diag::ClangTidy: { StringRef Module, Check; std::tie(Module, Check) = Name.split('-'); if (Module.empty() || Check.empty()) return llvm::None; return ("https://clang.llvm.org/extra/clang-tidy/checks/" + Module + "/" + Check + ".html") .str(); } Now, I have defined several custom rules and have corresponding MD documents in the code repository. Therefore, in the clangd plugin in VSCode, when there is an alert, I want to be able to click on the hyperlink to go to the corresponding document. I modified the code as follows:

case Diag::ClangTidy: { StringRef Module, Check; if (Name.contains(StringRef("xxx-xxx"))){ std::string url = R"(https://open.codehub.xxx.com/innersource/DragonGlass/DragonGlass/files?ref%3Dmaster&isFile&%3Dtrue&filePath=clang-tools-extra/clang-tidy/xxx/docs/security/Check8Byte.md)"; return url ; } In the plugin, the alert is displayed, but when I check the hyperlink in the alert, it is always escaped as the following link: https://open.codehub.xxx.com/innersource/DragonGlass/DragonGlass/files?ref%3Dmaster%26isFile%3Dtrue%26filePath%3Dclang-tools-extra%2Fclang-tidy%2Fhuawei%2Fdocs%2Fsecurity%2FCheck8Byte.md image

This prevents me from being able to click on the hyperlink and access the specified website. How can I resolve this issue?

HighCommander4 commented 10 months ago

Filing an issue in four different places is not going to get it answered faster, it will just annoy people who are spammed with repeated email notifications.

COMAC919 commented 10 months ago

Filing an issue in four different places is not going to get it answered faster, it will just annoy people who are spammed with repeated email notifications.

I beg your pardon for my ignorance and my mistakes. I didn't know where to ask this question, so I posted it in a few places hoping that someone who knows could see it.This situation will not occur again.