當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。