-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add very basic tokenizer for command line #239344
Conversation
if (spaceIndex === -1) { | ||
return TokenType.Command; | ||
} | ||
const tokenIndex = spaceIndex === -1 ? 0 : spaceIndex + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bc we return when spaceIndex === -1
above this, I think we can just set this to spaceIndex + 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
if (spaceIndex === -1) { | ||
return TokenType.Command; | ||
} | ||
const tokenIndex = spaceIndex === -1 ? 0 : spaceIndex + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const tokenIndex = spaceIndex === -1 ? 0 : spaceIndex + 1; | |
const tokenIndex = spaceIndex + 1; |
return TokenType.Command; | ||
} | ||
const tokenIndex = spaceIndex === -1 ? 0 : spaceIndex + 1; | ||
const previousTokens = ctx.commandLine.substring(0, tokenIndex).trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename priorCommandFragment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was trying to lean into the "token" wording here since chances are as we improve this we'll turn closer and closer into a real lexer and understand more of the tokens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏼
Fixes #239018
Issue example: