Skip to content

Commit

Permalink
feat: go to line will accept :ln:col format along with :ln,col (#2061)
Browse files Browse the repository at this point in the history
  • Loading branch information
abose authored Jan 16, 2025
1 parent ad95682 commit ffe2fe2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/search/QuickOpen.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ define(function (require, exports, module) {
* @private
* @const {RegExp}
*/
var CURSOR_POS_EXP = new RegExp(":([^,]+)?(,(.+)?)?");
var CURSOR_POS_EXP = new RegExp(":([^,:]+)?([,:](.+)?)?");

/**
* Current plugin
Expand Down
16 changes: 16 additions & 0 deletions test/spec/QuickOpen-integ-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,21 @@ define(function (require, exports, module) {
it("can directly open a file in a given line and column, centering that line on the screen", async function () {
await quickOpenTest("lines:150,20", null, "lotsOfLines.html", 150, 20);
});

it("can open a file and jump to a line and column with no space after comma", async function () {
await quickOpenTest("lines", ":50,20", "lotsOfLines.html", 50, 20);
});

it("can open a file and jump to a line and column with space after comma", async function () {
await quickOpenTest("lines", ":50, 20", "lotsOfLines.html", 50, 20);
});

it("can directly open a file with line:column format", async function () {
await quickOpenTest("lines:150:20", null, "lotsOfLines.html", 150, 20);
});

it("can directly open a file with line:column format and spaces", async function () {
await quickOpenTest("lines:150: 20", null, "lotsOfLines.html", 150, 20);
});
});
});

0 comments on commit ffe2fe2

Please sign in to comment.