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


TypeScript window.showErrorMessage方法代码示例

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


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

示例1: alreadyExistsError

export function alreadyExistsError () {
    
    Window.showErrorMessage('\'package.json\' already exists');
};
开发者ID:Gigitsu,项目名称:vscode-npm,代码行数:4,代码来源:messages.ts

示例2: Promise

        return await new Promise((resolve, reject) => {
            token.onCancellationRequested(reject);
            let configPath = util.configPath();
            logger.dbg('config file: ' + configPath);

            try {
                fs.accessSync(configPath);
            }
            catch (err) {
                logger.dbg('error accessing config file: ' + err);
                vsc.window.showErrorMessage('The uncrustify config file path is incorrect: ' + configPath);
                reject(err);
                return;
            }

            let args = ['-l', languageMap[document.languageId], '-c', configPath];
            let output = '';
            let error = '';

            if (range) {
                args.push('--frag');
            }

            // This option helps you if the document saved as UTF8 with BOM, though not able to format it partially.
            if (util.useReplaceOption()) {
                args.push('--replace');
                args.push('--no-backup');
                args.push(document.fileName);
            }

            let uncrustify = cp.spawn(util.executablePath(), args);
            logger.dbg(`launched: ${util.executablePath()} ${args.join(' ')}`);

            uncrustify.on('error', reject);
            uncrustify.on('exit', code => {
                logger.dbg('uncrustify exited with status: ' + code);
                if (code < 0) {
                    vsc.window.showErrorMessage('Uncrustify exited with error code: ' + code);
                    reject(code);
                }
            });

            uncrustify.stdout.on('data', data => output += data.toString());
            uncrustify.stdout.on('close', () => {
                if (output.length) {
                    let lastLine = document.lineCount - 1;
                    let lastCol = document.lineAt(lastLine).text.length;
                    resolve([new vsc.TextEdit(range || new vsc.Range(0, 0, lastLine, lastCol), output)]);
                }
                else {
                    reject();
                }
            });

            uncrustify.stderr.on('data', data => error += data.toString());
            uncrustify.stderr.on('close', () => logger.dbg('uncrustify exited with error: ' + error));

            if (!util.useReplaceOption()) {
                uncrustify.stdin.write(document.getText(range));
                uncrustify.stdin.end();
            }
        });
开发者ID:LaurentTreguier,项目名称:vscode-uncrustify,代码行数:62,代码来源:formatter.ts

