-
Notifications
You must be signed in to change notification settings - Fork 590
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
[JavaScript] "meta.type" scope leaks into following comment #3774
Comments
Example: let x: string /** The production or development server. */
| number; In the above case, the comment is within the type expression. In Example 1, it would be possible in principle to exclude the comment from the meta scope, but that would require branching. There are a lot of similar cases in the syntax where a meta scope may include trailing whitespace or comments. When there's an explicit ending delimiter, it should end the meta scope right away, but when the ending is ambiguous it would be a lot of hassle/extra code to do that. |
Example 3 is really what made me file this issue. The other ones I just came up with to make it more difficult. :) It's an unfortunate conflict with convention since such comments apply to the code below but inherit scope/style from the type annotation above. |
Example 3 has a workaround — use explicit terminators. export interface Foo {
a: string;
/** The resolved Nuxt configuration. */
b: number;
} |
Yeah, but some projects enforce no terminators. |
Oof. Yeah, that's rough. Automatic semicolon insertion was a mistake and mandating it is nuts. Not sure if there's a reasonable workaround there, since relying on ASI makes everything harder to parse anyway (every tmLanguage I've seen is riddled with bugs around it). |
What happened?
In all those 3 cases the
meta.type
scope from the type annotation is also applied to the following comments.I've noticed that because I've applied custom color to
meta.type
with the intention of using it with my JSDoc scoping PR. Otherwise this issue might not be noticeable really.The text was updated successfully, but these errors were encountered: