-
Notifications
You must be signed in to change notification settings - Fork 237
Add meta.embedded
scope to JSDoc blocks
#541
Conversation
Fixes: microsoft/TypeScript-TmLanguage#537 Supersedes: #539
This will mark the entire jsdoc comment as |
@mjbvz How does this hinder VSCode's ability to distinguish embedded documentation from comment text? |
When TypeScript or any other suggestion provider does not return any results, we default to showing a set of word based suggestions. Many users found this annoying when typing out strings or comments, so we disable them in these scopes. In the case of jsdocs, we want re-enable quick suggestions but only in the code (type) part of comments, not in entire comment body. We also have very limited information when we decide whether or not to enable quick suggestions. All we know is if are we are in a string, a comment, or regular code. We would not be able to know that we are in a |
I'm still failing to see a problem here... Are you saying this only works when |
My point is that Take this example code with some toy token spans:
We want quick suggestions to be enabled:
That means we want quick suggestions to be enabled only in spans My proposed scopes for each span:
This scoping allows us to correctly enable quick suggestions only spans
This change on the other hand does:
Which following our logic would enable quick suggestions in |
That feels like it's going too far, IMO. Every other grammar that embeds other grammars does so with Personally, I think this is more an issue with VSCode's implementation of quick suggestions... |
I'm struggling to understand the opposition to the first PR. The JSdoc type annotations are spans of a language embedded within a comment. We went with the meta embedded approach in the first place because using the very simple set of rules outlined, we can support a large number of scenarios. The core engine does not need to know anything language specific, only that |
Technically, JSDoc is everything in between those spans, too. You appear to be thinking of it like this: - /** Comment
- * Function description Comment
+ * @param {String} name JSDoc
- * Parameter description Comment
+ * @return {Object} JSDoc
- * Return value's description Comment
- */ Comment Whereas it's actually closer to this: - /** Comment
+ * Function description JSDoc
+ * @param {String} name │
+ * Parameter description │
+ * @return {Object} │
+ * Return value's description JSDoc
- */ Comment
Erm, which is what this PR is doing... |
Please see my example. I have always been talking specifically about the type annotation within the jsdoc, not the entire jsdoc |
I see what you mean, but this still feels uncomfortably hacky to me. 😕 @50Wliu, what do you recommend? |
@50Wliu do you have any thoughts on this? |
@50Wliu Feel free to merge this if you think it is useful. |
Supersedes #539.
/cc @mjbvz, @50Wliu.