From 8da7769462d837dfaf67f9f5eb853b1abfd8b24f Mon Sep 17 00:00:00 2001 From: Sean Wu Date: Mon, 3 May 2021 23:00:19 +0800 Subject: [PATCH] Fix: watching uic config for rcc. Also, update the rxjs 7.0.0 iif syntax. --- src/tools/lupdate.ts | 4 ++-- src/tools/rcc.ts | 10 +++++++--- src/tools/uic.ts | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/tools/lupdate.ts b/src/tools/lupdate.ts index e55fa42..0fa8038 100644 --- a/src/tools/lupdate.ts +++ b/src/tools/lupdate.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { iif } from 'rxjs'; +import { EMPTY, iif } from 'rxjs'; import { mergeMap, switchMap } from 'rxjs/operators'; import * as vscode from 'vscode'; import { @@ -55,7 +55,7 @@ const uiFileWatcher$ = createFileWatcher$('**/*.ui'); export const liveExecution$ = enabled$('lupdate').pipe( switchMap(enabled => - iif(() => enabled, uiFileWatcher$.pipe(watchFileChangedAndCreated())) + iif(() => enabled, uiFileWatcher$.pipe(watchFileChangedAndCreated()), EMPTY) ), mergeMap(uri => updateTranslation(uri)) ); diff --git a/src/tools/rcc.ts b/src/tools/rcc.ts index e8a9965..08dbde7 100644 --- a/src/tools/rcc.ts +++ b/src/tools/rcc.ts @@ -1,4 +1,4 @@ -import { iif } from 'rxjs'; +import { EMPTY, iif } from 'rxjs'; import { mergeMap, switchMap } from 'rxjs/operators'; import * as vscode from 'vscode'; import { @@ -33,9 +33,13 @@ export async function compileResource(fileUri?: vscode.Uri) { const qrcFileWatcher$ = createFileWatcher$('**/*.qrc'); -export const liveExecution$ = enabled$('uic').pipe( +export const liveExecution$ = enabled$('rcc').pipe( switchMap(enabled => - iif(() => enabled, qrcFileWatcher$.pipe(watchFileChangedAndCreated())) + iif( + () => enabled, + qrcFileWatcher$.pipe(watchFileChangedAndCreated()), + EMPTY + ) ), mergeMap(uri => compileResource(uri)) ); diff --git a/src/tools/uic.ts b/src/tools/uic.ts index 6a222b0..2551828 100644 --- a/src/tools/uic.ts +++ b/src/tools/uic.ts @@ -1,4 +1,4 @@ -import { iif } from 'rxjs'; +import { EMPTY, iif } from 'rxjs'; import { mergeMap, switchMap } from 'rxjs/operators'; import * as vscode from 'vscode'; import { @@ -34,7 +34,7 @@ const uiFileWatcher$ = createFileWatcher$('**/*.ui'); export const liveExecution$ = enabled$('uic').pipe( switchMap(enabled => - iif(() => enabled, uiFileWatcher$.pipe(watchFileChangedAndCreated())) + iif(() => enabled, uiFileWatcher$.pipe(watchFileChangedAndCreated()), EMPTY) ), mergeMap(uri => compileForm(uri)) );