-
Notifications
You must be signed in to change notification settings - Fork 41
TypeScript keywords #45
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
Comments
Also, in case Marijn Haverbeke is reading this, my sincerest gratitude for all your tireless efforts! |
Unfortunately, the TypeScript project doesn't publish a complete description of all the extensions they make to the grammar, so the more obscure ones I tend to find out about only through issue reports like this. Attached patch adds the |
I just updated Chrome DevTools to @lezer/javascript 1.5.0 locally and tried both the example from this post type StringChecker = (value: string) => boolean;
const valueChecker = function(value: string|number) {
return true;
} satisfies StringChecker; and the example from the TypeScript documentation type Colors = "red" | "green" | "blue";
type RGB = [red: number, green: number, blue: number];
const palette = {
red: [255, 0, 0],
green: "#00ff00",
blue: [0, 0, 255]
} satisfies Record<Colors, string | RGB>;
console.log(palette.green); but in both cases I didn't dig deeper yet, though. |
FIX: Properly highlight `satisfies` as a keyword. Issue #45
I forgot to add highlighting tags to the new token. Should be fixed now. |
Thank you for this latest update @marijnh , it seems like it has improved the highlighting for all TypeScript keywords. I'm using CodeMirror 6 to build a free TypeScript reference guide and have found it to be marvelously easy to add things like inline errors and highlighting. Still a work in progress but hopefully you can see some Codemirror 6 features in the wild 😃 |
Thanks Marijn! |
This brings support for the `satisfies` keyword and fixes the highlighting for the `as` keyword. Bug: none Change-Id: I0323afd00ff835205d3f9dd0e7f566deda6c7a22 Ref: lezer-parser/javascript#45 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6483308 Commit-Queue: Benedikt Meurer <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]> Auto-Submit: Benedikt Meurer <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]>
I am looking to contribute a minor update to the parser in the way it handles TypeScript keywords - specifically, certain TypeScript keywords like
satisfies
(https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html) are not being correctly formatted as keywords.To include this in the grammar, would I simply need to update the
javascript.grammar
file?The text was updated successfully, but these errors were encountered: