• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript errors.onUnexpectedError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/base/common/errors.onUnexpectedError函数的典型用法代码示例。如果您正苦于以下问题:TypeScript onUnexpectedError函数的具体用法?TypeScript onUnexpectedError怎么用?TypeScript onUnexpectedError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _safeCallOnDomNodeTop

	private _safeCallOnDomNodeTop(zone: IViewZone, top: number): void {
		if (typeof zone.onDomNodeTop === 'function') {
			try {
				zone.onDomNodeTop(top);
			} catch (e) {
				onUnexpectedError(e);
			}
		}
	}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:9,代码来源:viewZones.ts


示例2: _safeCallOnComputedHeight

	private _safeCallOnComputedHeight(zone: IViewZone, height: number): void {
		if (typeof zone.onComputedHeight === 'function') {
			try {
				zone.onComputedHeight(height);
			} catch (e) {
				onUnexpectedError(e);
			}
		}
	}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:9,代码来源:viewZones.ts


示例3: _getLanguageDefinedShouldAutoClose

	private static _getLanguageDefinedShouldAutoClose(languageIdentifier: LanguageIdentifier): (ch: string) => boolean {
		try {
			const autoCloseBeforeSet = LanguageConfigurationRegistry.getAutoCloseBeforeSet(languageIdentifier.id);
			return c => autoCloseBeforeSet.indexOf(c) !== -1;
		} catch (e) {
			onUnexpectedError(e);
			return autoCloseNever;
		}
	}
开发者ID:KTXSoftware,项目名称:KodeStudio,代码行数:9,代码来源:cursorCommon.ts


示例4: Error

	$onUnexpectedError(err: any | SerializedError, extensionId: string | undefined): void {
		if (err.$isError) {
			const { name, message, stack } = err;
			err = new Error();
			err.message = extensionId ? `[${extensionId}] ${message}` : message;
			err.name = name;
			err.stack = stack;
		}
		onUnexpectedError(err);
	}
开发者ID:SeanKilleen,项目名称:vscode,代码行数:10,代码来源:mainThreadErrors.ts


