-
Notifications
You must be signed in to change notification settings - Fork 685
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
Add vscode implemention of the 'RunTestsInContext' and `DebugTestsInContext' commands #3772
Conversation
…ontext' commands This is the omnisharp-vsocde side of OmniSharp/omnisharp-roslyn#1782. I've implemented support for both of those commands, and bound them to the same default shortcuts as in VS proper. These commands can also be invoked from the command palette. I've also done a small bit of refactoring to remove references to legacy project.json support. There is no support for loading this project type in Omnisharp anymore, so this was cruft that was unnecessary at this point.
Codecov Report
@@ Coverage Diff @@
## master #3772 +/- ##
==========================================
+ Coverage 87.03% 87.16% +0.12%
==========================================
Files 59 59
Lines 1782 1800 +18
Branches 207 207
==========================================
+ Hits 1551 1569 +18
Misses 176 176
Partials 55 55
Continue to review full report at Codecov.
|
{ | ||
"command": "dotnet.test.runTestsInContext", | ||
"key": "ctrl+r t", | ||
"mac": "cmd+r t", |
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.
I don't actually know what the keyboard shortcuts for run/debug tests in VS for Mac are, so I've just done the equivalent of the Windows ones. If there's a better one to use, I'm all ears.
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.
Those work for me
@@ -284,7 +284,6 @@ export interface AutoCompleteResponse { | |||
|
|||
export interface ProjectInformationResponse { | |||
MsBuildProject: MSBuildProject; | |||
DotNetProject: DotNetProject; |
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.
Omnisharp no longer has a project information provider for project.json
projects, so anything that used this was not used.
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.
Thanks for removing!
@@ -477,8 +476,10 @@ export namespace V2 { | |||
export const GetTestStartInfo = '/v2/getteststartinfo'; |
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.
This command can probably be removed as well, as it was used by the project.json
support. Let me know if you'd like me to go through and remove it as well.
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.
If you are interested, you could remove in a follow up PR or open a tracking issue with the suggestion. Thanks!
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.
Thanks for doing this, this is great.
|
||
const request: protocol.V2.DebugTestsInContextGetStartInfoRequest = { | ||
FileName: fileName, | ||
Line: line + 1, |
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.
is this due to vscode using zero-indexed positions while roslyn uses one-indexed positions?
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.
No. It's because the deserializer expects the incoming position to be 1-indexed. Both vscode and roslyn actually expect 0-indexed.
{ | ||
"command": "dotnet.test.runTestsInContext", | ||
"key": "ctrl+r t", | ||
"mac": "cmd+r t", |
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.
Those work for me
@@ -284,7 +284,6 @@ export interface AutoCompleteResponse { | |||
|
|||
export interface ProjectInformationResponse { | |||
MsBuildProject: MSBuildProject; | |||
DotNetProject: DotNetProject; |
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.
Thanks for removing!
@@ -477,8 +476,10 @@ export namespace V2 { | |||
export const GetTestStartInfo = '/v2/getteststartinfo'; |
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.
If you are interested, you could remove in a follow up PR or open a tracking issue with the suggestion. Thanks!
…in an editor These commands are sorted below rename and other modification actions. Default groups in vscode are documented here: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups. 2_ is below modification, and the `@` is used for relative ordering of commands in a group.
{ | ||
"command": "dotnet.test.runTestsInContext", | ||
"when": "editorLangId == csharp", | ||
"group": "2_dotnet@1" |
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.
Vscode groups are documented here: https://code.visualstudio.com/api/references/contribution-points#Sorting-of-groups
2_
puts them after find all refs/rename, but before copy/paste. The @
symbol on the end denotes relative ordering of commands in a group.
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.
I dig it
This is the omnisharp-vsocde side of OmniSharp/omnisharp-roslyn#1782. I've implemented support for both of those commands, and bound them to the same default shortcuts as in VS proper. These commands can also be invoked from the command palette.
I've also done a small bit of refactoring to remove references to legacy project.json support. There is no support for loading this project type in Omnisharp anymore, so this was cruft that was unnecessary at this point.