当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript window.showInputBox方法代码示例

本文整理汇总了TypeScript中vscode.window.showInputBox方法的典型用法代码示例。如果您正苦于以下问题:TypeScript window.showInputBox方法的具体用法?TypeScript window.showInputBox怎么用?TypeScript window.showInputBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode.window的用法示例。


在下文中一共展示了window.showInputBox方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: uploadToGist

 function uploadToGist(filename: string, code: string, userName: string = null, userPass: string = null) {
     vscode.window.showInputBox({ 
         placeHolder: 'Description of your file' 
     }).then((desc: string) => {
         let data = {
             "description": desc,
             "public": true,
             "files": {}
         }
         data.files[filename] = {"content": code};
         
         let opts = {
             url: 'https://api.github.com/gists',
             body: data,
             json: true,
             headers: {
                 'User-Agent': 'request'
             }
         }
         
         if (userName != null && userPass != null) {
             opts['auth'] = {
                 user: userName,
                 pass: userPass
             }
         }
         
         request.post(opts, (err, httpResponse, body) => {
             vscode.window.showInformationMessage("Your File is published here: " + body.html_url);
             opn(body.html_url)
         });
     })
 }
开发者ID:gitter-badger,项目名称:VSCode-ShareCode,代码行数:33,代码来源:extension.ts

示例2: version

 Window.showInformationMessage('This feature is experimental... (close this to continue)').then(() => {
     
     return Window.showInputBox({
         prompt: 'Optional version (enter to deprecate all versions)',
         placeHolder: '< 0.2.3, 1.0.0, ...'
     })
 })
开发者ID:Gigitsu,项目名称:vscode-npm,代码行数:7,代码来源:deprecate.ts

示例3: creatInputBox

function creatInputBox(param: string): Thenable<string | undefined> {
    return vscode.window.showInputBox({
        prompt: `Set ${param} of the png.`,
        placeHolder: `${param}`,
        validateInput: checkSizeInput
    });
}
开发者ID:kexi,项目名称:vscode-svgviewer,代码行数:7,代码来源:extension.ts

示例4: setInterval

                    window.showInputBox({ value: undefined, prompt: Strings.SendFeedbackPrompt, placeHolder: undefined, password: false }).then((value) => {
                        if (value === undefined) {
                            let disposable = window.setStatusBarMessage(Strings.NoFeedbackSent);
                            setInterval(() => disposable.dispose(), 1000 * 5);
                            return;
                        }

                        //User does not need to provide any feedback text
                        let providedEmail: string = "";
                        window.showInputBox({ value: undefined, prompt: Strings.SendEmailPrompt, placeHolder: undefined, password: false }).then((email) => {
                            if (email === undefined) {
                                let disposable = window.setStatusBarMessage(Strings.NoFeedbackSent);
                                setInterval(() => disposable.dispose(), 1000 * 5);
                                return;
                            }
                            if (email) {
                                providedEmail = email;
                            }
                            //This feedback will go no matter whether Application Insights is enabled or not.
                            self.ReportFeedback(choice.id, { "VSCode.Feedback.Comment" : value, "VSCode.Feedback.Email" : providedEmail} );

                            let disposable = window.setStatusBarMessage(Strings.ThanksForFeedback);
                            setInterval(() => disposable.dispose(), 1000 * 5);
                        });
                    });
开发者ID:chrisdias,项目名称:vsts-vscode,代码行数:25,代码来源:feedbackclient.ts

示例5: runNgCommand

export var ngnew = vscode.commands.registerCommand('extension.ngNew', () => {
    let project = vscode.window.showInputBox({ placeHolder: 'name of your project' }).then(
        (data) => {
            runNgCommand(['new', data], true);
        }
    )
});
开发者ID:web-dave,项目名称:vsc-angular-cli,代码行数:7,代码来源:new.ts

示例6:

    let disposable = vscode.commands.registerCommand('extension.openURL', () => {
        let opts: vscode.InputBoxOptions = {
            prompt: "URL",
            value: "https://",
            validateInput: (url) => {
                if (urlIsValid(url)) {
                    return null;
                }
                return "Invalid URL.";
            },
        };
        vscode.window.showInputBox(opts).then(
            (url) => {
                if (!urlIsValid(url)) {
                    return;
                }

                let uri = vscode.Uri.parse(url);

                // Determine column to place browser in.
                let col: vscode.ViewColumn;
                let ae = vscode.window.activeTextEditor;
                if (ae != undefined) {
                    col = ae.viewColumn || vscode.ViewColumn.One;
                } else {
                    col = vscode.ViewColumn.One;
                }

                return vscode.commands.executeCommand('vscode.previewHtml', uri, col).then((success) => {
                }, (reason) => {
                    vscode.window.showErrorMessage(reason);
                }
                );
            });
    });
