mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 01:25:38 -05:00
Merge from vscode dbe62be3266ffb6772a7f3db0bf61d63f4aa7f65 (#9337)
This commit is contained in:
@@ -142,23 +142,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dockerFileAndContext": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dockerFile": {
|
||||
"type": "string",
|
||||
"description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file."
|
||||
},
|
||||
"context": {
|
||||
"type": "string",
|
||||
"description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"dockerFile"
|
||||
]
|
||||
},
|
||||
"dockerFileContainer": {
|
||||
"dockerfileContainer": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "object",
|
||||
@@ -168,7 +152,20 @@
|
||||
"description": "Docker build-related options.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dockerFileAndContext"
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dockerfile": {
|
||||
"type": "string",
|
||||
"description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file."
|
||||
},
|
||||
"context": {
|
||||
"type": "string",
|
||||
"description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"dockerfile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/buildOptions"
|
||||
@@ -183,7 +180,20 @@
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dockerFileAndContext"
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dockerFile": {
|
||||
"type": "string",
|
||||
"description": "The location of the Dockerfile that defines the contents of the container. The path is relative to the folder containing the `devcontainer.json` file."
|
||||
},
|
||||
"context": {
|
||||
"type": "string",
|
||||
"description": "The location of the context folder for building the Docker image. The path is relative to the folder containing the `devcontainer.json` file."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"dockerFile"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -280,7 +290,7 @@
|
||||
{
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dockerFileContainer"
|
||||
"$ref": "#/definitions/dockerfileContainer"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/imageContainer"
|
||||
|
||||
@@ -430,25 +430,25 @@ export class CommandCenter {
|
||||
case Status.INDEX_MODIFIED:
|
||||
case Status.INDEX_RENAMED:
|
||||
case Status.INDEX_ADDED:
|
||||
return `${basename} (Index)`;
|
||||
return localize('git.title.index', '{0} (Index)', basename);
|
||||
|
||||
case Status.MODIFIED:
|
||||
case Status.BOTH_ADDED:
|
||||
case Status.BOTH_MODIFIED:
|
||||
return `${basename} (Working Tree)`;
|
||||
return localize('git.title.workingTree', '{0} (Working Tree)', basename);
|
||||
|
||||
case Status.DELETED_BY_US:
|
||||
return `${basename} (Theirs)`;
|
||||
return localize('git.title.theirs', '{0} (Theirs)', basename);
|
||||
|
||||
case Status.DELETED_BY_THEM:
|
||||
return `${basename} (Ours)`;
|
||||
return localize('git.title.ours', '{0} (Ours)', basename);
|
||||
|
||||
case Status.UNTRACKED:
|
||||
return localize('git.title.untracked', '{0} (Untracked)', basename);
|
||||
|
||||
return `${basename} (Untracked)`;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@command('git.clone')
|
||||
@@ -2348,12 +2348,12 @@ export class CommandCenter {
|
||||
|
||||
let title;
|
||||
if ((item.previousRef === 'HEAD' || item.previousRef === '~') && item.ref === '') {
|
||||
title = `${basename} (Working Tree)`;
|
||||
title = localize('git.title.workingTree', '{0} (Working Tree)', basename);
|
||||
}
|
||||
else if (item.previousRef === 'HEAD' && item.ref === '~') {
|
||||
title = `${basename} (Index)`;
|
||||
title = localize('git.title.index', '{0} (Index)', basename);
|
||||
} else {
|
||||
title = `${basename} (${item.shortPreviousRef}) \u27f7 ${basename} (${item.shortRef})`;
|
||||
title = localize('git.title.diffRefs', '{0} ({1}) \u27f7 {0} ({2})', basename, item.shortPreviousRef, item.shortRef);
|
||||
}
|
||||
|
||||
return commands.executeCommand('vscode.diff', toGitUri(uri, item.previousRef), item.ref === '' ? uri : toGitUri(uri, item.ref), title);
|
||||
|
||||
@@ -40,6 +40,29 @@ export const enum ResourceGroupType {
|
||||
|
||||
export class Resource implements SourceControlResourceState {
|
||||
|
||||
static getStatusText(type: Status) {
|
||||
switch (type) {
|
||||
case Status.INDEX_MODIFIED: return localize('index modified', "Index Modified");
|
||||
case Status.MODIFIED: return localize('modified', "Modified");
|
||||
case Status.INDEX_ADDED: return localize('index added', "Index Added");
|
||||
case Status.INDEX_DELETED: return localize('index deleted', "Index Deleted");
|
||||
case Status.DELETED: return localize('deleted', "Deleted");
|
||||
case Status.INDEX_RENAMED: return localize('index renamed', "Index Renamed");
|
||||
case Status.INDEX_COPIED: return localize('index copied', "Index Copied");
|
||||
case Status.UNTRACKED: return localize('untracked', "Untracked");
|
||||
case Status.IGNORED: return localize('ignored', "Ignored");
|
||||
case Status.INTENT_TO_ADD: return localize('intent to add', "Intent to Add");
|
||||
case Status.BOTH_DELETED: return localize('both deleted', "Both Deleted");
|
||||
case Status.ADDED_BY_US: return localize('added by us', "Added By Us");
|
||||
case Status.DELETED_BY_THEM: return localize('deleted by them', "Deleted By Them");
|
||||
case Status.ADDED_BY_THEM: return localize('added by them', "Added By Them");
|
||||
case Status.DELETED_BY_US: return localize('deleted by us', "Deleted By Us");
|
||||
case Status.BOTH_ADDED: return localize('both added', "Both Added");
|
||||
case Status.BOTH_MODIFIED: return localize('both modified', "Both Modified");
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
|
||||
@memoize
|
||||
get resourceUri(): Uri {
|
||||
if (this.renameResourceUri && (this._type === Status.MODIFIED || this._type === Status.DELETED || this._type === Status.INDEX_RENAMED || this._type === Status.INDEX_COPIED)) {
|
||||
@@ -110,26 +133,7 @@ export class Resource implements SourceControlResourceState {
|
||||
}
|
||||
|
||||
private get tooltip(): string {
|
||||
switch (this.type) {
|
||||
case Status.INDEX_MODIFIED: return localize('index modified', "Index Modified");
|
||||
case Status.MODIFIED: return localize('modified', "Modified");
|
||||
case Status.INDEX_ADDED: return localize('index added', "Index Added");
|
||||
case Status.INDEX_DELETED: return localize('index deleted', "Index Deleted");
|
||||
case Status.DELETED: return localize('deleted', "Deleted");
|
||||
case Status.INDEX_RENAMED: return localize('index renamed', "Index Renamed");
|
||||
case Status.INDEX_COPIED: return localize('index copied', "Index Copied");
|
||||
case Status.UNTRACKED: return localize('untracked', "Untracked");
|
||||
case Status.IGNORED: return localize('ignored', "Ignored");
|
||||
case Status.INTENT_TO_ADD: return localize('intent to add', "Intent to Add");
|
||||
case Status.BOTH_DELETED: return localize('both deleted', "Both Deleted");
|
||||
case Status.ADDED_BY_US: return localize('added by us', "Added By Us");
|
||||
case Status.DELETED_BY_THEM: return localize('deleted by them', "Deleted By Them");
|
||||
case Status.ADDED_BY_THEM: return localize('added by them', "Added By Them");
|
||||
case Status.DELETED_BY_US: return localize('deleted by us', "Deleted By Us");
|
||||
case Status.BOTH_ADDED: return localize('both added', "Both Added");
|
||||
case Status.BOTH_MODIFIED: return localize('both modified', "Both Modified");
|
||||
default: return '';
|
||||
}
|
||||
return Resource.getStatusText(this.type);
|
||||
}
|
||||
|
||||
private get strikeThrough(): boolean {
|
||||
|
||||
@@ -3,17 +3,18 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import * as dayjs from 'dayjs';
|
||||
import * as advancedFormat from 'dayjs/plugin/advancedFormat';
|
||||
import { CancellationToken, Disposable, Event, EventEmitter, ThemeIcon, Timeline, TimelineChangeEvent, TimelineItem, TimelineOptions, TimelineProvider, Uri, workspace } from 'vscode';
|
||||
import { Model } from './model';
|
||||
import { Repository } from './repository';
|
||||
import { Repository, Resource } from './repository';
|
||||
import { debounce } from './decorators';
|
||||
import { Status } from './api/git';
|
||||
|
||||
dayjs.extend(advancedFormat);
|
||||
|
||||
// TODO[ECA]: Localize all the strings
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
// TODO[ECA]: Localize or use a setting for date format
|
||||
|
||||
export class GitTimelineItem extends TimelineItem {
|
||||
@@ -68,7 +69,7 @@ export class GitTimelineProvider implements TimelineProvider {
|
||||
}
|
||||
|
||||
readonly id = 'git-history';
|
||||
readonly label = 'Git History';
|
||||
readonly label = localize('git.timeline.source', 'Git History');
|
||||
|
||||
private _disposable: Disposable;
|
||||
|
||||
@@ -171,38 +172,18 @@ export class GitTimelineProvider implements TimelineProvider {
|
||||
});
|
||||
|
||||
if (options.cursor === undefined || options.before) {
|
||||
const you = localize('git.timeline.you', 'You');
|
||||
|
||||
const index = repo.indexGroup.resourceStates.find(r => r.resourceUri.fsPath === uri.fsPath);
|
||||
if (index) {
|
||||
const date = this._repoStatusDate ?? new Date();
|
||||
dateFormatter = dayjs(date);
|
||||
|
||||
let status;
|
||||
switch (index.type) {
|
||||
case Status.INDEX_MODIFIED:
|
||||
status = 'Modified';
|
||||
break;
|
||||
case Status.INDEX_ADDED:
|
||||
status = 'Added';
|
||||
break;
|
||||
case Status.INDEX_DELETED:
|
||||
status = 'Deleted';
|
||||
break;
|
||||
case Status.INDEX_RENAMED:
|
||||
status = 'Renamed';
|
||||
break;
|
||||
case Status.INDEX_COPIED:
|
||||
status = 'Copied';
|
||||
break;
|
||||
default:
|
||||
status = '';
|
||||
break;
|
||||
}
|
||||
|
||||
const item = new GitTimelineItem('~', 'HEAD', 'Staged Changes', date.getTime(), 'index', 'git:file:index');
|
||||
const item = new GitTimelineItem('~', 'HEAD', localize('git.timeline.stagedChanges', 'Staged Changes'), date.getTime(), 'index', 'git:file:index');
|
||||
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
|
||||
item.iconPath = new (ThemeIcon as any)('git-commit');
|
||||
item.description = 'You';
|
||||
item.detail = `You \u2014 Index\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n${status}`;
|
||||
item.description = you;
|
||||
item.detail = localize('git.timeline.detail', '{0} \u2014 {1}\n{2}\n\n{3}', you, localize('git.index', 'Index'), dateFormatter.format('MMMM Do, YYYY h:mma'), Resource.getStatusText(index.type));
|
||||
item.command = {
|
||||
title: 'Open Comparison',
|
||||
command: 'git.timeline.openDiff',
|
||||
@@ -217,33 +198,11 @@ export class GitTimelineProvider implements TimelineProvider {
|
||||
const date = new Date();
|
||||
dateFormatter = dayjs(date);
|
||||
|
||||
let status;
|
||||
switch (working.type) {
|
||||
case Status.INDEX_MODIFIED:
|
||||
status = 'Modified';
|
||||
break;
|
||||
case Status.INDEX_ADDED:
|
||||
status = 'Added';
|
||||
break;
|
||||
case Status.INDEX_DELETED:
|
||||
status = 'Deleted';
|
||||
break;
|
||||
case Status.INDEX_RENAMED:
|
||||
status = 'Renamed';
|
||||
break;
|
||||
case Status.INDEX_COPIED:
|
||||
status = 'Copied';
|
||||
break;
|
||||
default:
|
||||
status = '';
|
||||
break;
|
||||
}
|
||||
|
||||
const item = new GitTimelineItem('', index ? '~' : 'HEAD', 'Uncommited Changes', date.getTime(), 'working', 'git:file:working');
|
||||
const item = new GitTimelineItem('', index ? '~' : 'HEAD', localize('git.timeline.uncommitedChanges', 'Uncommited Changes'), date.getTime(), 'working', 'git:file:working');
|
||||
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
|
||||
item.iconPath = new (ThemeIcon as any)('git-commit');
|
||||
item.description = 'You';
|
||||
item.detail = `You \u2014 Working Tree\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n${status}`;
|
||||
item.description = you;
|
||||
item.detail = localize('git.timeline.detail', '{0} \u2014 {1}\n{2}\n\n{3}', you, localize('git.workingTree', 'Working Tree'), dateFormatter.format('MMMM Do, YYYY h:mma'), Resource.getStatusText(working.type));
|
||||
item.command = {
|
||||
title: 'Open Comparison',
|
||||
command: 'git.timeline.openDiff',
|
||||
|
||||
@@ -10,6 +10,13 @@ import Logger from './common/logger';
|
||||
|
||||
export const onDidChangeSessions = new vscode.EventEmitter<void>();
|
||||
|
||||
interface SessionData {
|
||||
id: string;
|
||||
accountName: string;
|
||||
scopes: string[];
|
||||
accessToken: string;
|
||||
}
|
||||
|
||||
export class GitHubAuthenticationProvider {
|
||||
private _sessions: vscode.AuthenticationSession[] = [];
|
||||
private _githubServer = new GitHubServer();
|
||||
@@ -58,7 +65,15 @@ export class GitHubAuthenticationProvider {
|
||||
const storedSessions = await keychain.getToken();
|
||||
if (storedSessions) {
|
||||
try {
|
||||
return JSON.parse(storedSessions);
|
||||
const sessionData: SessionData[] = JSON.parse(storedSessions);
|
||||
return sessionData.map(session => {
|
||||
return {
|
||||
id: session.id,
|
||||
accountName: session.accountName,
|
||||
scopes: session.scopes,
|
||||
accessToken: () => Promise.resolve(session.accessToken)
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
Logger.error(`Error reading sessions: ${e}`);
|
||||
}
|
||||
@@ -68,7 +83,17 @@ export class GitHubAuthenticationProvider {
|
||||
}
|
||||
|
||||
private async storeSessions(): Promise<void> {
|
||||
await keychain.setToken(JSON.stringify(this._sessions));
|
||||
const sessionData: SessionData[] = await Promise.all(this._sessions.map(async session => {
|
||||
const resolvedAccessToken = await session.accessToken();
|
||||
return {
|
||||
id: session.id,
|
||||
accountName: session.accountName,
|
||||
scopes: session.scopes,
|
||||
accessToken: resolvedAccessToken
|
||||
};
|
||||
}));
|
||||
|
||||
await keychain.setToken(JSON.stringify(sessionData));
|
||||
}
|
||||
|
||||
get sessions(): vscode.AuthenticationSession[] {
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
"onCommand:imagePreview.zoomOut"
|
||||
],
|
||||
"contributes": {
|
||||
"webviewEditors": [
|
||||
"customEditors": [
|
||||
{
|
||||
"viewType": "imagePreview.previewEditor",
|
||||
"displayName": "%webviewEditors.displayName%",
|
||||
"displayName": "%customEditors.displayName%",
|
||||
"priority": "builtin",
|
||||
"selector": [
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"displayName": "Image Preview",
|
||||
"description": "Provides VS Code's built-in image preview",
|
||||
"webviewEditors.displayName": "Image Preview",
|
||||
"customEditors.displayName": "Image Preview",
|
||||
"command.zoomIn": "Zoom in",
|
||||
"command.zoomOut": "Zoom out"
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
const previewManager = new PreviewManager(extensionRoot, sizeStatusBarEntry, binarySizeStatusBarEntry, zoomStatusBarEntry);
|
||||
|
||||
context.subscriptions.push(vscode.window.registerWebviewCustomEditorProvider(PreviewManager.viewType, previewManager));
|
||||
context.subscriptions.push(vscode.window.registerCustomEditorProvider(PreviewManager.viewType, previewManager));
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomIn', () => {
|
||||
previewManager.activePreview?.zoomIn();
|
||||
|
||||
@@ -13,7 +13,7 @@ import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
export class PreviewManager implements vscode.WebviewCustomEditorProvider {
|
||||
export class PreviewManager implements vscode.CustomEditorProvider {
|
||||
|
||||
public static readonly viewType = 'imagePreview.previewEditor';
|
||||
|
||||
@@ -27,12 +27,12 @@ export class PreviewManager implements vscode.WebviewCustomEditorProvider {
|
||||
private readonly zoomStatusBarEntry: ZoomStatusBarEntry,
|
||||
) { }
|
||||
|
||||
public async provideWebviewCustomEditorDocument(resource: vscode.Uri) {
|
||||
return vscode.window.createWebviewEditorCustomDocument(PreviewManager.viewType, resource, undefined, {});
|
||||
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<vscode.CustomEditorCapabilities> {
|
||||
return {};
|
||||
}
|
||||
|
||||
public async resolveWebviewCustomEditor(
|
||||
document: vscode.WebviewEditorCustomDocument,
|
||||
public async resolveCustomEditor(
|
||||
document: vscode.CustomDocument,
|
||||
webviewEditor: vscode.WebviewPanel,
|
||||
): Promise<void> {
|
||||
const preview = new Preview(this.extensionRoot, document.uri, webviewEditor, this.sizeStatusBarEntry, this.binarySizeStatusBarEntry, this.zoomStatusBarEntry);
|
||||
|
||||
@@ -310,7 +310,7 @@
|
||||
"markdown.previewScripts": [
|
||||
"./media/index.js"
|
||||
],
|
||||
"webviewEditors": [
|
||||
"customEditors": [
|
||||
{
|
||||
"viewType": "vscode.markdown.preview.editor",
|
||||
"displayName": "(Experimental) VS Code Markdown Preview",
|
||||
|
||||
@@ -52,7 +52,7 @@ class PreviewStore extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
export class MarkdownPreviewManager extends Disposable implements vscode.WebviewPanelSerializer, vscode.WebviewCustomEditorProvider {
|
||||
export class MarkdownPreviewManager extends Disposable implements vscode.WebviewPanelSerializer, vscode.CustomEditorProvider {
|
||||
private static readonly markdownPreviewActiveContextKey = 'markdownPreviewFocus';
|
||||
|
||||
private readonly _topmostLineMonitor = new TopmostLineMonitor();
|
||||
@@ -70,7 +70,7 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
||||
) {
|
||||
super();
|
||||
this._register(vscode.window.registerWebviewPanelSerializer(DynamicMarkdownPreview.viewType, this));
|
||||
this._register(vscode.window.registerWebviewCustomEditorProvider('vscode.markdown.preview.editor', this));
|
||||
this._register(vscode.window.registerCustomEditorProvider('vscode.markdown.preview.editor', this));
|
||||
}
|
||||
|
||||
public refresh() {
|
||||
@@ -148,12 +148,12 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
||||
this.registerDynamicPreview(preview);
|
||||
}
|
||||
|
||||
public async provideWebviewCustomEditorDocument(resource: vscode.Uri) {
|
||||
return vscode.window.createWebviewEditorCustomDocument('vscode.markdown.preview.editor', resource, undefined, {});
|
||||
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<vscode.CustomEditorCapabilities> {
|
||||
return {};
|
||||
}
|
||||
|
||||
public async resolveWebviewCustomEditor(
|
||||
document: vscode.WebviewEditorCustomDocument,
|
||||
public async resolveCustomEditor(
|
||||
document: vscode.CustomDocument,
|
||||
webview: vscode.WebviewPanel
|
||||
): Promise<void> {
|
||||
const preview = DynamicMarkdownPreview.revive(
|
||||
|
||||
@@ -295,8 +295,8 @@ export class AzureActiveDirectoryService {
|
||||
|
||||
private getCallbackEnvironment(callbackUri: vscode.Uri): string {
|
||||
switch (callbackUri.authority) {
|
||||
case 'online.visualstudio.com,':
|
||||
return 'vso';
|
||||
case 'online.visualstudio.com':
|
||||
return 'vso,';
|
||||
case 'online-ppe.core.vsengsaas.visualstudio.com':
|
||||
return 'vsoppe,';
|
||||
case 'online.dev.core.vsengsaas.visualstudio.com':
|
||||
@@ -397,7 +397,7 @@ export class AzureActiveDirectoryService {
|
||||
const claims = this.getTokenClaims(json.access_token);
|
||||
return {
|
||||
expiresIn: json.expires_in,
|
||||
expiresAt: Date.now() + json.expires_in * 1000,
|
||||
expiresAt: json.expires_in ? Date.now() + json.expires_in * 1000 : undefined,
|
||||
accessToken: json.access_token,
|
||||
refreshToken: json.refresh_token,
|
||||
scope,
|
||||
|
||||
Reference in New Issue
Block a user