Skip to content

Commit 9895a50

Browse files
committed
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
1 parent ac0b6c3 commit 9895a50

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

source/served/commands/highlight.d

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ DocumentHighlight[] provideDocumentHighlight(DocumentHighlightParams params)
1313
{
1414
scope document = cast(immutable)documents[params.textDocument.uri].clone();
1515
auto currOffset = cast(int) document.positionToBytes(params.position);
16+
auto fileConfig = config(document.uri);
1617

17-
auto result = documentHighlightImpl(document, currOffset);
18+
auto result = fileConfig.d.enableDCDHighlight ? documentHighlightImpl(document, currOffset) : null;
1819

19-
if (!result.length)
20+
if (!result.length && fileConfig.d.enableFallbackHighlight)
2021
return fallbackDocumentHighlight(document, currOffset);
2122

2223
return result;

source/served/types.d

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ struct Configuration
8787
bool enableDMDImportTiming = false;
8888
bool enableCoverageDecoration = true;
8989
bool enableGCProfilerDecorations = true;
90+
bool enableDCDHighlight = true;
91+
bool enableFallbackHighlight = true;
9092
bool neverUseDub = false;
9193
string[] projectImportPaths;
9294
string dubConfiguration;

0 commit comments

Comments
 (0)