Skip to content

Commit 9c43882

Browse files
add progress message
1 parent c4f0ecc commit 9c43882

File tree

1 file changed

+41
-19
lines changed

1 file changed

+41
-19
lines changed

vscode/extension/src/commands/tableDiff.ts

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,27 @@ export function showTableDiff(
195195
}
196196

197197
// Run table diff immediately with selected parameters
198-
const tableDiffResult = await lspClient.call_custom_method('sqlmesh/api', {
199-
method: 'GET',
200-
endpoint: '/api/table_diff',
201-
params: {
202-
source: selectedSourceEnv.label,
203-
target: selectedTargetEnv.label,
204-
model_or_snapshot: selectedModelInfo.name,
198+
const tableDiffResult = await vscode.window.withProgress(
199+
{
200+
location: vscode.ProgressLocation.Notification,
201+
title: 'SQLMesh',
202+
cancellable: false,
205203
},
206-
body: {},
207-
})
204+
async (progress) => {
205+
progress.report({ message: 'Calculating table differences...' })
206+
207+
return await lspClient.call_custom_method('sqlmesh/api', {
208+
method: 'GET',
209+
endpoint: '/api/table_diff',
210+
params: {
211+
source: selectedSourceEnv.label,
212+
target: selectedTargetEnv.label,
213+
model_or_snapshot: selectedModelInfo.name,
214+
},
215+
body: {},
216+
})
217+
}
218+
)
208219

209220
if (isErr(tableDiffResult)) {
210221
vscode.window.showErrorMessage(
@@ -460,18 +471,29 @@ export function showTableDiff(
460471
break
461472
}
462473

463-
const tableDiffResult = await lspClient.call_custom_method(
464-
'sqlmesh/api',
474+
const tableDiffResult = await vscode.window.withProgress(
465475
{
466-
method: 'GET',
467-
endpoint: '/api/table_diff',
468-
params: {
469-
source: sourceEnvironment,
470-
target: targetEnvironment,
471-
model_or_snapshot: sourceModel,
472-
},
473-
body: {},
476+
location: vscode.ProgressLocation.Notification,
477+
title: 'SQLMesh',
478+
cancellable: false,
474479
},
480+
async (progress) => {
481+
progress.report({ message: 'Calculating table differences...' })
482+
483+
return await lspClient.call_custom_method(
484+
'sqlmesh/api',
485+
{
486+
method: 'GET',
487+
endpoint: '/api/table_diff',
488+
params: {
489+
source: sourceEnvironment,
490+
target: targetEnvironment,
491+
model_or_snapshot: sourceModel,
492+
},
493+
body: {},
494+
},
495+
)
496+
}
475497
)
476498

477499
let responseCallback: CallbackEvent

0 commit comments

Comments
 (0)