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


TypeScript LanguageClient.createDefaultErrorHandler方法代码示例

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


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

示例1: realActivate


//.........这里部分代码省略.........
											directory = directory;
										}
										else if (workspaceFolderPath && directory) {
											directory = path.join(workspaceFolderPath, directory);
										}
										else {
											directory = undefined;
										}
										let filePath = document.uri.scheme === 'file' ? document.uri.fsPath : undefined;
										if (filePath && directory && filePath.startsWith(directory)) {
											if (workingDirectory) {
												if (workingDirectory.directory.length < directory.length) {
													workingDirectory.directory = directory;
													workingDirectory.changeProcessCWD = changeProcessCWD;
												}
											}
											else {
												workingDirectory = { directory, changeProcessCWD };
											}
										}
									}
								}
								settings.workingDirectory = workingDirectory;
							}
							result.push(settings);
						}
						return result;
					}
				} as WorkspaceMiddleware
			}
		};
		let client = new LanguageClient(linterName, serverOptions, clientOptions);
		client.registerProposedFeatures();
		defaultErrorHandler = client.createDefaultErrorHandler();
		const running = `${linterName} server is running.`;
		const stopped = `${linterName} server stopped.`;
		client.onDidChangeState((event) => {
			if (event.newState === ClientState.Running) {
				client.info(running);
				statusBarItem.tooltip = running;
				serverRunning = true;
			} else {
				client.info(stopped);
				statusBarItem.tooltip = stopped;
				serverRunning = false;
			}
			updateStatusBarVisibility(Window.activeTextEditor);
		});
		client.onReady().then(() => {
			client.onNotification(StatusNotification.type, (params) => {
				updateStatus(params.state);
			});

			client.onNotification(exitCalled, (params) => {
				serverCalledProcessExit = true;
				client.error(`Server process exited with code ${params[0]}. This usually indicates a misconfigured ${linterName} setup.`, params[1]);
				Window.showErrorMessage(`${linterName} server shut down itself. See '${linterName}' output channel for details.`);
			});

			client.onRequest(NoStandardLibraryRequest.type, (params) => {
				const key = 'noStandardMessageShown';
				let state = context.globalState.get<NoStandardState>(key, {});
				let uri: Uri = Uri.parse(params.source.uri);
				let workspaceFolder = Workspace.getWorkspaceFolder(uri);
				let config = Workspace.getConfiguration('standard');
				let linter = config.get('semistandard', false) ? 'semistandard' : 'standard';
开发者ID:chenxsan,项目名称:vscode-standardjs,代码行数:67,代码来源:extension.ts


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