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

docCommentTemplate does not return newlines in empty template anymore #20089

Closed
mjbvz opened this issue Nov 17, 2017 · 7 comments · Fixed by #20640
Closed

docCommentTemplate does not return newlines in empty template anymore #20089

mjbvz opened this issue Nov 17, 2017 · 7 comments · Fixed by #20640
Assignees
Labels
Fixed A PR has been merged for this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 17, 2017

TypeScript Version: 2.7.0-dev.20171116

Code

function foo() { }

Trigger docCommentTemplate for foo.

Expected behavior:
Returns:

/**
 *
 */

Actual behavior:
Returns:

/** */
@ghost
Copy link

ghost commented Nov 17, 2017

This was done intentionally in #19544.
You can always hit enter to get the old behavior, right?

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 17, 2017

Not with our current flow. We show document templates in our suggestion list currently. When you hit enter, we accept the suggestion and eat the enter key press

@mhegazy
Copy link
Contributor

mhegazy commented Nov 17, 2017

@mjbvz part of the change is allowing this to happen in multiple places as well; where in the past we only allowed it for certain declarations only.
Is this an issue you can deal with on your side, or you need us to revert back to the old behavior?

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 17, 2017

We can add a workaround for this if needed. Instead of generating an empty comment though, could docCommentTemplate now return undefined in these cases though? That would let us fallback to the standard empty multiline doc template that we already use when calls to docCommentTemplate fail

@mhegazy
Copy link
Contributor

mhegazy commented Nov 18, 2017

Instead of generating an empty comment though, could docCommentTemplate now return undefined in these cases though?

that is what it used to do, now it always returns an empty comment, unless the locaiton is an invalid comment location (e.g. string, JSX text, or another comment).
so not sure i understand what you mean here.

@uniqueiniquity
Copy link
Contributor

@mjbvz Just to clarify (regarding the new PR I just put up), the issue is not that we changed our default template from multiline to single line, but that we were too lax about where we considered a valid code location to insert a template?

@ghost
Copy link

ghost commented Dec 12, 2017

If it matters, I've created an issue for allowing users to set options in services at #20619 -- that could include settings for comment templates such as whether to make them multiline.

@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Needs More Info The issue still hasn't been fully clarified labels Jan 11, 2018
@mhegazy mhegazy added this to the TypeScript 2.7 milestone Jan 11, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants