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

Implement report issue command for prerelease extension #5837

Merged
merged 10 commits into from
Jun 27, 2023

Conversation

dibarbet
Copy link
Member

@dibarbet dibarbet commented Jun 20, 2023

Resolves #5747

@dibarbet dibarbet requested a review from genlu June 20, 2023 19:17
@dibarbet dibarbet requested review from a team as code owners June 20, 2023 19:17
/**
* Resolves the dotnet runtime from given options and the dotnet runtime VSCode extension.
*/
export class DotnetRuntimeExtensionResolver implements IHostExecutableResolver {
Copy link
Member Author

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#).

Copy link
Member Author

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) {
Copy link
Member Author

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) => {
Copy link
Member Author

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 {
Copy link
Member Author

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");
Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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) {
Copy link
Member Author

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");
Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

`;

const queryStringPrefix: string = "?";
const issueDefault = "Please paste the output from your clipboard";
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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. :-/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not as simple as doing encodeURIComponent and passing it along, I did try that, but you get this:
image

So will dig into this more later.

Copy link
Member

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

Copy link
Member Author

@dibarbet dibarbet Jun 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion. I'm using that. Fills out the template nicely, includes additional system info, shows duplicates. Works great.
image

src/shared/reportIssue.ts Outdated Show resolved Hide resolved
src/shared/reportIssue.ts Outdated Show resolved Hide resolved
src/lsptoolshost/dotnetRuntimeExtensionResolver.ts Outdated Show resolved Hide resolved
@dibarbet
Copy link
Member Author

@WardenGnaw mind taking a quick look at the debugger change?

package.json Outdated Show resolved Hide resolved
src/coreclr-debug/util.ts Outdated Show resolved Hide resolved
test/unitTests/features/reportIssue.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@WardenGnaw WardenGnaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

src/lsptoolshost/dotnetRuntimeExtensionResolver.ts Outdated Show resolved Hide resolved

async getHostExecutableInfo(options: Options): Promise<HostExecutableInformation> {
let dotnetRuntimePath = options.commonOptions.dotnetPath;
const serverPath = getServerPath(options, this.platformInfo);
Copy link
Member

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?

Copy link
Member Author

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) { }
Copy link
Member Author

@dibarbet dibarbet Jun 23, 2023

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

  1. 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.
  2. It didn't seem appropriate to update getHostExecutableInfo to take in the path because not all implementations of IHostExecutableResolver require a server path (for example used in O# with dotnet and mono as well). Its more of a property of this specific resolver.

Comment on lines +67 to +70
await vscode.commands.executeCommand("workbench.action.openIssueReporter", {
extensionId: CSharpExtensionId,
issueBody: body
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nifty!

@dibarbet dibarbet merged commit 32917c2 into dotnet:main Jun 27, 2023
@dibarbet dibarbet deleted the report_issue branch June 27, 2023 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-enable C# extension report issue command
6 participants