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


TypeScript snippetController.SnippetController类代码示例

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


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

示例1: insertSnippet

	insertSnippet(template: string, ranges: EditorCommon.IRange[], opts: IUndoStopOptions) {

		if (!this._codeEditor) {
			return false;
		}

		const snippetController = SnippetController.get(this._codeEditor);

		// cancel previous snippet mode
		snippetController.leaveSnippet();

		// set selection, focus editor
		const selections = ranges.map(r => new Selection(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn));
		this._codeEditor.setSelections(selections);
		this._codeEditor.focus();

		// make modifications
		if (opts.undoStopBefore) {
			this._codeEditor.pushUndoStop();
		}
		snippetController.insertSnippet(template, 0, 0);
		if (opts.undoStopAfter) {
			this._codeEditor.pushUndoStop();
		}

		return true;
	}
开发者ID:thinhpham,项目名称:vscode,代码行数:27,代码来源:mainThreadEditor.ts

示例2:

		return quickOpenService.pick(picks).then(pick => {
			if (pick) {
				SnippetController.get(editor).run(CodeSnippet.fromTextmate(pick.snippet.codeSnippet), 0, 0);
			}
		});
开发者ID:asotog,项目名称:vscode,代码行数:5,代码来源:snippetCompletion.ts

示例3:

		return quickOpenService.pick(picks).then(pick => {
			if (pick) {
				SnippetController.get(editor).insertSnippet(pick.snippet.codeSnippet, 0, 0);
			}
		});
开发者ID:sandy081,项目名称:vscode,代码行数:5,代码来源:snippetCompletion.ts


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