Skip to content

fix(193523): JSDoc optional parameters don't display in functions #202963

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

Merged
merged 7 commits into from
Feb 6, 2024

Conversation

perplexyves
Copy link
Contributor

Hello. This PR is a fix to #193523, which was labelled with both help-wanted and bug labels.

Useful summary of the issue:

  • First, go to settings.json and add these 2 config lines:
"editor.suggest.preview": true,
"javascript.suggest.completeFunctionCalls": true,
  • Then, in a JS file type the following:
/**
 * @param {string} one hi.
 * @param {number} two howdy.
 * @param {string} [three] hello.
 */
function test(one, two, three) { }
  • Now, when you try to invoke the function test, you should notice that in the autocompletion preview the optional params have been omitted:

    image

After applying the fix (based on @RyanCavanaugh advice), the problem is solved.

image

@perplexyves
Copy link
Contributor Author

Also I am ready to assist with any unit test to cover this case.

@akobrin
Copy link

akobrin commented Jan 22, 2024

I am unfamiliar with this whole review process. Is the bottom line that the fix will be included in a VS Code update in the future? Thank you

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

We still want to hide optional parameters at the end of the list. Otherwise some library functions will generation an overwhelming number of parameters that you don't care about

#193523 is specifically about when the optional parameter appears between two non-optional params. Let's focus on that case

Also make sure to add tests. These are defined in functionCallSnippet.test.ts

@perplexyves
Copy link
Contributor Author

@microsoft-github-policy-service agree

@perplexyves
Copy link
Contributor Author

perplexyves commented Jan 25, 2024

I've added the requested changes @mjbvz. Ready to assist if needed.

@perplexyves perplexyves requested a review from mjbvz January 25, 2024 23:57
@perplexyves perplexyves changed the title Issue #193523: JSDoc optional parameters don't display in functions fix(193523): JSDoc optional parameters don't display in functions Jan 30, 2024
@perplexyves
Copy link
Contributor Author

Hello Matt. Just fixed the integration tests. Can you please review once available? @mjbvz

Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Thanks!

@mjbvz mjbvz enabled auto-merge (squash) February 6, 2024 01:59
@vscodenpa vscodenpa added this to the February 2024 milestone Feb 6, 2024
@mjbvz mjbvz merged commit 0786b4d into microsoft:main Feb 6, 2024
@perplexyves
Copy link
Contributor Author

Pleasure!

@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants