mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
committed by
GitHub
parent
048752c031
commit
f2bcf4c272
@@ -48,7 +48,7 @@ class GitHubGistProfileContentHandler implements vscode.ProfileContentHandler {
|
||||
}
|
||||
}
|
||||
|
||||
async saveProfile(name: string, content: string): Promise<vscode.Uri | null> {
|
||||
async saveProfile(name: string, content: string): Promise<{ readonly id: string; readonly link: vscode.Uri } | null> {
|
||||
const octokit = await this.getOctokit();
|
||||
const result = await octokit.gists.create({
|
||||
public: false,
|
||||
@@ -58,7 +58,11 @@ class GitHubGistProfileContentHandler implements vscode.ProfileContentHandler {
|
||||
}
|
||||
}
|
||||
});
|
||||
return result.data.html_url ? vscode.Uri.parse(result.data.html_url) : null;
|
||||
if (result.data.id && result.data.html_url) {
|
||||
const link = vscode.Uri.parse(result.data.html_url);
|
||||
return { id: result.data.id, link };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private _public_octokit: Promise<Octokit> | undefined;
|
||||
@@ -72,8 +76,10 @@ class GitHubGistProfileContentHandler implements vscode.ProfileContentHandler {
|
||||
return this._public_octokit;
|
||||
}
|
||||
|
||||
async readProfile(uri: vscode.Uri): Promise<string | null> {
|
||||
const gist_id = basename(uri.path);
|
||||
async readProfile(id: string): Promise<string | null>;
|
||||
async readProfile(uri: vscode.Uri): Promise<string | null>;
|
||||
async readProfile(arg: string | vscode.Uri): Promise<string | null> {
|
||||
const gist_id = typeof arg === 'string' ? arg : basename(arg.path);
|
||||
const octokit = await this.getPublicOctokit();
|
||||
try {
|
||||
const gist = await octokit.gists.get({ gist_id });
|
||||
|
||||
Reference in New Issue
Block a user