當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript workspace.saveAll方法代碼示例

本文整理匯總了TypeScript中vscode.workspace.saveAll方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript workspace.saveAll方法的具體用法?TypeScript workspace.saveAll怎麽用?TypeScript workspace.saveAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode.workspace的用法示例。


在下文中一共展示了workspace.saveAll方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: startProc

	startProc(cmd) {
		if (!this.child) {
			this.output.show(vscode.ViewColumn.Three);
			this.output.clear();
			vscode.workspace.saveAll(false);
			this.buildButton.hide();
			this.startButton.hide();
			Promise.all([this.workspaced.getConfiguration(), this.workspaced.getBuildType()]).then(values => {
				let args = [cmd, "--config=" + values[0], "--build=" + values[1]];
				this.output.appendLine("> dub " + args.join(" "));
				this.child = ChildProcess.spawn("dub", args, { cwd: vscode.workspace.rootPath, detached: true });
				this.child.stderr.on("data", this.handleData.bind(this));
				this.child.stdout.on("data", this.handleData.bind(this));
				this.child.once("close", (code) => {
					code = (code || 0);
					if (code === 0)
						this.output.appendLine(cmd + " succeeded");
					else
						this.output.appendLine("dub stopped with error code " + code);
					this.handleStop();
				});
				this.child.once("error", (err) => {
					this.output.appendLine("dub crashed:");
					this.output.appendLine(err.toString());
					this.handleStop();
				});

				this.stopButton.show();
			});
		}
	}
開發者ID:claudiug,項目名稱:code-d,代碼行數:31,代碼來源:compile-buttons.ts

示例2:

	/* internal */ populateService(): void {
		this.currentDiagnostics.clear();
		this.syntaxDiagnostics = Object.create(null);
		// See https://github.com/Microsoft/TypeScript/issues/5530
		workspace.saveAll(false).then((value) => {
			this.bufferSyncSupports.forEach(support => {
				support.reOpenDocuments();
				support.requestAllDiagnostics();
			});
		});
	}
開發者ID:1424667164,項目名稱:vscode,代碼行數:11,代碼來源:typescriptMain.ts

示例3: runCommandInIntegratedTerminal

 const runSbtCommand = (args: string[], cwd?: string) => {
   workspace.saveAll().then(() => {
     if (!cwd) {
       // tslint:disable-next-line:no-parameter-reassignment
       cwd = workspace.rootPath;
     }
     if (typeof window.createTerminal === 'function') {
       runCommandInIntegratedTerminal(args, cwd);
     }
   });
 };
開發者ID:dragos,項目名稱:dragos-vscode-scala,代碼行數:11,代碼來源:sbt.ts

示例4: runNpmCommand

function runNpmCommand(args: string[], cwd?: string): void {
	workspace.saveAll().then(() => {
		if (!cwd) {
			cwd = workspace.rootPath;
		}

		if (useTerminal()) {
			runCommandInTerminal(args, cwd);
		} else {
			runCommandInOutputWindow(args, cwd);
		}
	});
}
開發者ID:Gigitsu,項目名稱:vscode-npm-scripts,代碼行數:13,代碼來源:main.ts

示例5: runNpmCommand

function runNpmCommand(args: string[], cwd?: string, alwaysRunInputWindow = false): void {
	if (runSilent()) {
		args.push('--silent');
	}
	workspace.saveAll().then(() => {
		if (!cwd) {
			cwd = workspace.rootPath;
		}

		if (useTerminal() && !alwaysRunInputWindow) {
			if (typeof window.createTerminal === 'function') {
				runCommandInIntegratedTerminal(args, cwd);
			} else {
				runCommandInTerminal(args, cwd);
			}
		} else {
			outputChannel.clear();
			runCommandInOutputWindow(args, cwd);
		}
	});
}
開發者ID:scytalezero,項目名稱:vscode-npm-scripts,代碼行數:21,代碼來源:main.ts

示例6: exec

    let disposable = vscode.commands.registerCommand('lรถvelauncher.launch', () => {
        if(currentInstances.length < maxInstances || overWrite){
            var path : string = vscode.workspace.getConfiguration('lรถvelauncher').get('path').toString();
            var useConsoleSubsystem = vscode.workspace.getConfiguration('lรถvelauncher').get('useConsoleSubsystem');
            var saveAllonLaunch = vscode.workspace.getConfiguration('lรถvelauncher').get('saveAllonLaunch');

            if (saveAllonLaunch){
                vscode.workspace.saveAll();
            }

            if (overWrite){
                currentInstances.forEach(function(instance){
                    if (instance != undefined){
                        instance.kill();
                    }
                });
            }

            if(!useConsoleSubsystem){
                var process = exec(path, [vscode.workspace.rootPath], function(err, data) {

                });
                process.on('exit', on_exit.bind(null,process));
                currentInstances[process.pid] = process;
            }else{
                var process = exec(path, [vscode.workspace.rootPath, "--console"], function (err, data) {

                });
                process.on('exit', on_exit.bind(null,process));
                currentInstances[process.pid] = process;
            }
        }else{
            vscode.window.showErrorMessage("You have reached your max concurrent Lรถve instances. You can change this setting in your config.");
        }

    });
