Skip to content

Commit afef1ab

Browse files
authored
Accept a trailing colon in --goto format. (microsoft#186174)
* Accept a trailing colon in --goto format. This is useful because many tools add a comma after file[:line[:col]]. * Support trailing comma after line:col in search.
1 parent 5d94be3 commit afef1ab

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/vs/platform/environment/node/argvHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): Nativ
4242

4343
const args = parseArgs(cmdLineArgs, OPTIONS, reportWarnings ? errorReporter : undefined);
4444
if (args.goto) {
45-
args._.forEach(arg => assert(/^(\w:)?[^:]+(:\d*){0,2}$/.test(arg), localize('gotoValidation', "Arguments in `--goto` mode should be in the format of `FILE(:LINE(:CHARACTER))`.")));
45+
args._.forEach(arg => assert(/^(\w:)?[^:]+(:\d*){0,2}:?$/.test(arg), localize('gotoValidation', "Arguments in `--goto` mode should be in the format of `FILE(:LINE(:CHARACTER))`.")));
4646
}
4747

4848
return args;

src/vs/workbench/contrib/search/common/search.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ export function getOutOfWorkspaceEditorResources(accessor: ServicesAccessor): UR
148148
return resources as URI[];
149149
}
150150

151-
// Supports patterns of <path><#|:|(><line><#|:|,><col?>
152-
const LINE_COLON_PATTERN = /\s?[#:\(](?:line )?(\d*)(?:[#:,](\d*))?\)?\s*$/;
151+
// Supports patterns of <path><#|:|(><line><#|:|,><col?><:?>
152+
const LINE_COLON_PATTERN = /\s?[#:\(](?:line )?(\d*)(?:[#:,](\d*))?\)?:?\s*$/;
153153

154154
export interface IFilterAndRange {
155155
filter: string;

0 commit comments

Comments
 (0)