[PATCH] D132919: [clangd] Enable folding ranges by default.
Utkarsh Saxena via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 30 02:50:48 PDT 2022
usaxena95 updated this revision to Diff 456584.
usaxena95 marked an inline comment as done.
usaxena95 added a comment.
Addressed comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132919/new/
https://reviews.llvm.org/D132919
Files:
clang-tools-extra/clangd/ClangdLSPServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/test/initialize-params.test
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -308,6 +308,8 @@
RetiredFlag<bool> CrossFileRename("cross-file-rename");
RetiredFlag<std::string> ClangTidyChecks("clang-tidy-checks");
RetiredFlag<std::string> InlayHints("inlay-hints");
+RetiredFlag<std::string> FoldingRanges("folding-ranges");
+
opt<int> LimitResults{
"limit-results",
@@ -333,14 +335,6 @@
CommaSeparated,
};
-opt<bool> FoldingRanges{
- "folding-ranges",
- cat(Features),
- desc("Enable preview of FoldingRanges feature"),
- init(false),
- Hidden,
-};
-
opt<unsigned> WorkerThreadsCount{
"j",
cat(Misc),
@@ -903,7 +897,6 @@
Opts.StaticIndex = PAI.get();
}
Opts.AsyncThreadsCount = WorkerThreadsCount;
- Opts.FoldingRanges = FoldingRanges;
Opts.MemoryCleanup = getMemoryCleanupFunction();
Opts.CodeComplete.IncludeIneligibleResults = IncludeIneligibleResults;
Index: clang-tools-extra/clangd/test/initialize-params.test
===================================================================
--- clang-tools-extra/clangd/test/initialize-params.test
+++ clang-tools-extra/clangd/test/initialize-params.test
@@ -43,6 +43,7 @@
# CHECK-NEXT: "clangd.applyTweak"
# CHECK-NEXT: ]
# CHECK-NEXT: },
+# CHECK-NEXT: "foldingRangeProvider": true,
# CHECK-NEXT: "hoverProvider": true,
# CHECK-NEXT: "implementationProvider": true,
# CHECK-NEXT: "inlayHintProvider": true,
Index: clang-tools-extra/clangd/ClangdServer.h
===================================================================
--- clang-tools-extra/clangd/ClangdServer.h
+++ clang-tools-extra/clangd/ClangdServer.h
@@ -161,9 +161,6 @@
/// fetch system include path.
std::vector<std::string> QueryDriverGlobs;
- /// Enable preview of FoldingRanges feature.
- bool FoldingRanges = false;
-
// Whether the client supports folding only complete lines.
bool LineFoldingOnly = false;
Index: clang-tools-extra/clangd/ClangdLSPServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/clangd/ClangdLSPServer.cpp
@@ -584,6 +584,7 @@
{"callHierarchyProvider", true},
{"clangdInlayHintsProvider", true},
{"inlayHintProvider", true},
+ {"foldingRangeProvider", true},
};
{
@@ -613,8 +614,6 @@
CodeAction::INFO_KIND}}}
: llvm::json::Value(true);
- if (Opts.FoldingRanges)
- ServerCaps["foldingRangeProvider"] = true;
std::vector<llvm::StringRef> Commands;
for (llvm::StringRef Command : Handlers.CommandHandlers.keys())
@@ -1618,8 +1617,7 @@
Bind.method("clangd/inlayHints", this, &ClangdLSPServer::onClangdInlayHints);
Bind.method("textDocument/inlayHint", this, &ClangdLSPServer::onInlayHint);
Bind.method("$/memoryUsage", this, &ClangdLSPServer::onMemoryUsage);
- if (Opts.FoldingRanges)
- Bind.method("textDocument/foldingRange", this, &ClangdLSPServer::onFoldingRange);
+ Bind.method("textDocument/foldingRange", this, &ClangdLSPServer::onFoldingRange);
Bind.command(ApplyFixCommand, this, &ClangdLSPServer::onCommandApplyEdit);
Bind.command(ApplyTweakCommand, this, &ClangdLSPServer::onCommandApplyTweak);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132919.456584.patch
Type: text/x-patch
Size: 3432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220830/bcc54c96/attachment.bin>
More information about the cfe-commits
mailing list