示例5: Error

	$onUnexpectedError(err: any | SerializedError): void {
		if (err && err.$isError) {
			const { name, message, stack } = err;
			err = new Error();
			err.message = message;
			err.name = name;
			err.stack = stack;
		}
		onUnexpectedError(err);
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:10,代码来源:mainThreadErrors.ts


示例6: _isAutoClosingOpenCharType

	private static _isAutoClosingOpenCharType(config: CursorConfiguration, model: ITextModel, selections: Selection[], ch: string): boolean {
		if (!config.autoClosingBrackets || !config.autoClosingPairsOpen.hasOwnProperty(ch)) {
			return false;
		}

		for (let i = 0, len = selections.length; i < len; i++) {
			const selection = selections[i];
			if (!selection.isEmpty()) {
				return false;
			}

			const position = selection.getPosition();
			const lineText = model.getLineContent(position.lineNumber);

			// Do not auto-close ' or " after a word character
			if ((ch === '\'' || ch === '"') && position.column > 1) {
				const wordSeparators = getMapForWordSeparators(config.wordSeparators);
				const characterBeforeCode = lineText.charCodeAt(position.column - 2);
				const characterBeforeType = wordSeparators.get(characterBeforeCode);
				if (characterBeforeType === WordCharacterClass.Regular) {
					return false;
				}
			}

			// Only consider auto closing the pair if a space follows or if another autoclosed pair follows
			const characterAfter = lineText.charAt(position.column - 1);
			if (characterAfter) {
				let isBeforeCloseBrace = TypeOperations._isBeforeClosingBrace(config, ch, characterAfter);
				if (!isBeforeCloseBrace && !/\s/.test(characterAfter)) {
					return false;
				}
			}

			if (!model.isCheapToTokenize(position.lineNumber)) {
				// Do not force tokenization
				return false;
			}

			model.forceTokenization(position.lineNumber);
			const lineTokens = model.getLineTokens(position.lineNumber);

			let shouldAutoClosePair = false;
			try {
				shouldAutoClosePair = LanguageConfigurationRegistry.shouldAutoClosePair(ch, lineTokens, position.column);
			} catch (e) {
				onUnexpectedError(e);
			}

			if (!shouldAutoClosePair) {
				return false;
			}
		}

		return true;
	}
开发者ID:liunian,项目名称:vscode,代码行数:55,代码来源:cursorTypeOperations.ts


示例7: _typeInterceptorAutoClosingOpenChar

	private static _typeInterceptorAutoClosingOpenChar(config: CursorConfiguration, model: ITokenizedModel, cursor: SingleCursorState, ch: string): EditOperationResult {
		if (!config.autoClosingBrackets) {
			return null;
		}

		let selection = cursor.selection;

		if (!selection.isEmpty() || !config.autoClosingPairsOpen.hasOwnProperty(ch)) {
			return null;
		}

		let position = cursor.position;
		let lineText = model.getLineContent(position.lineNumber);
		let beforeCharacter = lineText.charAt(position.column - 1);

		// Only consider auto closing the pair if a space follows or if another autoclosed pair follows
		if (beforeCharacter) {
			let thisBraceIsSymmetric = (config.autoClosingPairsOpen[ch] === ch);

			let isBeforeCloseBrace = false;
			for (let otherCloseBrace in config.autoClosingPairsClose) {
				let otherBraceIsSymmetric = (config.autoClosingPairsOpen[otherCloseBrace] === otherCloseBrace);
				if (!thisBraceIsSymmetric && otherBraceIsSymmetric) {
					continue;
				}
				if (beforeCharacter === otherCloseBrace) {
					isBeforeCloseBrace = true;
					break;
				}
			}
			if (!isBeforeCloseBrace && !/\s/.test(beforeCharacter)) {
				return null;
			}
		}

		let lineTokens = model.getLineTokens(position.lineNumber, false);

		let shouldAutoClosePair = false;
		try {
			shouldAutoClosePair = LanguageConfigurationRegistry.shouldAutoClosePair(ch, lineTokens, position.column);
		} catch (e) {
			onUnexpectedError(e);
		}

		if (!shouldAutoClosePair) {
			return null;
		}

		let closeCharacter = config.autoClosingPairsOpen[ch];
		return new EditOperationResult(new ReplaceCommandWithOffsetCursorState(selection, ch + closeCharacter, 0, -closeCharacter.length), {
			shouldPushStackElementBefore: true,
			shouldPushStackElementAfter: false
		});
	}
开发者ID:yuit,项目名称:vscode,代码行数:54,代码来源:cursorTypeOperations.ts


示例8: _handle

	private _handle(): void {
		if (this._handler === null || this._users === null || this._delta === null) {
			return;
		}

		try {
			this._handler(this._users, this._delta);
		} catch (err) {
			onUnexpectedError(err);
		}
	}
开发者ID:joelday,项目名称:vscode,代码行数:11,代码来源:extensionsRegistry.ts


示例9: _typeInterceptorElectricChar

	private static _typeInterceptorElectricChar(config: CursorConfiguration, model: ITokenizedModel, cursor: SingleCursorState, ch: string): EditOperationResult {
		if (!config.electricChars.hasOwnProperty(ch)) {
			return null;
		}

		let position = cursor.position;
		let lineTokens = model.getLineTokens(position.lineNumber, false);

		let electricAction: IElectricAction;
		try {
			electricAction = LanguageConfigurationRegistry.onElectricCharacter(ch, lineTokens, position.column);
		} catch (e) {
			onUnexpectedError(e);
		}

		if (!electricAction) {
			return null;
		}

		if (electricAction.appendText) {
			return new EditOperationResult(new ReplaceCommandWithOffsetCursorState(cursor.selection, ch + electricAction.appendText, 0, -electricAction.appendText.length), {
				shouldPushStackElementBefore: false,
				shouldPushStackElementAfter: true
			});
		}

		if (electricAction.matchOpenBracket) {
			let match = model.findMatchingBracketUp(electricAction.matchOpenBracket, {
				lineNumber: position.lineNumber,
				column: position.column
			});

			if (match) {
				let matchLine = model.getLineContent(match.startLineNumber);
				let matchLineIndentation = strings.getLeadingWhitespace(matchLine);
				let newIndentation = config.normalizeIndentation(matchLineIndentation);

				let lineText = model.getLineContent(position.lineNumber);
				let lineFirstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(position.lineNumber) || position.column;

				let prefix = lineText.substring(lineFirstNonBlankColumn - 1, position.column - 1);
				let typeText = newIndentation + prefix + ch;

				let typeSelection = new Range(position.lineNumber, 1, position.lineNumber, position.column);

				return new EditOperationResult(new ReplaceCommand(typeSelection, typeText), {
					shouldPushStackElementBefore: false,
					shouldPushStackElementAfter: true
				});
			}
		}

		return null;
	}
开发者ID:StateFarmIns,项目名称:vscode,代码行数:54,代码来源:cursorTypeOperations.ts


示例10: catch

			TPromise.timeout(50).done(() => {

				// Some actions are enabled only when editor has focus
				this.editor.focus();

				try {
					let promise = this.action.run() || TPromise.as(null);
					promise.done(null, onUnexpectedError);
				} catch (error) {
					onUnexpectedError(error);
				}
			}, onUnexpectedError);
开发者ID:StateFarmIns,项目名称:vscode,代码行数:12,代码来源:quickCommand.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript errors.onUnexpectedExternalError函数代码示例发布时间:2022-05-25
下一篇:
TypeScript errors.notImplemented函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap