Skip to content

Commit a498a70

Browse files
committed
feat: go to line will accept :ln:col format along with :ln,col
1 parent ad95682 commit a498a70

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/search/QuickOpen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ define(function (require, exports, module) {
8989
* @private
9090
* @const {RegExp}
9191
*/
92-
var CURSOR_POS_EXP = new RegExp(":([^,]+)?(,(.+)?)?");
92+
var CURSOR_POS_EXP = new RegExp(":([^,:]+)?([,:](.+)?)?");
9393

9494
/**
9595
* Current plugin

test/spec/QuickOpen-integ-test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,21 @@ define(function (require, exports, module) {
182182
it("can directly open a file in a given line and column, centering that line on the screen", async function () {
183183
await quickOpenTest("lines:150,20", null, "lotsOfLines.html", 150, 20);
184184
});
185+
186+
it("can open a file and jump to a line and column with no space after comma", async function () {
187+
await quickOpenTest("lines", ":50,20", "lotsOfLines.html", 50, 20);
188+
});
189+
190+
it("can open a file and jump to a line and column with space after comma", async function () {
191+
await quickOpenTest("lines", ":50, 20", "lotsOfLines.html", 50, 20);
192+
});
193+
194+
it("can directly open a file with line:column format", async function () {
195+
await quickOpenTest("lines:150:20", null, "lotsOfLines.html", 150, 20);
196+
});
197+
198+
it("can directly open a file with line:column format and spaces", async function () {
199+
await quickOpenTest("lines:150: 20", null, "lotsOfLines.html", 150, 20);
200+
});
185201
});
186202
});

0 commit comments

Comments
 (0)