Skip to content

Commit

Permalink
add settings d.enableDCDHighlight+enableFallbackHighlight
Browse files Browse the repository at this point in the history
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
  • Loading branch information
WebFreak001 committed Dec 11, 2023
1 parent ac0b6c3 commit 9895a50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/served/commands/highlight.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions source/served/types.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9895a50

Please sign in to comment.