From 9895a500ea35290fb767d95e3b149e59ea653f8e Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 11 Dec 2023 08:59:50 +0100 Subject: [PATCH] add settings d.enableDCDHighlight+enableFallbackHighlight d.enableDCDHighlight controls if `dcd-client --localUse` should be run d.enableFallbackHighlight controls if associated `return`, `if`/`else`, `switch`/`case`, loop+`break`/`continue` should be highlighted --- source/served/commands/highlight.d | 5 +++-- source/served/types.d | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/served/commands/highlight.d b/source/served/commands/highlight.d index b6e0b21d..ffb85fe3 100644 --- a/source/served/commands/highlight.d +++ b/source/served/commands/highlight.d @@ -13,10 +13,11 @@ DocumentHighlight[] provideDocumentHighlight(DocumentHighlightParams params) { scope document = cast(immutable)documents[params.textDocument.uri].clone(); auto currOffset = cast(int) document.positionToBytes(params.position); + auto fileConfig = config(document.uri); - auto result = documentHighlightImpl(document, currOffset); + auto result = fileConfig.d.enableDCDHighlight ? documentHighlightImpl(document, currOffset) : null; - if (!result.length) + if (!result.length && fileConfig.d.enableFallbackHighlight) return fallbackDocumentHighlight(document, currOffset); return result; diff --git a/source/served/types.d b/source/served/types.d index a6d0edef..6e6ae8c0 100644 --- a/source/served/types.d +++ b/source/served/types.d @@ -87,6 +87,8 @@ struct Configuration bool enableDMDImportTiming = false; bool enableCoverageDecoration = true; bool enableGCProfilerDecorations = true; + bool enableDCDHighlight = true; + bool enableFallbackHighlight = true; bool neverUseDub = false; string[] projectImportPaths; string dubConfiguration;