Skip to content

Commit 7154667

Browse files
committed
feat: add disable depths calculation configuration
1 parent 942dea2 commit 7154667

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

src/dbt_client/vscodeConfiguration.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ export class VSCodeDBTConfiguration implements DBTConfiguration {
8989
);
9090
}
9191

92+
getDisableDepthsCalculation(): boolean {
93+
return workspace
94+
.getConfiguration("dbt")
95+
.get<boolean>(
96+
"disableDepthsCalculation",
97+
DEFAULT_CONFIGURATION_VALUES.disableDepthsCalculation,
98+
);
99+
}
100+
92101
getWorkingDirectory(): string {
93102
return getFirstWorkspacePath();
94103
}

src/dbt_integration/configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface DBTConfiguration {
1616
getEnableNotebooks(): boolean;
1717
getDisableQueryHistory(): boolean;
1818
getInstallDepsOnProjectInitialization(): boolean;
19+
getDisableDepthsCalculation(): boolean;
1920

2021
// Workspace settings
2122
getWorkingDirectory(): string;
@@ -38,6 +39,7 @@ export const DEFAULT_CONFIGURATION_VALUES = {
3839
enableNotebooks: false,
3940
disableQueryHistory: false,
4041
installDepsOnProjectInitialization: true,
42+
disableDepthsCalculation: false,
4143
altimateUrl: "https://api.myaltimate.com",
4244
isLocalMode: false,
4345
} as const;

src/dbt_integration/parsers/modelDepthParser.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { DBTTerminal } from "../../dbt_integration/terminal";
22
import { DBTGraphType } from "./graphParser";
3-
import { AltimateRequest } from "../../altimate";
4-
import { workspace } from "vscode";
53
import { DbtIntegrationClient } from "../dbtIntegrationClient";
4+
import { DBTConfiguration } from "../configuration";
65

76
export class ModelDepthParser {
87
constructor(
98
private terminal: DBTTerminal,
109
private dbtIntegrationClient: DbtIntegrationClient,
10+
private configuration: DBTConfiguration,
1111
) {}
1212

1313
public createModelDepthsMap(
@@ -16,9 +16,8 @@ export class ModelDepthParser {
1616
childMetaMap: DBTGraphType,
1717
): Map<string, number> {
1818
// Check if depth calculation is disabled
19-
const disableDepthsCalculation = workspace
20-
.getConfiguration("dbt")
21-
.get<boolean>("disableDepthsCalculation", false);
19+
const disableDepthsCalculation =
20+
this.configuration.getDisableDepthsCalculation();
2221
if (disableDepthsCalculation) {
2322
this.terminal.debug(
2423
"ModelDepthParser",

src/inversify.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ container
120120
new ModelDepthParser(
121121
context.container.get("DBTTerminal"),
122122
context.container.get(DbtIntegrationClient),
123+
context.container.get("DBTConfiguration"),
123124
),
124125
);
125126

0 commit comments

Comments
 (0)