-
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
Add command to create an issue from within the extension #2503
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2503 +/- ##
=========================================
Coverage ? 64.74%
=========================================
Files ? 93
Lines ? 4173
Branches ? 598
=========================================
Hits ? 2702
Misses ? 1298
Partials ? 173
Continue to review full report at Codecov.
|
package.json
Outdated
@@ -643,6 +643,11 @@ | |||
"command": "csharp.listRemoteProcess", | |||
"title": "List processes on remote connection for attach", | |||
"category": "CSharp" | |||
}, | |||
{ | |||
"command": "csharp.fileBugReport", |
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.
"reportIssue"
src/features/generateBugReport.ts
Outdated
} | ||
|
||
async function getMonoVersion(): Promise<string>{ | ||
return execChildProcess("dotnet --info", process.cwd()); |
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.
"mono --version"?
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.
What happens if mono isn't on the path (eg, they depend on the one from the run script)
25f335f
to
63e1746
Compare
To do:
|
dc4acfa
to
e548da2
Compare
6fc1171
to
7b2ee67
Compare
e826370
to
3a7ac64
Compare
package.json
Outdated
}, | ||
{ | ||
"command": "csharp.reportIssue", | ||
"title": "Upload bug report to github", |
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.
Upload implies that there's no work to done. Maybe phrase it like "Start authoring a new issue on GitHub" or something?
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.
Done
src/features/fileIssue.ts
Outdated
|
||
const issuesUrl = "https://github.com/OmniSharp/omnisharp-vscode/issues/new"; | ||
|
||
export default async function fileIssue(vscode: vscode, eventStream: EventStream, execChildProcess: (command: string, workingDirectory?: string) => Promise<string>, isValidPlatformForMono: boolean) { |
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.
reportIssue
src/features/fileIssue.ts
Outdated
monoInfo = await getMonoVersion(execChildProcess); | ||
} | ||
catch (error) { | ||
monoInfo = "A valid mono installation could not be found. Using the built-in mono" |
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.
The extension has logic that determines the version of mono found and only using it if it's new enough. Can we try to follow the same logic here? We don't want to report mono versions that are old enough that we use the built in one instead.
src/features/fileIssue.ts
Outdated
} | ||
|
||
async function getDotnetInfo(execChildProcess: (command: string, workingDirectory?: string) => Promise<string>): Promise<string> { | ||
return execChildProcess("dotnet --info", process.cwd()); |
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 think this also needs to handle no dotnet on path.
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.
Done
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
export const CSharpExtensionId = 'ms-vscode.csharp'; |
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 this appears in package.json, can we read it from there instead of redefining it here?
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.
The package json has a publisher name and the name of the extension combining which gives the extension id, but to get access to the package.json we need the extension first and to get the extension we need the extension id. Hence from what I understand there is no way to get the extension id directly from the package.json.
src/observers/ReportIssueObserver.ts
Outdated
public post = (event: BaseEvent) => { | ||
switch (event.constructor.name) { | ||
case ReportIssue.name: | ||
let issue = <ReportIssue>event; |
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'm not sure how I feel about needing to dispatch to the message bus to do this...
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.
What I mean is that there could be a component that's basically identical to the observer youa dded, but they could be directly composed together as opposed to going over the message bus.
import { ReportIssue } from "../../../src/omnisharp/loggingEvents"; | ||
import { vscode } from "../../../src/vscodeAdapter"; | ||
|
||
suite("File Issue", () => { |
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.
Make names consistent, whatever we land on :)
28c9e76
to
265470c
Compare
b7557d7
to
379654c
Compare
} | ||
} | ||
|
||
function configureCustomMono(childEnv: NodeJS.ProcessEnv, options: Options): 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.
Nit: can you move this underneath the getGlobalMono method?
return undefined; | ||
} | ||
|
||
export async function getMonoVersion( environment: NodeJS.ProcessEnv): Promise<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.
How is this one different from the one that's passed into the constructor?
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 is a separate function that is used to initialise the OmniSharpMonoResolver class.
return new Promise<string>((resolve, reject) => { | ||
let childprocess: ChildProcess; | ||
try { | ||
childprocess = spawn('mono', ['--version'], { env: environment }); |
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.
Seems like this makes it untestable, no?
import { MonoInformation } from "./MonoInformation"; | ||
|
||
export interface IMonoResolver { | ||
shouldUseGlobalMono(options: Options): Promise<MonoInformation>; |
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.
"should" in the name makes me think this returns a boolean. Maybe call this "getMonoInfo" or somethign?
Fixes: #2498
To do:
Here is a preview of all the fields added:
Issue Description
Steps to Reproduce
Expected Behaviour
Actual Behaviour
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.27.1
C# Extension: 1.16.0
Mono Information
A valid mono installation could not be found. Using the built-in monoDotnet Info
.NET Command Line Tools (2.1.200)Product Information:
Version: 2.1.200
Commit SHA-1 hash: 2edba8d7f1
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.200/
Microsoft .NET Core Shared Framework Host
Version : 2.0.7
Build : 2d61d0b043915bc948ebf98836fefe9ba942be11
Visual Studio Code Extensions