開發者ID:JanWerder,項目名稱:vscode-love-launcher,代碼行數:36,代碼來源:extension.ts

示例7:

	/* internal */ populateService(): void {
		// See https://github.com/Microsoft/TypeScript/issues/5530
		workspace.saveAll(false).then((value) => {
			Object.keys(this.languagePerId).forEach(key => this.languagePerId[key].reInitialize());
		});
	}
開發者ID:fs814,項目名稱:vscode,代碼行數:6,代碼來源:typescriptMain.ts

示例8: execute

 async execute(): Promise<void> {
   // TODO : overwrite readonly files when bang? == true
   await vscode.workspace.saveAll(false);
 }
開發者ID:DanEEStar,項目名稱:Vim,代碼行數:4,代碼來源:wall.ts

示例9: provideRenameEdits

 public provideRenameEdits(document: vscode.TextDocument, position: vscode.Position, newName: string, token: vscode.CancellationToken): Thenable<vscode.WorkspaceEdit> {
     return vscode.workspace.saveAll(false).then(() => {
         return this.doRename(document, position, newName, token);
     });
 }
開發者ID:maiamatheus,項目名稱:pythonVSCode,代碼行數:5,代碼來源:renameProvider.ts

示例10: activate

export function activate(context: vscode.ExtensionContext) {

    let riolog = new RioLog();
    context.subscriptions.push(riolog);

    let preferences: Preferences[] = [];

    let workspaces = vscode.workspace.workspaceFolders;

    if (workspaces === undefined) {
        vscode.window.showErrorMessage('WPILib does not support single file');
        return;
    }

    for (let w of workspaces) {
        preferences.push(new Preferences(w));
    }

    context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders(() => {
        // Nuke and restart
        for (let p of preferences) {
            p.dispose();
        }
        let wp = vscode.workspace.workspaceFolders;

        if (wp === undefined) {
            return;
        }

        for (let w of wp) {
            preferences.push(new Preferences(w));
        }
    }));

    context.subscriptions.push(...preferences);

    let extensionResourceLocation = path.join(context.extensionPath, 'resources');

    let tools = new Array<IToolRunner>();
    let codeDeployers = new Array<ICodeDeployer>();
    let codeDebuggers = new Array<ICodeDeployer>();
    let languageChoices = new Array<string>();

    let api : IExternalAPI = {
        async startRioLog(teamNumber: number) : Promise<void> {
            riolog.connect(teamNumber, path.join(extensionResourceLocation, 'riolog'));
        },
        async startTool(): Promise<void> {
            if (tools.length <= 0) {
                vscode.window.showErrorMessage('No tools found. Please install some');
                return;
            }

            let toolNames = new Array<string>();
            for (let t of tools) {
                toolNames.push(t.getDisplayName());
            }

            let result = await vscode.window.showQuickPick(toolNames, { placeHolder: 'Pick a tool'});

            if (result === undefined) {
                vscode.window.showInformationMessage('Tool run canceled');
                return;
            }

            for (let t of tools) {
                if (t.getDisplayName() === result) {
                    await t.runTool();
                    return;
                }
            }

            vscode.window.showErrorMessage('Invalid tool entered');
            return;
        },
        addTool(tool: IToolRunner): void {
            tools.push(tool);
        },
        async deployCode(workspace: vscode.WorkspaceFolder): Promise<boolean> {
            if (codeDeployers.length <= 0) {
                vscode.window.showErrorMessage('No registered deployers');
                return false;
            }

            let prefs = await this.getPreferences(workspace);

            let availableDeployers = new Array<ICodeDeployer>();
            for (let d of codeDeployers) {
                if (await d.getIsCurrentlyValid(workspace)) {
                    availableDeployers.push(d);
                }
            }

            if (availableDeployers.length <= 0) {
                vscode.window.showErrorMessage('No registered deployers');
                return false;
            } else if (availableDeployers.length === 1) {
                if (prefs.getAutoSaveOnDeploy()) {
                    vscode.workspace.saveAll();
                }
//.........這裏部分代碼省略.........
開發者ID:ThadHouse,項目名稱:vscode-wpilib-core,代碼行數:101,代碼來源:extension.ts


注:本文中的vscode.workspace.saveAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。