开发者ID:masonicboom,项目名称:vscode-web-browser,代码行数:35,代码来源:extension.ts

示例7: showSearch

// Shows search box and searches
function showSearch() {
    vscode.window.showInputBox({
        placeHolder: "Type the package name or search term."
    }).then(searchValue => {

        vscode.window.setStatusBarMessage("Loading packages...");
        
        axios.get(API_URL_SEARCH, {
            params: {
                q: searchValue,
                prerelease: true,
                take: 100
            }
        }).then(response => {
            var packageList = response.data.data;

            if (packageList.length < 1) {
                Helpers.throwError("No results found. Please try again.");
            } else {
                vscode.window.showQuickPick(packageList)
                    .then(packageName => {
                        if (packageName) {
                            showVersionChooser(packageName);
                        }
                    });
            }
            vscode.window.setStatusBarMessage("");            
        }).catch(error => {
            vscode.window.setStatusBarMessage("");
            
            console.error(error);
            Helpers.throwError("Could not connect to Nuget server.");
        });
    });
}
开发者ID:KSubedi,项目名称:net-core-project-manager,代码行数:36,代码来源:add.ts

示例8: installBuildFileCommand

export async function installBuildFileCommand() {
    // Check if there is an open folder in workspace
    if (workspace.rootPath === undefined) {
        window.showErrorMessage('You have not yet opened a folder.');
        return;
    }

    var name = await window.showInputBox({
        placeHolder: messages.PROMPT_SCRIPT_NAME,
        value: DEFAULT_SCRIPT_NAME
    });

    if (!name) {
        window.showWarningMessage('No script name provided! Try again and make sure to provide a file name.');
        return;
    }

    var result = await installBuildFile(name);

    if (result) {
        window.showInformationMessage("Sample psake build file successfully created.");
    } else {
        window.showErrorMessage("Error creating sample psake buile file.");
    }
}
开发者ID:psake,项目名称:psake-vscode,代码行数:25,代码来源:psakeBuildFileCommand.ts

示例9: pullFrom

	@command('git.pullFrom')
	async pullFrom(): Promise<void> {
		const remotes = this.model.remotes;

		if (remotes.length === 0) {
			window.showWarningMessage(localize('no remotes to pull', "Your repository has no remotes configured to pull from."));
			return;
		}

		const picks = remotes.map(r => ({ label: r.name, description: r.url }));
		const placeHolder = localize('pick remote pull repo', "Pick a remote to pull the branch from");
		const pick = await window.showQuickPick(picks, { placeHolder });

		if (!pick) {
			return;
		}

		const branchName = await window.showInputBox({
			placeHolder: localize('branch name', "Branch name"),
			prompt: localize('provide branch name', "Please provide a branch name"),
			ignoreFocusOut: true
		});

		if (!branchName) {
			return;
		}

		this.model.pull(false, pick.label, branchName);
	}
开发者ID:Chan-PH,项目名称:vscode,代码行数:29,代码来源:commands.ts

示例10: searchFor

	var disposable = vscode.commands.registerCommand(cInfo.command("search"), () => {
		// The code you place here will be executed every time your command is executed

		// Get the active editor
		let editor = vscode.window.activeTextEditor;
		let selectedText = "";
		if (editor) {
			// Get the selected text
			let selection = editor.selection;
			selectedText = editor.document.getText(selection);
		}
		// Get config settings
		let config = vscode.workspace.getConfiguration(cInfo.group);
		let useDefaultOnly = config.get<boolean>(cKeys.useDefaultProviderOnly)
		let useDefaultForSelection = config.get<boolean>(cKeys.alwaysUseDefaultForSelection)
		let skipInputForSelection = config.get<boolean>(cKeys.noInputBoxIfTextSelected)

		if (!utils.isNullOrEmpty(selectedText) && skipInputForSelection) {
			searchFor(selectedText, true);
		} else {
			if (!utils.isNullOrEmpty(selectedText) && useDefaultForSelection) {
				useDefaultOnly = true
			}
			// In order to do so, setup some options. 
			let options: vscode.InputBoxOptions = {
				prompt: "Enter provider code followed by query",	// <- The text to display underneath the input box. 
				value: selectedText,								// <- The value to prefill in the input box. Here we use the selected text.
				placeHolder: "Query"								// <- An optional string to show as place holder in the input box to guide the user what to type.
			}
			vscode.window.showInputBox(options).then((q) =>
				searchFor(q, (useDefaultOnly || utils.startsWith(q, selectedText)))
			);
		}
	});
开发者ID:awebdeveloper,项目名称:code-bing,代码行数:34,代码来源:extension.ts


注:本文中的vscode.window.showInputBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。