-
Notifications
You must be signed in to change notification settings - Fork 676
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
Support auto doc comment generation #4261
Conversation
Adds '\n' and '/' to the on-type format list, enabling vscode support for the newly-added omnisharp feature of auto-generating documentation comments. Closes dotnet#8.
@NTaylorMullen, I think the razor plugin will have to update whatever on-type formatting you have to also call on @kasecato, this exposes the support I recently added to omnisharp that calls the roslyn functionality for this. I expect that either you or we will get issues about duplicate comments being generated: this generation will only work if the user has on-type formatting turned on. I'm not sure what mechanism you're using, so it's possible that you will still have some functionality this does not (in addition to positioning the cursor in a better location, which this cannot do as it's using the on-type formatting mechanism which cannot control the cursor). But I wanted to give you a heads up before it was merged. |
|
||
const onTypeFormatProviderCommand = 'vscode.executeFormatOnTypeProvider'; | ||
|
||
function normalizeNewlines(original: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node.js does not have replaceAll
, unfortunately...
@333fred This is a feature to output doccoment from AST, right? My extension is completely regular expression, so it was getting harder and harder to maintain... I've been wanting to get the AST from the roslyn for some time. I'll announce the removal of my extension if necessary. |
Yep. It's using the same functionality that inserts the doc comments in VS itself. |
We don't currently support OnTypeFormatting in Razor's VSCode implementation so I'd imagine things would continue to work as is. Out of curiosity, how do you all control the cursor when generating doc comments? We've made it work in VS via a custom protocol message; however, that doesn't exist in VSCode AFAIK. |
That's the secret: we do not. It does mean that the cursor will be placed at the end of the generated comment, but I think that's a worthwhile tradeoff to not having the generation at all. |
Gotcha. Ya that's unfortunate in terms of parity but agree that it's better then nothing at all |
@JoeRobich do you have any idea what is going on with travis here? I can't actually see any errors? |
@333fred I hate how the gulp command swallows errors. You can get the error locally by running ~/Source/omnisharp-vscode [auto-doc-gen +0 ~2 -0 !]> tsc -p .
test/integrationTests/documentationCommentAutoFormatting.integration.test.ts:6:1 - error TS6133: 'skip' is declared but its value is never read.
6 import { skip } from 'rxjs/operators';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error. |
Alright, now I believe this is just waiting for a new omnisharp-roslyn release. |
Codecov Report
@@ Coverage Diff @@
## master #4261 +/- ##
=======================================
Coverage 85.99% 85.99%
=======================================
Files 60 60
Lines 1857 1857
Branches 215 215
=======================================
Hits 1597 1597
Misses 200 200
Partials 60 60
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
It doesn't work on https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.23.8
|
@vchirikov do you have on-type formatting turned on? This support comes via that mechanism. |
@333fred |
Correct. |
Adds '\n' and '/' to the on-type format list, enabling vscode support for the newly-added omnisharp feature of auto-generating documentation comments. Closes #8.