Skip to content
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

[Console Monaco] Resolve uncaught error from tokenizer #188746

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export const lexerRules: monaco.languages.IMonarchLanguage = {
root: [
...consoleSharedLexerRules.tokenizer.root,
// method
matchTokensWithEOL('method', /([a-zA-Z]+)/, 'root', 'method_sep'),
matchTokensWithEOL(
'method',
/([Gg][Ee][Tt])|([Pp][Oo][Ss][Tt])|([Pp][Uu][Tt])|([Pp][Aa][Tt][Cc][Hh])|([Dd][Ee][Ll][Ee][Tt][Ee])|([Hh][Ee][Aa][Dd])/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) this regex is somewhat harder to read: we could either put it in a named variable or change the regex to /get|post|put|patch|delete|head/ and add the option ignoreCase: true to the rules

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good call! I wasn't sure if adding ignoreCase: true wouldn't affect the rest of the rules but now I checked and it seems none of the rules rely on strict case sensitivity so it should work. I added this change with 95e7d93.

'root',
'method_sep'
),
// whitespace
matchToken('whitespace', '\\s+'),
// text
Expand Down