當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript linesOperations.JoinLinesAction類代碼示例

本文整理匯總了TypeScript中vs/editor/contrib/linesOperations/linesOperations.JoinLinesAction的典型用法代碼示例。如果您正苦於以下問題:TypeScript JoinLinesAction類的具體用法?TypeScript JoinLinesAction怎麽用?TypeScript JoinLinesAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了JoinLinesAction類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: JoinLinesAction

				], {}, (editor, cursor) => {
					let model = editor.getModel();
					let joinLinesAction = new JoinLinesAction();

					editor.setSelections([
						/** primary cursor */
						new Selection(5, 2, 5, 2),
						new Selection(1, 2, 1, 2),
						new Selection(3, 2, 4, 2),
						new Selection(5, 4, 6, 3),
						new Selection(7, 5, 8, 4),
						new Selection(10, 1, 10, 1)
					]);

					joinLinesAction.run(null, editor);
					assert.equal(model.getLinesContent().join('\n'), 'hello world\nhello world\nhello world\nhello world\n\nhello world', '001');
					assert.deepEqual(editor.getSelections().toString(), [
						/** primary cursor */
						new Selection(3, 4, 3, 8),
						new Selection(1, 6, 1, 6),
						new Selection(2, 2, 2, 8),
						new Selection(4, 5, 4, 9),
						new Selection(6, 1, 6, 1)
					].toString(), '002');

					/** primary cursor */
					assert.deepEqual(editor.getSelection().toString(), new Selection(3, 4, 3, 8).toString(), '003');
				});
開發者ID:KTXSoftware,項目名稱:KodeStudio,代碼行數:28,代碼來源:linesOperations.test.ts


注:本文中的vs/editor/contrib/linesOperations/linesOperations.JoinLinesAction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。