Skip to content

Commit

Permalink
Stop processing earlier if no slash is found
Browse files Browse the repository at this point in the history
Signed-off-by: Remy Suen <[email protected]>
  • Loading branch information
rcjsuen committed Sep 10, 2023
1 parent 4cfa5b0 commit 64ada8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/instructions/from.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,12 @@ export class From extends ModifiableInstruction {
}
const content = this.getRangeContent(range);
const rangeStart = this.document.offsetAt(range.start);
const startingSlashIndex = this.indexOf(rangeStart, content, '/');
if (startingSlashIndex === -1) {
return null;
}
const portIndex = this.indexOf(rangeStart, content, ':');
const dotIndex = this.indexOf(rangeStart, content, '.');
const startingSlashIndex = this.indexOf(rangeStart, content, '/');
// hostname detected
if (portIndex !== -1 || dotIndex !== -1) {
return Range.create(
Expand Down

0 comments on commit 64ada8f

Please sign in to comment.