示例3: function

            myGi.DownloadGist(gist).then(async function(res: any) {
                var keys = Object.keys(res.files);
                if (keys[0].indexOf(".")<0) {
                    vscode.window.showErrorMessage("GIST Not Compatible With this version, Please Reset Settings. Important Release note has been opened in browser.");
                    openurl("http://shanalikhan.github.io/2016/03/19/Visual-Studio-code-sync-setting-migration.html");
                    return;
                }
                for (var i: number = 0; i < keys.length; i++) {
                    switch (keys[i]) {
                        case "launch.json": {
                            await fileManager.FileManager.WriteFile(en.FILE_LAUNCH, res.files["launch.json"].content).then(
                                function(added: boolean) {
                                    vscode.window.showInformationMessage("Launch Settings downloaded Successfully");
                                }, function(error: any) {
                                    vscode.window.showErrorMessage(common.ERROR_MESSAGE);
                                    return;
                                }
                            );
                            break;
                        }
                        case "settings.json": {
                            await fileManager.FileManager.WriteFile(en.FILE_SETTING, res.files["settings.json"].content).then(
                                function(added: boolean) {
                                    vscode.window.showInformationMessage("Editor Settings downloaded Successfully");
                                }, function(error: any) {
                                    vscode.window.showErrorMessage(common.ERROR_MESSAGE);
                                    return;
                                });
                            break;
                        }
                        case "keybindings.json": {

                            await fileManager.FileManager.WriteFile(en.FILE_KEYBINDING, res.files["keybindings.json"].content).then(
                                function(added: boolean) {
                                    vscode.window.showInformationMessage("Keybinding Settings downloaded Successfully");
                                }, function(error: any) {
                                    vscode.window.showErrorMessage(common.ERROR_MESSAGE);
                                    return;
                                });
                            break;
                        }
                        case "extensions.json": {
                            var remoteList = pluginService.ExtensionInformation.fromJSONList(res.files["extensions.json"].content);
                            var missingList = pluginService.PluginService.GetMissingExtensions(remoteList);
                            if (missingList.length == 0) {
                                vscode.window.showInformationMessage("No extension need to be installed");
                            }
                            else {
                                var actionList = new Array<Promise<void>>();
                                vscode.window.setStatusBarMessage("Installing Extensions in background.", 4000);
                                missingList.forEach(element => {
                                    actionList.push(pluginService.PluginService.InstallExtension(element, en.ExtensionFolder)
                                        .then(function() {
                                            var name = element.publisher + '.' + element.name + '-' + element.version;
                                            vscode.window.showInformationMessage("Extension " + name + " installed Successfully");
                                        }));
                                });
                                Promise.all(actionList)
                                    .then(function() {
                                        vscode.window.showInformationMessage("Extension installed Successfully, please restart");
                                    })
                                    .catch(function(e) {
                                        console.log(e);
                                        vscode.window.showErrorMessage("Extension download failed." + common.ERROR_MESSAGE)
                                    });
                            }
                            break;
                        }
                        default: {
                            if (i < keys.length) {
                                await fileManager.FileManager.CreateDirectory(en.FOLDER_SNIPPETS);

                                var file = en.FOLDER_SNIPPETS.concat(keys[i]);//.concat(".json");
                                var fileName = keys[i]//.concat(".json");
                                await fileManager.FileManager.WriteFile(file, res.files[keys[i]].content).then(
                                    function(added: boolean) {
                                        vscode.window.showInformationMessage(fileName + " snippet added successfully.");
                                    }, function(error: any) {
                                        vscode.window.showErrorMessage(common.ERROR_MESSAGE);
                                        return;
                                    }
                                );
                            }
                            break;
                        }
                    }
                }
            }, function(err: any) {
开发者ID:camilohe,项目名称:code-settings-sync,代码行数:88,代码来源:extension.ts

示例4: function

		.on('error', function(error) {
			adapter.logError(error);
			vscode.window.showErrorMessage('bower init failed! View Output window for further details');
		}).on('log', function(msg) {
开发者ID:Tyriar,项目名称:bowerVSCode,代码行数:4,代码来源:init.ts

示例5: startLanguageServer

async function startLanguageServer() {
    // let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] };

    let jlEnvPath = '';
    try {
        jlEnvPath = await jlpkgenv.getEnvPath();
    }
    catch (e) {

        vscode.window.showErrorMessage('Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary.');
        vscode.window.showErrorMessage(e)
        return;
    }
    let oldDepotPath = process.env.JULIA_DEPOT_PATH ? process.env.JULIA_DEPOT_PATH : "";
    let serverArgsRun = ['--startup-file=no', '--history-file=no', 'main.jl', jlEnvPath, '--debug=no', g_lscrashreportingpipename, oldDepotPath];
    let serverArgsDebug = ['--startup-file=no', '--history-file=no', 'main.jl', jlEnvPath, '--debug=yes', g_lscrashreportingpipename, oldDepotPath];    
    let spawnOptions = {
        cwd: path.join(g_context.extensionPath, 'scripts', 'languageserver'),
        env: {
            JULIA_DEPOT_PATH: path.join(g_context.extensionPath, 'scripts', 'languageserver', 'julia_pkgdir'),
            HOME: process.env.HOME ? process.env.HOME : os.homedir()
        }
    };

    let jlexepath = await juliaexepath.getJuliaExePath();

    let serverOptions = {
        run: { command: jlexepath, args: serverArgsRun, options: spawnOptions },
        debug: { command: jlexepath, args: serverArgsDebug, options: spawnOptions }
    };

    let clientOptions: LanguageClientOptions = {
        documentSelector: ['julia', 'juliamarkdown'],
        synchronize: {
            configurationSection: ['julia.runLinter', 'julia.lintIgnoreList'],
            fileEvents: vscode.workspace.createFileSystemWatcher('**/*.jl')
        },
        revealOutputChannelOn: RevealOutputChannelOn.Never
    }

        // Create the language client and start the client.
    g_languageClient = new LanguageClient('julia Language Server', serverOptions, clientOptions);
    g_languageClient.registerProposedFeatures()

    // Push the disposable to the context's subscriptions so that the
    // client can be deactivated on extension deactivation
    try {
        g_context.subscriptions.push(g_languageClient.start());
        setLanguageClient(g_languageClient);
    }
    catch (e) {

        vscode.window.showErrorMessage('Could not start the julia language server. Make sure the configuration setting julia.executablePath points to the julia binary.');
        g_languageClient = null;
    }

    // g_languageClient.onReady().then(() => {
    //     g_languageClient.onNotification(g_serverBusyNotification, () => {
    //         g_serverstatus.show();
    //     })

    //     g_languageClient.onNotification(g_serverReadyNotification, () => {
    //         g_serverstatus.hide();
    //     })
    // })
}
开发者ID:JuliaEditorSupport,项目名称:julia-vscode,代码行数:66,代码来源:extension.ts

示例6: function

 export const error = function(message: string, level?: LogLevel): void {
     if (logLevel >= LogLevel.error || level >= LogLevel.error) {
         console.error(message);
         window.showErrorMessage(message);
     }
 }
开发者ID:theor,项目名称:vscode-ghc-mod,代码行数:6,代码来源:logger.ts

示例7: handleError

 function handleError(errorMessage: string): void {
   window.showErrorMessage(errorMessage);
 }
开发者ID:jlroettger,项目名称:vscode-npm-source,代码行数:3,代码来源:extension.ts

示例8: activate

export async function activate(context: ExtensionContext) {

  // sbt command support
  context.subscriptions.push(new Sbt(context));

  // find JDK_HOME or JAVA_HOME
  const req = new Requirements();
  let javaHome;
  try {
    javaHome = await req.getJavaHome();
  } catch (pathNotFound) {
    window.showErrorMessage(pathNotFound);
    return;
  }

  const toolsJar = javaHome + '/lib/tools.jar';
  console.info('Adding to classpath ' + toolsJar);

  // The server is implemented in Scala
  const coursierPath = path.join(context.extensionPath, './coursier');
  console.info('Using coursier ' + coursierPath);

  console.log('Workspace location is: ' + workspace.rootPath);

  let proxyArgs = [];
  const proxySettings = workspace.getConfiguration().get('http.proxy').toString();
  if (proxySettings !== '') {
    console.log('Using proxy: ' + proxySettings);
    const proxyUrl = URL.parse(proxySettings);
    const javaProxyHttpHost = '-Dhttp.proxyHost=' + proxyUrl.hostname;
    const javaProxyHtppPort = '-Dhttp.proxyPort=' + proxyUrl.port;
    const javaProxyHttpsHost = '-Dhttps.proxyHost=' + proxyUrl.hostname;
    const javaProxyHttpsPort = '-Dhttps.proxyPort=' + proxyUrl.port;
    proxyArgs = [javaProxyHttpHost,javaProxyHtppPort,javaProxyHttpsHost,javaProxyHttpsPort];
  } else proxyArgs = [];
  const logLevel = workspace.getConfiguration().get('scalaLanguageServer.logLevel');
  let logLevelStr = '';
  if (logLevel != null) logLevelStr = logLevel.toString();

  const heapSize = workspace.getConfiguration().get('scalaLanguageServer.heapSize');
  let heapSizeStr = '-Xmx768M';
  if (heapSize != null) heapSizeStr = '-Xmx' + heapSize.toString();

  // tslint:disable-next-line:max-line-length
  const coursierArgs = ['launch', '-r', 'https://dl.bintray.com/dhpcs/maven', '-r', 'sonatype:releases', '-J', toolsJar, 'com.github.dragos:ensime-lsp_2.12:0.2.3', '-M', 'org.github.dragos.vscode.Main'];

  const javaArgs = proxyArgs.concat([
    heapSizeStr,
    '-Dvscode.workspace=' + workspace.rootPath,
    '-Dvscode.logLevel=' + logLevel,
    '-Densime.index.no.reverse.lookups=true',
    '-jar', coursierPath,
  ]).concat(coursierArgs);

  // The debug options for the server
  // tslint:disable-next-line:max-line-length
  const debugOptions = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000,quiet=y'];

  // If the extension is launched in debug mode then the debug server options are used
  // Otherwise the run options are used
  const serverOptions: ServerOptions = {
    run: { command: 'java', args: javaArgs },
    debug: { command: 'java', args: debugOptions.concat(javaArgs) },
  };

  // Options to control the language client
  const clientOptions: LanguageClientOptions = {
    // Register the server for plain text documents
    documentSelector: [
      { language: 'scala', scheme: 'file' },
      { language: 'scala', scheme: 'untitled' },
    ],
    synchronize: {
      // // Synchronize the setting section 'languageServerExample' to the server
      // configurationSection: 'languageServerExample',
      // Notify the server about file changes to '.clientrc files contain in the workspace
      fileEvents: workspace.createFileSystemWatcher(workspace.rootPath + '/.ensime'),
    },
  };

  // Create the language client and start the client.
  // tslint:disable-next-line:max-line-length
  const disposable = new LanguageClient('Scala Server', serverOptions, clientOptions, false).start();

  // Push the disposable to the context's subscriptions so that the
  // client can be deactivated on extension deactivation
  context.subscriptions.push(disposable);

  // Taken from the Java plugin, this configuration can't be (yet) defined in the
  //  `scala.configuration.json` file
  languages.setLanguageConfiguration('scala', {
    onEnterRules: [
      {
        // e.g. /** | */
        beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
        afterText: /^\s*\*\/$/,
        action: { indentAction: IndentAction.IndentOutdent, appendText: ' * ' },
      },
      {
        // e.g. /** ...|
//.........这里部分代码省略.........
开发者ID:dragos,项目名称:dragos-vscode-scala,代码行数:101,代码来源:extension.ts

示例9:

 .catch(err => window.showErrorMessage(err));
开发者ID:d4rkr00t,项目名称:vscode-open-in-github,代码行数:1,代码来源:common.ts

示例10:

 child_process.exec(`${codePath} ${folderPath} ${rFlag}`, err => {
     if (err) {
         vscode.window.showErrorMessage(`Error: Ensure that your 'codeFileNav.codePath.${platform}' configuration is correct.`)
     }
 });
开发者ID:jakelucas,项目名称:code-file-nav,代码行数:5,代码来源:commands.ts


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