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

Mark jsdoc types with meta.embedded #537

Closed
mjbvz opened this issue Oct 30, 2017 · 4 comments
Closed

Mark jsdoc types with meta.embedded #537

mjbvz opened this issue Oct 30, 2017 · 4 comments

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Oct 30, 2017

Problem
Quick suggestions do not currently appear when typing in jsdoc type fields:

/**
 * @param {|} x
 */
function foo(x) { }

This is because vscode sees the comment scope of the jsdoc type and disables quick suggestions here.

Proposed Fix
microsoft/vscode#34857 uses the meta.embedded scope to re-enable quick suggestions inside of JS/TS strings or comments. If we mark all jsdoc type fields as meta.embedded.inline.typescript, quick suggestions will show up

@mjbvz
Copy link
Contributor Author

mjbvz commented Oct 30, 2017

Will look into submitting this fix upstream against atom-javascript where we get the jsdoc grammar from

mjbvz added a commit to mjbvz/language-javascript that referenced this issue Nov 1, 2017
microsoft/TypeScript-TmLanguage#537

VS Code uses the meta.embedded scope to mark sections of strings or comments as actually being code instead of string or comment content. This change adds the meta embedded scope to the contents of jsdoc types
mjbvz added a commit to mjbvz/language-javascript that referenced this issue Nov 1, 2017
microsoft/TypeScript-TmLanguage#537

VS Code uses the meta.embedded scope to mark sections of strings or comments as actually being code instead of string or comment content. This change adds the meta embedded scope to the contents of jsdoc types
@Alhadis
Copy link

Alhadis commented Nov 1, 2017

This is because vscode sees the comment scope of the jsdoc type and disables quick suggestions here.

Do your scope selectors work like ours? If so, it's a simple addition to hide unwanted suggestions:

-comment.line
-comment.block
+comment.documentation

I'm guessing something like that should work...?

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 2, 2017

@Alhadis We look at the entire scope stack. For code:

/**
 * @type {foo}
 */

foo is scoped as:

entity.name.type.instance.jsdoc
comment.block.documentation.js
source.js

Since there is a comment scope in the stack, we disable quick suggestions here currently.

If the stack had a meta.embedded:

entity.name.type.instance.jsdoc
meta.embedded.js
comment.block.documentation.js
source.js

that would override this behavior and turn quick suggestions back on

Alhadis added a commit to Alhadis/language-perl5 that referenced this issue Nov 3, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Mar 16, 2018

We added a way to explicitly override the token kind (string vs comment vs language) per scope in VS Code: microsoft/vscode@d74145e

This accomplishes the same thing as using meta.embedded so I'm closing this issue

@mjbvz mjbvz closed this as completed Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants