[clang-tools-extra] [clangd] Implement simple folding for preprocessor branches (PR #140959)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 24 17:56:05 PDT 2025


================
@@ -238,7 +231,13 @@ getFoldingRanges(const std::string &Code, bool LineFoldingOnly) {
     AddFoldingRange(Start, End, FoldingRange::REGION_KIND);
   }
 
+  auto Preprocessed = DirectiveStructure.stripDirectives(OrigStream);
----------------
HighCommander4 wrote:

Please preserve the comment `// FIXME: Provide ranges in the disabled-PP regions as well.`

This is referring to providing the existing kinds of ranges (bracket pairs and multi-line comments) in disabled-PP regions, which we're still not doing, so the FIXME remains relevant.

https://github.com/llvm/llvm-project/pull/140959


More information about the cfe-commits mailing list