本文整理匯總了TypeScript中vscode.window.showInformationMessage方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript window.showInformationMessage方法的具體用法?TypeScript window.showInformationMessage怎麽用?TypeScript window.showInformationMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode.window
的用法示例。
在下文中一共展示了window.showInformationMessage方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: applyCodeAction
function applyCodeAction(uri: string, documentVersion: number, edits: TextEdit[]) {
let textEditor = window.activeTextEditor;
if (textEditor && textEditor.document.uri.toString() === uri) {
if (textEditor.document.version !== documentVersion) {
window.showInformationMessage(`CSS fix is outdated and can't be applied to the document.`);
}
textEditor.edit(mutator => {
for (let edit of edits) {
mutator.replace(client.protocol2CodeConverter.asRange(edit.range), edit.newText);
}
}).then(success => {
if (!success) {
window.showErrorMessage('Failed to apply CSS fix to the document. Please consider opening an issue with steps to reproduce.');
}
});
}
}
示例2: open
let disposable = vscode.commands.registerCommand('extension.viewInBrowser', () => {
var editor = vscode.window.activeTextEditor;
if (!editor) {
vscode.window.showWarningMessage('no active text editor!');
return;
}
const file = editor.document.fileName;
const ext = path.extname(file);
if (/^\.(html|htm|shtml|xhtml)$/.test(ext)) {
open(`file:///${file}`);
} else {
vscode.window.showInformationMessage('support html file only!');
}
});
示例3: checkIfHasTestDirs
return checkIfHasTestDirs(rootDir).then(hasTests => {
if (!yes) {
return Promise.reject(null);
}
return vscode.window.showInformationMessage('You seem to have tests, would you like to enable a test framework?', yes, no, noNotAgain).then(item => {
if (!item || item === no) {
return Promise.reject(null);
}
if (item === yes) {
return promptToEnableAndConfigureTestFramework(outputChannel);
}
else {
const pythonConfig = vscode.workspace.getConfiguration('python');
return pythonConfig.update('unitTest.promptToConfigure', false);
}
});
});
示例4: switch
context.subscriptions.push(daemon.registerForDaemonShowMessage((l: ShowMessage) => {
const title = l.title.trim().endsWith(".") ? l.title.trim() : `${l.title.trim()}.`;
const message = `${title} ${l.message}`.trim();
switch (l.level) {
case "info":
window.showInformationMessage(message);
break;
case "warning":
window.showWarningMessage(message);
break;
case "error":
window.showErrorMessage(message);
break;
default:
logWarn(`Unexpected daemon.showMessage type: ${l.level}`);
}
}));
示例5: finishCleanup
async function finishCleanup(branch: git.BranchRef, branchType: string) {
console.assert(await branch.exists());
console.assert(await git.isClean());
const origin = git.RemoteRef.fromName('origin');
const remote = git.BranchRef.fromName(origin.name + '/' + branch.name);
if (config.deleteBranchOnFinish) {
if (config.deleteRemoteBranches && await remote.exists()) {
// Delete the branch on the remote
await git.push(
git.RemoteRef.fromName('origin'),
git.BranchRef.fromName(`:refs/heads/${branch.name}`));
}
await cmd.executeRequired(git.info.path, ['branch', '-d', branch.name]);
}
vscode.window.showInformationMessage(
`${branchType.substring(0, 1).toUpperCase()}${branchType.substring(1)} branch ${branch.name} has been closed`);
}
示例6: displayTestFrameworkError
export function displayTestFrameworkError(outputChannel: vscode.OutputChannel): Thenable<any> {
let enabledCount = settings.unitTest.pyTestEnabled ? 1 : 0;
enabledCount += settings.unitTest.nosetestsEnabled ? 1 : 0;
enabledCount += settings.unitTest.unittestEnabled ? 1 : 0;
if (enabledCount > 1) {
return promptToEnableAndConfigureTestFramework(outputChannel, 'Enable only one of the test frameworks (unittest, pytest or nosetest).', true);
}
else {
const option = 'Enable and configure a Test Framework';
return vscode.window.showInformationMessage('No test framework configured (unittest, pytest or nosetest)', option).then(item => {
if (item === option) {
return promptToEnableAndConfigureTestFramework(outputChannel);
}
return Promise.reject(null);
});
}
}
示例7: function
vscode.workspace.openTextDocument(fileName).then(function(textDocument) {
if (!textDocument) {
vscode.window.showInformationMessage('Can not open file!');
return;
}
vscode.window.showTextDocument(textDocument).then(function(editor) {
if (!editor) {
vscode.window.showInformationMessage('Can not show document!');
return;
}
vscode.window.showInformationMessage('After editing the file, remember to Restart VScode');
}, function() {
vscode.window.showInformationMessage('Can not Show file: ' + fileName);
return;
});
}, function() {
示例8: async
const _validateTranslation = async (docUri) => {
outputChannel.appendLine(`validating translation ${docUri}...`)
outputChannel.show(true)
spin(true)
try {
const result = await validateTranslations({ rootPath: docUri, schemaPath: schema, logger: logger })
spin(false)
outputChannel.appendLine(result)
await vscode.window.showInformationMessage(result)
outputChannel.show(true)
} catch(err) {
spin(false)
outputChannel.appendLine(err.message)
await vscode.window.showErrorMessage(err.message)
outputChannel.show(true)
}
}
示例9: applyTextEdits
return function applyTextEdits(uri: string, documentVersion: number, edits: TextEdit[]) {
const textEditor = window.activeTextEditor;
if (textEditor && textEditor.document.uri.toString() === uri) {
if (textEditor.document.version !== documentVersion) {
window.showInformationMessage(`Spelling changes are outdated and cannot be applied to the document.`);
}
textEditor.edit(mutator => {
for (const edit of edits) {
mutator.replace(client.protocol2CodeConverter.asRange(edit.range), edit.newText);
}
}).then((success) => {
if (!success) {
window.showErrorMessage('Failed to apply spelling changes to the document.');
}
});
}
};
示例10: activate
export function activate(context: ExtensionContext) {
let lastValue: string | undefined;
window.showInformationMessage(`注意:當前項目的 html 元素的 font-size 為${config.htmlFontSize}px。`);
let px2remCommand = commands.registerTextEditorCommand('extension.px2rem', (textEditor, edit) => {
px2rem(textEditor, edit);
});
let px2emCommand = commands.registerTextEditorCommand('extension.px2em', async (textEditor, edit) => {
let value = await px2em(textEditor, lastValue);
if (value) {
lastValue = value;
}
});
context.subscriptions.push(px2remCommand, px2emCommand);
}