-
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
Implement report issue command for prerelease extension #5837
Conversation
/** | ||
* Resolves the dotnet runtime from given options and the dotnet runtime VSCode extension. | ||
*/ | ||
export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver { |
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.
moved the runtime resolution into the IHostExecutableResolver
so we can get this information in other places (and share more code with O#).
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 all essentially just moved
@@ -641,6 +602,39 @@ export async function activateRoslynLanguageServer(context: vscode.ExtensionCont | |||
_languageServer.start(); | |||
} | |||
|
|||
export function getServerPath(options: Options, platformInfo: PlatformInformation) { |
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.
moved to re-use
constructor(private vscode: vscode) { | ||
} | ||
|
||
public post = (event: BaseEvent) => { |
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 seemed entirely unnecessary - an event + observer just for a single location to open a URL
${monoVersion}</details>`; | ||
} | ||
|
||
function getLogInfo(useOmnisharp: boolean): 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.
this is a new bit
} | ||
|
||
const tableHeader = `|Extension|Author|Version|Folder Name|\n|---|---|---|---|`; | ||
const table = extensions.map((e) => `|${e.packageJSON.name}|${e.packageJSON.publisher}|${e.packageJSON.version}|${basename(e.extensionPath)}|`).join("\n"); |
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 all the same, except I added the extension folder name. This is the only place where it will show which architecture the extension comes from. Useful because we've had issues with the marketplace installing the wrong architecture 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.
Is that pulling in just the immediate parent path or the full path? That may include the username which they might not want to share.
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.
Just the name of the immediate parent - I didn't include the entire path for that exact reason :)
}; | ||
return _dotnetInfo; | ||
} | ||
if (version !== undefined) { |
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.
dotnet info on a runtime-only dotnet.exe does not output any runtimeid
} | ||
|
||
const tableHeader = `|Extension|Author|Version|Folder Name|\n|---|---|---|---|`; | ||
const table = extensions.map((e) => `|${e.packageJSON.name}|${e.packageJSON.publisher}|${e.packageJSON.version}|${basename(e.extensionPath)}|`).join("\n"); |
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 that pulling in just the immediate parent path or the full path? That may include the username which they might not want to share.
let options: Options; | ||
let issueBody: string; | ||
|
||
setup(() => { | ||
vscode = getFakeVsCode(); | ||
// @ts-ignore |
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.
Why the @ts-ignore
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.
It needs to return a vscode.Uri, but the only way I know how to get one is to call vscode.Uri.Parse... which we're implementing here. Since the result of this call doesn't matter for the unit test anyway, I return the same input value. Since it isn't a vscode.Uri type though I need to suppress the TS warnings.
When we get integration tests I want to delete these unit tests in favor of integration tests anyway.
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.
@dibarbet The VSCode URI package is referencable separately: https://github.com/microsoft/vscode-uri. So it's pretty easy to add a reference to that and then have a "real" parse method in play.
src/shared/reportIssue.ts
Outdated
`; | ||
|
||
const queryStringPrefix: string = "?"; | ||
const issueDefault = "Please paste the output from your clipboard"; |
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.
Do I dare ask why we don't just fill in the body directly since we have a way to do that?
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 it is because of potential URI escaping issues (the body gets put into the actual URI). Might be possible still, I can investigate it later. For now I'll leave it since this is the existing behavior.
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.
Yeah, I don't know why we can't just call an escape method 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.
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 saw in the python extension that you could open the vscode Report Issue dialog with a templated issue body. Might be something to look into. https://github.com/microsoft/vscode-python/blob/acd12995eacfd52577a5aedf494e1cd163433476/src/client/common/application/commands/reportIssueCommand.ts#L100-L109
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.
@WardenGnaw mind taking a quick look at the debugger change? |
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.
|
||
async getHostExecutableInfo(options: Options): Promise<HostExecutableInformation> { | ||
let dotnetRuntimePath = options.commonOptions.dotnetPath; | ||
const serverPath = getServerPath(options, this.platformInfo); |
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 seems wrong in the current form. This is a generic .NET resolver but it's calling into roslyn's specific getServerPath
method. Shouldn't we make this fully generic and have the paths / file namse passed in so we can share with razor?
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.
Yeah - when I originally wrote it, I hadn't thought about sharing it with Razor yet. I'll update this.
/** | ||
* This is a function instead of a string because the server path can change while the extension is active (when the option changes). | ||
*/ | ||
private getServerPath: (options: Options, platform: PlatformInformation) => 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.
Updating to eventually share this with Razor - #5855
A couple reasons for doing it this way
- As mentioned in the comment it needs to be a function for when the server path changes (from the option). One
IHostExecutableResolver
is created during activation for roslyn, and re-used across server restarts. - It didn't seem appropriate to update
getHostExecutableInfo
to take in the path because not all implementations ofIHostExecutableResolver
require a server path (for example used in O# with dotnet and mono as well). Its more of a property of this specific resolver.
await vscode.commands.executeCommand("workbench.action.openIssueReporter", { | ||
extensionId: CSharpExtensionId, | ||
issueBody: body | ||
}); |
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.
Nifty!
Resolves #5747