mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-04-05 03:20:29 -04:00
Merge from vscode dbe62be3266ffb6772a7f3db0bf61d63f4aa7f65 (#9337)
This commit is contained in:
@@ -142,23 +142,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dockerFileAndContext": {
|
"dockerfileContainer": {
|
||||||
"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": {
|
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -168,7 +152,20 @@
|
|||||||
"description": "Docker build-related options.",
|
"description": "Docker build-related options.",
|
||||||
"allOf": [
|
"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"
|
"$ref": "#/definitions/buildOptions"
|
||||||
@@ -183,7 +180,20 @@
|
|||||||
{
|
{
|
||||||
"allOf": [
|
"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",
|
"type": "object",
|
||||||
@@ -280,7 +290,7 @@
|
|||||||
{
|
{
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/dockerFileContainer"
|
"$ref": "#/definitions/dockerfileContainer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/imageContainer"
|
"$ref": "#/definitions/imageContainer"
|
||||||
|
|||||||
@@ -430,26 +430,26 @@ export class CommandCenter {
|
|||||||
case Status.INDEX_MODIFIED:
|
case Status.INDEX_MODIFIED:
|
||||||
case Status.INDEX_RENAMED:
|
case Status.INDEX_RENAMED:
|
||||||
case Status.INDEX_ADDED:
|
case Status.INDEX_ADDED:
|
||||||
return `${basename} (Index)`;
|
return localize('git.title.index', '{0} (Index)', basename);
|
||||||
|
|
||||||
case Status.MODIFIED:
|
case Status.MODIFIED:
|
||||||
case Status.BOTH_ADDED:
|
case Status.BOTH_ADDED:
|
||||||
case Status.BOTH_MODIFIED:
|
case Status.BOTH_MODIFIED:
|
||||||
return `${basename} (Working Tree)`;
|
return localize('git.title.workingTree', '{0} (Working Tree)', basename);
|
||||||
|
|
||||||
case Status.DELETED_BY_US:
|
case Status.DELETED_BY_US:
|
||||||
return `${basename} (Theirs)`;
|
return localize('git.title.theirs', '{0} (Theirs)', basename);
|
||||||
|
|
||||||
case Status.DELETED_BY_THEM:
|
case Status.DELETED_BY_THEM:
|
||||||
return `${basename} (Ours)`;
|
return localize('git.title.ours', '{0} (Ours)', basename);
|
||||||
|
|
||||||
case Status.UNTRACKED:
|
case Status.UNTRACKED:
|
||||||
|
return localize('git.title.untracked', '{0} (Untracked)', basename);
|
||||||
|
|
||||||
return `${basename} (Untracked)`;
|
default:
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@command('git.clone')
|
@command('git.clone')
|
||||||
async clone(url?: string, parentPath?: string): Promise<void> {
|
async clone(url?: string, parentPath?: string): Promise<void> {
|
||||||
@@ -2348,12 +2348,12 @@ export class CommandCenter {
|
|||||||
|
|
||||||
let title;
|
let title;
|
||||||
if ((item.previousRef === 'HEAD' || item.previousRef === '~') && item.ref === '') {
|
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 === '~') {
|
else if (item.previousRef === 'HEAD' && item.ref === '~') {
|
||||||
title = `${basename} (Index)`;
|
title = localize('git.title.index', '{0} (Index)', basename);
|
||||||
} else {
|
} 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);
|
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 {
|
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
|
@memoize
|
||||||
get resourceUri(): Uri {
|
get resourceUri(): Uri {
|
||||||
if (this.renameResourceUri && (this._type === Status.MODIFIED || this._type === Status.DELETED || this._type === Status.INDEX_RENAMED || this._type === Status.INDEX_COPIED)) {
|
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 {
|
private get tooltip(): string {
|
||||||
switch (this.type) {
|
return Resource.getStatusText(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 '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private get strikeThrough(): boolean {
|
private get strikeThrough(): boolean {
|
||||||
|
|||||||
@@ -3,17 +3,18 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* 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 dayjs from 'dayjs';
|
||||||
import * as advancedFormat from 'dayjs/plugin/advancedFormat';
|
import * as advancedFormat from 'dayjs/plugin/advancedFormat';
|
||||||
import { CancellationToken, Disposable, Event, EventEmitter, ThemeIcon, Timeline, TimelineChangeEvent, TimelineItem, TimelineOptions, TimelineProvider, Uri, workspace } from 'vscode';
|
import { CancellationToken, Disposable, Event, EventEmitter, ThemeIcon, Timeline, TimelineChangeEvent, TimelineItem, TimelineOptions, TimelineProvider, Uri, workspace } from 'vscode';
|
||||||
import { Model } from './model';
|
import { Model } from './model';
|
||||||
import { Repository } from './repository';
|
import { Repository, Resource } from './repository';
|
||||||
import { debounce } from './decorators';
|
import { debounce } from './decorators';
|
||||||
import { Status } from './api/git';
|
|
||||||
|
|
||||||
dayjs.extend(advancedFormat);
|
dayjs.extend(advancedFormat);
|
||||||
|
|
||||||
// TODO[ECA]: Localize all the strings
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
// TODO[ECA]: Localize or use a setting for date format
|
// TODO[ECA]: Localize or use a setting for date format
|
||||||
|
|
||||||
export class GitTimelineItem extends TimelineItem {
|
export class GitTimelineItem extends TimelineItem {
|
||||||
@@ -68,7 +69,7 @@ export class GitTimelineProvider implements TimelineProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readonly id = 'git-history';
|
readonly id = 'git-history';
|
||||||
readonly label = 'Git History';
|
readonly label = localize('git.timeline.source', 'Git History');
|
||||||
|
|
||||||
private _disposable: Disposable;
|
private _disposable: Disposable;
|
||||||
|
|
||||||
@@ -171,38 +172,18 @@ export class GitTimelineProvider implements TimelineProvider {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (options.cursor === undefined || options.before) {
|
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);
|
const index = repo.indexGroup.resourceStates.find(r => r.resourceUri.fsPath === uri.fsPath);
|
||||||
if (index) {
|
if (index) {
|
||||||
const date = this._repoStatusDate ?? new Date();
|
const date = this._repoStatusDate ?? new Date();
|
||||||
dateFormatter = dayjs(date);
|
dateFormatter = dayjs(date);
|
||||||
|
|
||||||
let status;
|
const item = new GitTimelineItem('~', 'HEAD', localize('git.timeline.stagedChanges', 'Staged Changes'), date.getTime(), 'index', 'git:file:index');
|
||||||
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');
|
|
||||||
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
|
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
|
||||||
item.iconPath = new (ThemeIcon as any)('git-commit');
|
item.iconPath = new (ThemeIcon as any)('git-commit');
|
||||||
item.description = 'You';
|
item.description = you;
|
||||||
item.detail = `You \u2014 Index\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n${status}`;
|
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 = {
|
item.command = {
|
||||||
title: 'Open Comparison',
|
title: 'Open Comparison',
|
||||||
command: 'git.timeline.openDiff',
|
command: 'git.timeline.openDiff',
|
||||||
@@ -217,33 +198,11 @@ export class GitTimelineProvider implements TimelineProvider {
|
|||||||
const date = new Date();
|
const date = new Date();
|
||||||
dateFormatter = dayjs(date);
|
dateFormatter = dayjs(date);
|
||||||
|
|
||||||
let status;
|
const item = new GitTimelineItem('', index ? '~' : 'HEAD', localize('git.timeline.uncommitedChanges', 'Uncommited Changes'), date.getTime(), 'working', 'git:file:working');
|
||||||
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');
|
|
||||||
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
|
// TODO[ECA]: Replace with a better icon -- reflecting its status maybe?
|
||||||
item.iconPath = new (ThemeIcon as any)('git-commit');
|
item.iconPath = new (ThemeIcon as any)('git-commit');
|
||||||
item.description = 'You';
|
item.description = you;
|
||||||
item.detail = `You \u2014 Working Tree\n${dateFormatter.format('MMMM Do, YYYY h:mma')}\n${status}`;
|
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 = {
|
item.command = {
|
||||||
title: 'Open Comparison',
|
title: 'Open Comparison',
|
||||||
command: 'git.timeline.openDiff',
|
command: 'git.timeline.openDiff',
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ import Logger from './common/logger';
|
|||||||
|
|
||||||
export const onDidChangeSessions = new vscode.EventEmitter<void>();
|
export const onDidChangeSessions = new vscode.EventEmitter<void>();
|
||||||
|
|
||||||
|
interface SessionData {
|
||||||
|
id: string;
|
||||||
|
accountName: string;
|
||||||
|
scopes: string[];
|
||||||
|
accessToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
export class GitHubAuthenticationProvider {
|
export class GitHubAuthenticationProvider {
|
||||||
private _sessions: vscode.AuthenticationSession[] = [];
|
private _sessions: vscode.AuthenticationSession[] = [];
|
||||||
private _githubServer = new GitHubServer();
|
private _githubServer = new GitHubServer();
|
||||||
@@ -58,7 +65,15 @@ export class GitHubAuthenticationProvider {
|
|||||||
const storedSessions = await keychain.getToken();
|
const storedSessions = await keychain.getToken();
|
||||||
if (storedSessions) {
|
if (storedSessions) {
|
||||||
try {
|
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) {
|
} catch (e) {
|
||||||
Logger.error(`Error reading sessions: ${e}`);
|
Logger.error(`Error reading sessions: ${e}`);
|
||||||
}
|
}
|
||||||
@@ -68,7 +83,17 @@ export class GitHubAuthenticationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async storeSessions(): Promise<void> {
|
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[] {
|
get sessions(): vscode.AuthenticationSession[] {
|
||||||
|
|||||||
@@ -22,10 +22,10 @@
|
|||||||
"onCommand:imagePreview.zoomOut"
|
"onCommand:imagePreview.zoomOut"
|
||||||
],
|
],
|
||||||
"contributes": {
|
"contributes": {
|
||||||
"webviewEditors": [
|
"customEditors": [
|
||||||
{
|
{
|
||||||
"viewType": "imagePreview.previewEditor",
|
"viewType": "imagePreview.previewEditor",
|
||||||
"displayName": "%webviewEditors.displayName%",
|
"displayName": "%customEditors.displayName%",
|
||||||
"priority": "builtin",
|
"priority": "builtin",
|
||||||
"selector": [
|
"selector": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"displayName": "Image Preview",
|
"displayName": "Image Preview",
|
||||||
"description": "Provides VS Code's built-in image preview",
|
"description": "Provides VS Code's built-in image preview",
|
||||||
"webviewEditors.displayName": "Image Preview",
|
"customEditors.displayName": "Image Preview",
|
||||||
"command.zoomIn": "Zoom in",
|
"command.zoomIn": "Zoom in",
|
||||||
"command.zoomOut": "Zoom out"
|
"command.zoomOut": "Zoom out"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
const previewManager = new PreviewManager(extensionRoot, sizeStatusBarEntry, binarySizeStatusBarEntry, zoomStatusBarEntry);
|
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', () => {
|
context.subscriptions.push(vscode.commands.registerCommand('imagePreview.zoomIn', () => {
|
||||||
previewManager.activePreview?.zoomIn();
|
previewManager.activePreview?.zoomIn();
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { BinarySizeStatusBarEntry } from './binarySizeStatusBarEntry';
|
|||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
|
|
||||||
export class PreviewManager implements vscode.WebviewCustomEditorProvider {
|
export class PreviewManager implements vscode.CustomEditorProvider {
|
||||||
|
|
||||||
public static readonly viewType = 'imagePreview.previewEditor';
|
public static readonly viewType = 'imagePreview.previewEditor';
|
||||||
|
|
||||||
@@ -27,12 +27,12 @@ export class PreviewManager implements vscode.WebviewCustomEditorProvider {
|
|||||||
private readonly zoomStatusBarEntry: ZoomStatusBarEntry,
|
private readonly zoomStatusBarEntry: ZoomStatusBarEntry,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public async provideWebviewCustomEditorDocument(resource: vscode.Uri) {
|
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<vscode.CustomEditorCapabilities> {
|
||||||
return vscode.window.createWebviewEditorCustomDocument(PreviewManager.viewType, resource, undefined, {});
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveWebviewCustomEditor(
|
public async resolveCustomEditor(
|
||||||
document: vscode.WebviewEditorCustomDocument,
|
document: vscode.CustomDocument,
|
||||||
webviewEditor: vscode.WebviewPanel,
|
webviewEditor: vscode.WebviewPanel,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const preview = new Preview(this.extensionRoot, document.uri, webviewEditor, this.sizeStatusBarEntry, this.binarySizeStatusBarEntry, this.zoomStatusBarEntry);
|
const preview = new Preview(this.extensionRoot, document.uri, webviewEditor, this.sizeStatusBarEntry, this.binarySizeStatusBarEntry, this.zoomStatusBarEntry);
|
||||||
|
|||||||
@@ -310,7 +310,7 @@
|
|||||||
"markdown.previewScripts": [
|
"markdown.previewScripts": [
|
||||||
"./media/index.js"
|
"./media/index.js"
|
||||||
],
|
],
|
||||||
"webviewEditors": [
|
"customEditors": [
|
||||||
{
|
{
|
||||||
"viewType": "vscode.markdown.preview.editor",
|
"viewType": "vscode.markdown.preview.editor",
|
||||||
"displayName": "(Experimental) VS Code Markdown Preview",
|
"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 static readonly markdownPreviewActiveContextKey = 'markdownPreviewFocus';
|
||||||
|
|
||||||
private readonly _topmostLineMonitor = new TopmostLineMonitor();
|
private readonly _topmostLineMonitor = new TopmostLineMonitor();
|
||||||
@@ -70,7 +70,7 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
|||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._register(vscode.window.registerWebviewPanelSerializer(DynamicMarkdownPreview.viewType, this));
|
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() {
|
public refresh() {
|
||||||
@@ -148,12 +148,12 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
|||||||
this.registerDynamicPreview(preview);
|
this.registerDynamicPreview(preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async provideWebviewCustomEditorDocument(resource: vscode.Uri) {
|
public async resolveCustomDocument(_document: vscode.CustomDocument): Promise<vscode.CustomEditorCapabilities> {
|
||||||
return vscode.window.createWebviewEditorCustomDocument('vscode.markdown.preview.editor', resource, undefined, {});
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async resolveWebviewCustomEditor(
|
public async resolveCustomEditor(
|
||||||
document: vscode.WebviewEditorCustomDocument,
|
document: vscode.CustomDocument,
|
||||||
webview: vscode.WebviewPanel
|
webview: vscode.WebviewPanel
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const preview = DynamicMarkdownPreview.revive(
|
const preview = DynamicMarkdownPreview.revive(
|
||||||
|
|||||||
@@ -295,8 +295,8 @@ export class AzureActiveDirectoryService {
|
|||||||
|
|
||||||
private getCallbackEnvironment(callbackUri: vscode.Uri): string {
|
private getCallbackEnvironment(callbackUri: vscode.Uri): string {
|
||||||
switch (callbackUri.authority) {
|
switch (callbackUri.authority) {
|
||||||
case 'online.visualstudio.com,':
|
case 'online.visualstudio.com':
|
||||||
return 'vso';
|
return 'vso,';
|
||||||
case 'online-ppe.core.vsengsaas.visualstudio.com':
|
case 'online-ppe.core.vsengsaas.visualstudio.com':
|
||||||
return 'vsoppe,';
|
return 'vsoppe,';
|
||||||
case 'online.dev.core.vsengsaas.visualstudio.com':
|
case 'online.dev.core.vsengsaas.visualstudio.com':
|
||||||
@@ -397,7 +397,7 @@ export class AzureActiveDirectoryService {
|
|||||||
const claims = this.getTokenClaims(json.access_token);
|
const claims = this.getTokenClaims(json.access_token);
|
||||||
return {
|
return {
|
||||||
expiresIn: json.expires_in,
|
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,
|
accessToken: json.access_token,
|
||||||
refreshToken: json.refresh_token,
|
refreshToken: json.refresh_token,
|
||||||
scope,
|
scope,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { pad } from './strings';
|
import { pad } from './strings';
|
||||||
|
import { localize } from 'vs/nls';
|
||||||
|
|
||||||
const minute = 60;
|
const minute = 60;
|
||||||
const hour = minute * 60;
|
const hour = minute * 60;
|
||||||
@@ -12,7 +13,6 @@ const week = day * 7;
|
|||||||
const month = day * 30;
|
const month = day * 30;
|
||||||
const year = day * 365;
|
const year = day * 365;
|
||||||
|
|
||||||
// TODO[ECA]: Localize strings
|
|
||||||
export function fromNow(date: number | Date, appendAgoLabel?: boolean): string {
|
export function fromNow(date: number | Date, appendAgoLabel?: boolean): string {
|
||||||
if (typeof date !== 'number') {
|
if (typeof date !== 'number') {
|
||||||
date = date.getTime();
|
date = date.getTime();
|
||||||
@@ -20,36 +20,99 @@ export function fromNow(date: number | Date, appendAgoLabel?: boolean): string {
|
|||||||
|
|
||||||
const seconds = Math.round((new Date().getTime() - date) / 1000);
|
const seconds = Math.round((new Date().getTime() - date) / 1000);
|
||||||
if (seconds < 30) {
|
if (seconds < 30) {
|
||||||
return 'now';
|
return localize('date.fromNow.now', 'now');
|
||||||
}
|
}
|
||||||
|
|
||||||
let value: number;
|
let value: number;
|
||||||
let unit: string;
|
|
||||||
if (seconds < minute) {
|
if (seconds < minute) {
|
||||||
value = seconds;
|
value = seconds;
|
||||||
unit = 'sec';
|
|
||||||
} else if (seconds < hour) {
|
if (appendAgoLabel) {
|
||||||
value = Math.floor(seconds / minute);
|
return value === 1
|
||||||
unit = 'min';
|
? localize('date.fromNow.seconds.singular.ago', '{0} sec ago', value)
|
||||||
} else if (seconds < day) {
|
: localize('date.fromNow.seconds.plural.ago', '{0} secs ago', value);
|
||||||
value = Math.floor(seconds / hour);
|
|
||||||
unit = 'hr';
|
|
||||||
} else if (seconds < week) {
|
|
||||||
value = Math.floor(seconds / day);
|
|
||||||
unit = 'day';
|
|
||||||
} else if (seconds < month) {
|
|
||||||
value = Math.floor(seconds / week);
|
|
||||||
unit = 'wk';
|
|
||||||
} else if (seconds < year) {
|
|
||||||
value = Math.floor(seconds / month);
|
|
||||||
unit = 'mo';
|
|
||||||
} else {
|
} else {
|
||||||
value = Math.floor(seconds / year);
|
return value === 1
|
||||||
unit = 'yr';
|
? localize('date.fromNow.seconds.singular', '{0} sec', value)
|
||||||
|
: localize('date.fromNow.seconds.plural', '{0} secs', value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${value} ${unit}${value === 1 ? '' : 's'}${appendAgoLabel ? ' ago' : ''}`;
|
if (seconds < hour) {
|
||||||
|
value = Math.floor(seconds / minute);
|
||||||
|
if (appendAgoLabel) {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.minutes.singular.ago', '{0} min ago', value)
|
||||||
|
: localize('date.fromNow.minutes.plural.ago', '{0} mins ago', value);
|
||||||
|
} else {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.minutes.singular', '{0} min', value)
|
||||||
|
: localize('date.fromNow.minutes.plural', '{0} mins', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds < day) {
|
||||||
|
value = Math.floor(seconds / hour);
|
||||||
|
if (appendAgoLabel) {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.hours.singular.ago', '{0} hr ago', value)
|
||||||
|
: localize('date.fromNow.hours.plural.ago', '{0} hrs ago', value);
|
||||||
|
} else {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.hours.singular', '{0} hr', value)
|
||||||
|
: localize('date.fromNow.hours.plural', '{0} hrs', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds < week) {
|
||||||
|
value = Math.floor(seconds / day);
|
||||||
|
if (appendAgoLabel) {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.days.singular.ago', '{0} day ago', value)
|
||||||
|
: localize('date.fromNow.days.plural.ago', '{0} days ago', value);
|
||||||
|
} else {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.days.singular', '{0} day', value)
|
||||||
|
: localize('date.fromNow.days.plural', '{0} days', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds < month) {
|
||||||
|
value = Math.floor(seconds / week);
|
||||||
|
if (appendAgoLabel) {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.weeks.singular.ago', '{0} wk ago', value)
|
||||||
|
: localize('date.fromNow.weeks.plural.ago', '{0} wks ago', value);
|
||||||
|
} else {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.weeks.singular', '{0} wk', value)
|
||||||
|
: localize('date.fromNow.weeks.plural', '{0} wks', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds < year) {
|
||||||
|
value = Math.floor(seconds / month);
|
||||||
|
if (appendAgoLabel) {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.months.singular.ago', '{0} mo ago', value)
|
||||||
|
: localize('date.fromNow.months.plural.ago', '{0} mos ago', value);
|
||||||
|
} else {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.months.singular', '{0} mo', value)
|
||||||
|
: localize('date.fromNow.months.plural', '{0} mos', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
value = Math.floor(seconds / year);
|
||||||
|
if (appendAgoLabel) {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.years.singular.ago', '{0} yr ago', value)
|
||||||
|
: localize('date.fromNow.years.plural.ago', '{0} yrs ago', value);
|
||||||
|
} else {
|
||||||
|
return value === 1
|
||||||
|
? localize('date.fromNow.years.singular', '{0} yr', value)
|
||||||
|
: localize('date.fromNow.years.plural', '{0} yrs', value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toLocalISOString(date: Date): string {
|
export function toLocalISOString(date: Date): string {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ export interface IExtensionContributions {
|
|||||||
views?: { [location: string]: IView[] };
|
views?: { [location: string]: IView[] };
|
||||||
colors?: IColor[];
|
colors?: IColor[];
|
||||||
localizations?: ILocalization[];
|
localizations?: ILocalization[];
|
||||||
readonly webviewEditors?: readonly IWebviewEditor[];
|
readonly customEditors?: readonly IWebviewEditor[];
|
||||||
readonly codeActions?: readonly ICodeActionContribution[];
|
readonly codeActions?: readonly ICodeActionContribution[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ export abstract class AbstractKeybindingService extends Disposable implements IK
|
|||||||
private _currentChordChecker: IntervalTimer;
|
private _currentChordChecker: IntervalTimer;
|
||||||
private _currentChordStatusMessage: IDisposable | null;
|
private _currentChordStatusMessage: IDisposable | null;
|
||||||
|
|
||||||
|
public get inChordMode(): boolean {
|
||||||
|
return !!this._currentChord;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _contextKeyService: IContextKeyService,
|
private _contextKeyService: IContextKeyService,
|
||||||
protected _commandService: ICommandService,
|
protected _commandService: ICommandService,
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ export const IKeybindingService = createDecorator<IKeybindingService>('keybindin
|
|||||||
export interface IKeybindingService {
|
export interface IKeybindingService {
|
||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
|
|
||||||
|
readonly inChordMode: boolean;
|
||||||
|
|
||||||
onDidUpdateKeybindings: Event<IKeybindingEvent>;
|
onDidUpdateKeybindings: Event<IKeybindingEvent>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKe
|
|||||||
import { keys } from 'vs/base/common/map';
|
import { keys } from 'vs/base/common/map';
|
||||||
|
|
||||||
export interface IResolveResult {
|
export interface IResolveResult {
|
||||||
|
/** Whether the resolved keybinding is entering a chord */
|
||||||
enterChord: boolean;
|
enterChord: boolean;
|
||||||
|
/** Whether the resolved keybinding is leaving (and executing) a chord */
|
||||||
|
leaveChord: boolean;
|
||||||
commandId: string | null;
|
commandId: string | null;
|
||||||
commandArgs: any;
|
commandArgs: any;
|
||||||
bubble: boolean;
|
bubble: boolean;
|
||||||
@@ -285,6 +288,7 @@ export class KeybindingResolver {
|
|||||||
if (currentChord === null && result.keypressParts.length > 1 && result.keypressParts[1] !== null) {
|
if (currentChord === null && result.keypressParts.length > 1 && result.keypressParts[1] !== null) {
|
||||||
return {
|
return {
|
||||||
enterChord: true,
|
enterChord: true,
|
||||||
|
leaveChord: false,
|
||||||
commandId: null,
|
commandId: null,
|
||||||
commandArgs: null,
|
commandArgs: null,
|
||||||
bubble: false
|
bubble: false
|
||||||
@@ -293,6 +297,7 @@ export class KeybindingResolver {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
enterChord: false,
|
enterChord: false,
|
||||||
|
leaveChord: result.keypressParts.length > 1,
|
||||||
commandId: result.command,
|
commandId: result.command,
|
||||||
commandArgs: result.commandArgs,
|
commandArgs: result.commandArgs,
|
||||||
bubble: result.bubble
|
bubble: result.bubble
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ export class MockContextKeyService implements IContextKeyService {
|
|||||||
export class MockKeybindingService implements IKeybindingService {
|
export class MockKeybindingService implements IKeybindingService {
|
||||||
public _serviceBrand: undefined;
|
public _serviceBrand: undefined;
|
||||||
|
|
||||||
|
public readonly inChordMode: boolean = false;
|
||||||
|
|
||||||
public get onDidUpdateKeybindings(): Event<IKeybindingEvent> {
|
public get onDidUpdateKeybindings(): Event<IKeybindingEvent> {
|
||||||
return Event.None;
|
return Event.None;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ if (isWeb) {
|
|||||||
// Running out of sources
|
// Running out of sources
|
||||||
if (Object.keys(product).length === 0) {
|
if (Object.keys(product).length === 0) {
|
||||||
assign(product, {
|
assign(product, {
|
||||||
version: '1.41.0-dev',
|
version: '1.16.0-dev',
|
||||||
vscodeVersion: '1.39.0-dev',
|
vscodeVersion: '1.43.0-dev',
|
||||||
nameLong: 'Visual Studio Code Web Dev',
|
nameLong: 'Azure Data Studio Web Dev',
|
||||||
nameShort: 'VSCode Web Dev',
|
nameShort: 'Azure Data Studio Web Dev',
|
||||||
urlProtocol: 'code-oss'
|
urlProtocol: 'azuredatastudio-oss'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { values } from 'vs/base/common/map';
|
|||||||
import { IStringDictionary } from 'vs/base/common/collections';
|
import { IStringDictionary } from 'vs/base/common/collections';
|
||||||
import { FormattingOptions, Edit, getEOL } from 'vs/base/common/jsonFormatter';
|
import { FormattingOptions, Edit, getEOL } from 'vs/base/common/jsonFormatter';
|
||||||
import * as contentUtil from 'vs/platform/userDataSync/common/content';
|
import * as contentUtil from 'vs/platform/userDataSync/common/content';
|
||||||
import { IConflictSetting } from 'vs/platform/userDataSync/common/userDataSync';
|
import { IConflictSetting, getDisallowedIgnoredSettings } from 'vs/platform/userDataSync/common/userDataSync';
|
||||||
import { firstIndex, distinct } from 'vs/base/common/arrays';
|
import { firstIndex, distinct } from 'vs/base/common/arrays';
|
||||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import { startsWith } from 'vs/base/common/strings';
|
import { startsWith } from 'vs/base/common/strings';
|
||||||
@@ -32,7 +32,7 @@ export function getIgnoredSettings(defaultIgnoredSettings: string[], configurati
|
|||||||
} else {
|
} else {
|
||||||
value = configurationService.getValue<string[]>('sync.ignoredSettings');
|
value = configurationService.getValue<string[]>('sync.ignoredSettings');
|
||||||
}
|
}
|
||||||
const added: string[] = [], removed: string[] = [];
|
const added: string[] = [], removed: string[] = [...getDisallowedIgnoredSettings()];
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
for (const key of value) {
|
for (const key of value) {
|
||||||
if (startsWith(key, '-')) {
|
if (startsWith(key, '-')) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { URI } from 'vs/base/common/uri';
|
|||||||
import { isEqual, joinPath } from 'vs/base/common/resources';
|
import { isEqual, joinPath } from 'vs/base/common/resources';
|
||||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
import { IProductService } from 'vs/platform/product/common/productService';
|
import { IProductService } from 'vs/platform/product/common/productService';
|
||||||
|
import { distinct } from 'vs/base/common/arrays';
|
||||||
|
|
||||||
export const CONFIGURATION_SYNC_STORE_KEY = 'configurationSync.store';
|
export const CONFIGURATION_SYNC_STORE_KEY = 'configurationSync.store';
|
||||||
|
|
||||||
@@ -37,10 +38,16 @@ export interface ISyncConfiguration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDisallowedIgnoredSettings(): string[] {
|
||||||
|
const allSettings = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).getConfigurationProperties();
|
||||||
|
return Object.keys(allSettings).filter(setting => !!allSettings[setting].disallowSyncIgnore);
|
||||||
|
}
|
||||||
|
|
||||||
export function getDefaultIgnoredSettings(): string[] {
|
export function getDefaultIgnoredSettings(): string[] {
|
||||||
const allSettings = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).getConfigurationProperties();
|
const allSettings = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).getConfigurationProperties();
|
||||||
const machineSettings = Object.keys(allSettings).filter(setting => allSettings[setting].scope === ConfigurationScope.MACHINE || allSettings[setting].scope === ConfigurationScope.MACHINE_OVERRIDABLE);
|
const machineSettings = Object.keys(allSettings).filter(setting => allSettings[setting].scope === ConfigurationScope.MACHINE || allSettings[setting].scope === ConfigurationScope.MACHINE_OVERRIDABLE);
|
||||||
return [CONFIGURATION_SYNC_STORE_KEY, ...machineSettings];
|
const disallowedSettings = getDisallowedIgnoredSettings();
|
||||||
|
return distinct([CONFIGURATION_SYNC_STORE_KEY, ...machineSettings, ...disallowedSettings]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerConfiguration(): IDisposable {
|
export function registerConfiguration(): IDisposable {
|
||||||
@@ -53,36 +60,6 @@ export function registerConfiguration(): IDisposable {
|
|||||||
title: localize('sync', "Sync"),
|
title: localize('sync', "Sync"),
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
'sync.enable': {
|
|
||||||
type: 'boolean',
|
|
||||||
default: false,
|
|
||||||
scope: ConfigurationScope.APPLICATION,
|
|
||||||
deprecationMessage: 'deprecated'
|
|
||||||
},
|
|
||||||
'sync.enableSettings': {
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
scope: ConfigurationScope.APPLICATION,
|
|
||||||
deprecationMessage: 'deprecated'
|
|
||||||
},
|
|
||||||
'sync.enableKeybindings': {
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
scope: ConfigurationScope.APPLICATION,
|
|
||||||
deprecationMessage: 'Deprecated'
|
|
||||||
},
|
|
||||||
'sync.enableUIState': {
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
scope: ConfigurationScope.APPLICATION,
|
|
||||||
deprecationMessage: 'deprecated'
|
|
||||||
},
|
|
||||||
'sync.enableExtensions': {
|
|
||||||
type: 'boolean',
|
|
||||||
default: true,
|
|
||||||
scope: ConfigurationScope.APPLICATION,
|
|
||||||
deprecationMessage: 'deprecated'
|
|
||||||
},
|
|
||||||
'sync.keybindingsPerPlatform': {
|
'sync.keybindingsPerPlatform': {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: localize('sync.keybindingsPerPlatform', "Synchronize keybindings per platform."),
|
description: localize('sync.keybindingsPerPlatform', "Synchronize keybindings per platform."),
|
||||||
@@ -115,11 +92,15 @@ export function registerConfiguration(): IDisposable {
|
|||||||
});
|
});
|
||||||
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
|
const jsonRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensions.JSONContribution);
|
||||||
const registerIgnoredSettingsSchema = () => {
|
const registerIgnoredSettingsSchema = () => {
|
||||||
const defaultIgnoreSettings = getDefaultIgnoredSettings().filter(s => s !== CONFIGURATION_SYNC_STORE_KEY);
|
const disallowedIgnoredSettings = getDisallowedIgnoredSettings();
|
||||||
|
const defaultIgnoredSettings = getDefaultIgnoredSettings().filter(s => s !== CONFIGURATION_SYNC_STORE_KEY);
|
||||||
|
const settings = Object.keys(allSettings.properties).filter(setting => defaultIgnoredSettings.indexOf(setting) === -1);
|
||||||
|
const ignoredSettings = defaultIgnoredSettings.filter(setting => disallowedIgnoredSettings.indexOf(setting) === -1);
|
||||||
|
console.log(ignoredSettings);
|
||||||
const ignoredSettingsSchema: IJSONSchema = {
|
const ignoredSettingsSchema: IJSONSchema = {
|
||||||
items: {
|
items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: [...Object.keys(allSettings.properties).filter(setting => defaultIgnoreSettings.indexOf(setting) === -1), ...defaultIgnoreSettings.map(setting => `-${setting}`)]
|
enum: [...settings, ...ignoredSettings.map(setting => `-${setting}`)]
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
jsonRegistry.registerSchema(ignoredSettingsSchemaId, ignoredSettingsSchema);
|
jsonRegistry.registerSchema(ignoredSettingsSchemaId, ignoredSettingsSchema);
|
||||||
|
|||||||
13
src/vs/vscode.d.ts
vendored
13
src/vs/vscode.d.ts
vendored
@@ -4675,7 +4675,18 @@ declare module 'vscode' {
|
|||||||
* A code or identifier for this diagnostic.
|
* A code or identifier for this diagnostic.
|
||||||
* Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
|
* Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
|
||||||
*/
|
*/
|
||||||
code?: string | number;
|
code?: string | number | {
|
||||||
|
/**
|
||||||
|
* A code or identifier for this diagnostic.
|
||||||
|
* Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
|
||||||
|
*/
|
||||||
|
value: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A target URI to open with more information about the diagnostic error.
|
||||||
|
*/
|
||||||
|
target: Uri;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of related diagnostic information, e.g. when symbol-names within
|
* An array of related diagnostic information, e.g. when symbol-names within
|
||||||
|
|||||||
96
src/vs/vscode.proposed.d.ts
vendored
96
src/vs/vscode.proposed.d.ts
vendored
@@ -1188,22 +1188,21 @@ declare module 'vscode' {
|
|||||||
//#region Custom editors: https://github.com/microsoft/vscode/issues/77131
|
//#region Custom editors: https://github.com/microsoft/vscode/issues/77131
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - Naming!
|
|
||||||
// - Think about where a rename would live.
|
// - Think about where a rename would live.
|
||||||
// - Think about handling go to line?
|
// - Think about handling go to line? (add other editor options? reveal?)
|
||||||
// - Should we expose edits?
|
// - Should we expose edits?
|
||||||
// - More properties from `TextDocument`?
|
// - More properties from `TextDocument`?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the capabilities of a custom webview editor.
|
* Defines the capabilities of a custom webview editor.
|
||||||
*/
|
*/
|
||||||
interface WebviewCustomEditorCapabilities {
|
interface CustomEditorCapabilities {
|
||||||
/**
|
/**
|
||||||
* Defines the editing capability of a custom webview document.
|
* Defines the editing capability of a custom webview document.
|
||||||
*
|
*
|
||||||
* When not provided, the document is considered readonly.
|
* When not provided, the document is considered readonly.
|
||||||
*/
|
*/
|
||||||
readonly editing?: WebviewCustomEditorEditingCapability;
|
readonly editing?: CustomEditorEditingCapability;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1212,7 +1211,7 @@ declare module 'vscode' {
|
|||||||
*
|
*
|
||||||
* @param EditType Type of edits.
|
* @param EditType Type of edits.
|
||||||
*/
|
*/
|
||||||
interface WebviewCustomEditorEditingCapability<EditType = unknown> {
|
interface CustomEditorEditingCapability<EditType = unknown> {
|
||||||
/**
|
/**
|
||||||
* Save the resource.
|
* Save the resource.
|
||||||
*
|
*
|
||||||
@@ -1286,7 +1285,7 @@ declare module 'vscode' {
|
|||||||
*
|
*
|
||||||
* @param UserDataType Type of custom object that extensions can store on the document.
|
* @param UserDataType Type of custom object that extensions can store on the document.
|
||||||
*/
|
*/
|
||||||
interface WebviewEditorCustomDocument<UserDataType = unknown> {
|
interface CustomDocument<UserDataType = unknown> {
|
||||||
/**
|
/**
|
||||||
* The associated viewType for this document.
|
* The associated viewType for this document.
|
||||||
*/
|
*/
|
||||||
@@ -1305,7 +1304,7 @@ declare module 'vscode' {
|
|||||||
/**
|
/**
|
||||||
* Custom data that an extension can store on the document.
|
* Custom data that an extension can store on the document.
|
||||||
*/
|
*/
|
||||||
readonly userData: UserDataType;
|
userData?: UserDataType;
|
||||||
|
|
||||||
// TODO: Should we expose edits here?
|
// TODO: Should we expose edits here?
|
||||||
// This could be helpful for tracking the life cycle of edits
|
// This could be helpful for tracking the life cycle of edits
|
||||||
@@ -1320,13 +1319,13 @@ declare module 'vscode' {
|
|||||||
* You should use custom text based editors when dealing with binary files or more complex scenarios. For simple text
|
* You should use custom text based editors when dealing with binary files or more complex scenarios. For simple text
|
||||||
* based documents, use [`WebviewTextEditorProvider`](#WebviewTextEditorProvider) instead.
|
* based documents, use [`WebviewTextEditorProvider`](#WebviewTextEditorProvider) instead.
|
||||||
*/
|
*/
|
||||||
export interface WebviewCustomEditorProvider {
|
export interface CustomEditorProvider {
|
||||||
/**
|
/**
|
||||||
* Create the model for a given
|
* Create the model for a given
|
||||||
*
|
*
|
||||||
* @param document Resource being resolved.
|
* @param document Resource being resolved.
|
||||||
*/
|
*/
|
||||||
provideWebviewCustomEditorDocument(resource: Uri): Thenable<WebviewEditorCustomDocument>;
|
resolveCustomDocument(document: CustomDocument): Thenable<CustomEditorCapabilities>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve a webview editor for a given resource.
|
* Resolve a webview editor for a given resource.
|
||||||
@@ -1339,7 +1338,7 @@ declare module 'vscode' {
|
|||||||
*
|
*
|
||||||
* @return Thenable indicating that the webview editor has been resolved.
|
* @return Thenable indicating that the webview editor has been resolved.
|
||||||
*/
|
*/
|
||||||
resolveWebviewCustomEditor(document: WebviewEditorCustomDocument, webview: WebviewPanel): Thenable<void>;
|
resolveCustomEditor(document: CustomDocument, webview: WebviewPanel): Thenable<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1352,7 +1351,7 @@ declare module 'vscode' {
|
|||||||
* You should use text based webview editors when dealing with text based file formats, such as `xml` or `json`.
|
* You should use text based webview editors when dealing with text based file formats, such as `xml` or `json`.
|
||||||
* For binary files or more specialized use cases, see [WebviewCustomEditorProvider](#WebviewCustomEditorProvider).
|
* For binary files or more specialized use cases, see [WebviewCustomEditorProvider](#WebviewCustomEditorProvider).
|
||||||
*/
|
*/
|
||||||
export interface WebviewTextEditorProvider {
|
export interface CustomTextEditorProvider {
|
||||||
/**
|
/**
|
||||||
* Resolve a webview editor for a given resource.
|
* Resolve a webview editor for a given resource.
|
||||||
*
|
*
|
||||||
@@ -1364,64 +1363,25 @@ declare module 'vscode' {
|
|||||||
*
|
*
|
||||||
* @return Thenable indicating that the webview editor has been resolved.
|
* @return Thenable indicating that the webview editor has been resolved.
|
||||||
*/
|
*/
|
||||||
resolveWebviewTextEditor(document: TextDocument, webview: WebviewPanel): Thenable<void>;
|
resolveCustomTextEditor(document: TextDocument, webview: WebviewPanel): Thenable<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace window {
|
namespace window {
|
||||||
/**
|
/**
|
||||||
* Register a new provider for text based webview editors.
|
* Register a new provider for a custom editor.
|
||||||
*
|
|
||||||
* @param viewType Type of the webview editor provider. This should match the `viewType` from the
|
|
||||||
* `package.json` contributions
|
|
||||||
* @param provider Provider that resolves webview editors.
|
|
||||||
* @param webviewOptions Content settings for the webview panels that provider is given.
|
|
||||||
*
|
|
||||||
* @return Disposable that unregisters the `WebviewTextEditorProvider`.
|
|
||||||
*/
|
|
||||||
export function registerWebviewTextEditorProvider(
|
|
||||||
viewType: string,
|
|
||||||
provider: WebviewTextEditorProvider,
|
|
||||||
webviewOptions?: WebviewPanelOptions,
|
|
||||||
): Disposable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new provider for custom webview editors.
|
|
||||||
*
|
*
|
||||||
* @param viewType Type of the webview editor provider. This should match the `viewType` from the
|
* @param viewType Type of the webview editor provider. This should match the `viewType` from the
|
||||||
* `package.json` contributions.
|
* `package.json` contributions.
|
||||||
* @param provider Provider that resolves webview editors.
|
* @param provider Provider that resolves editors.
|
||||||
* @param webviewOptions Content settings for the webview panels that provider is given.
|
* @param webviewOptions Content settings for the webview panels that the provider is given.
|
||||||
*
|
*
|
||||||
* @return Disposable that unregisters the `WebviewCustomEditorProvider`.
|
* @return Disposable that unregisters the provider.
|
||||||
*/
|
*/
|
||||||
export function registerWebviewCustomEditorProvider(
|
export function registerCustomEditorProvider(
|
||||||
viewType: string,
|
viewType: string,
|
||||||
provider: WebviewCustomEditorProvider,
|
provider: CustomEditorProvider | CustomTextEditorProvider,
|
||||||
webviewOptions?: WebviewPanelOptions,
|
webviewOptions?: WebviewPanelOptions,
|
||||||
): Disposable;
|
): Disposable;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new `WebviewEditorCustomDocument`.
|
|
||||||
*
|
|
||||||
* Note that this method only creates a custom document object. To have it be registered with VS Code, you
|
|
||||||
* must return the document from `WebviewCustomEditorProvider.provideWebviewCustomEditorDocument`.
|
|
||||||
*
|
|
||||||
* @param viewType Type of the webview editor provider. This should match the `viewType` from the
|
|
||||||
* `package.json` contributions.
|
|
||||||
* @param uri The document's resource.
|
|
||||||
* @param userData Custom data attached to the document.
|
|
||||||
* @param capabilities Controls the editing functionality of a webview editor. This allows the webview
|
|
||||||
* editor to hook into standard editor events such as `undo` or `save`.
|
|
||||||
*
|
|
||||||
* WebviewEditors that do not have `editingCapability` are considered to be readonly. Users can still interact
|
|
||||||
* with readonly editors, but these editors will not integrate with VS Code's standard editor functionality.
|
|
||||||
*/
|
|
||||||
export function createWebviewEditorCustomDocument<UserDataType>(
|
|
||||||
viewType: string,
|
|
||||||
uri: Uri,
|
|
||||||
userData: UserDataType,
|
|
||||||
capabilities: WebviewCustomEditorCapabilities
|
|
||||||
): WebviewEditorCustomDocument<UserDataType>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
@@ -1522,28 +1482,6 @@ declare module 'vscode' {
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
//#region Diagnostic links https://github.com/microsoft/vscode/issues/11847
|
|
||||||
|
|
||||||
export interface Diagnostic {
|
|
||||||
/**
|
|
||||||
* Will be merged into `Diagnostic#code`
|
|
||||||
*/
|
|
||||||
code2?: {
|
|
||||||
/**
|
|
||||||
* A code or identifier for this diagnostic.
|
|
||||||
* Should be used for later processing, e.g. when providing [code actions](#CodeActionContext).
|
|
||||||
*/
|
|
||||||
value: string | number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A target URI to open with more information about the diagnostic error.
|
|
||||||
*/
|
|
||||||
target: Uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//#endregion
|
|
||||||
|
|
||||||
//#region eamodio - timeline: https://github.com/microsoft/vscode/issues/84297
|
//#region eamodio - timeline: https://github.com/microsoft/vscode/issues/84297
|
||||||
|
|
||||||
export class TimelineItem {
|
export class TimelineItem {
|
||||||
|
|||||||
@@ -564,17 +564,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||||||
registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
|
registerWebviewPanelSerializer: (viewType: string, serializer: vscode.WebviewPanelSerializer) => {
|
||||||
return extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializer);
|
return extHostWebviews.registerWebviewPanelSerializer(extension, viewType, serializer);
|
||||||
},
|
},
|
||||||
registerWebviewTextEditorProvider: (viewType: string, provider: vscode.WebviewTextEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
registerCustomEditorProvider: (viewType: string, provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
||||||
checkProposedApiEnabled(extension);
|
checkProposedApiEnabled(extension);
|
||||||
return extHostWebviews.registerWebviewTextEditorProvider(extension, viewType, provider, options);
|
return extHostWebviews.registerCustomEditorProvider(extension, viewType, provider, options);
|
||||||
},
|
|
||||||
registerWebviewCustomEditorProvider: (viewType: string, provider: vscode.WebviewCustomEditorProvider, options?: vscode.WebviewPanelOptions) => {
|
|
||||||
checkProposedApiEnabled(extension);
|
|
||||||
return extHostWebviews.registerWebviewCustomEditorProvider(extension, viewType, provider, options);
|
|
||||||
},
|
|
||||||
createWebviewEditorCustomDocument: <UserDataType>(viewType: string, resource: vscode.Uri, userData: UserDataType, capabilities: vscode.WebviewCustomEditorCapabilities) => {
|
|
||||||
checkProposedApiEnabled(extension);
|
|
||||||
return extHostWebviews.createWebviewEditorCustomDocument<UserDataType>(viewType, resource, userData, capabilities);
|
|
||||||
},
|
},
|
||||||
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
registerDecorationProvider(provider: vscode.DecorationProvider) {
|
||||||
checkProposedApiEnabled(extension);
|
checkProposedApiEnabled(extension);
|
||||||
|
|||||||
@@ -127,13 +127,18 @@ export namespace DiagnosticTag {
|
|||||||
|
|
||||||
export namespace Diagnostic {
|
export namespace Diagnostic {
|
||||||
export function from(value: vscode.Diagnostic): IMarkerData {
|
export function from(value: vscode.Diagnostic): IMarkerData {
|
||||||
let code: string | { value: string; target: URI } | undefined = isString(value.code) || isNumber(value.code) ? String(value.code) : undefined;
|
let code: string | { value: string; target: URI } | undefined;
|
||||||
if (value.code2) {
|
|
||||||
|
if (value.code) {
|
||||||
|
if (isString(value.code) || isNumber(value.code)) {
|
||||||
|
code = String(value.code);
|
||||||
|
} else {
|
||||||
code = {
|
code = {
|
||||||
value: String(value.code2.value),
|
value: String(value.code.value),
|
||||||
target: value.code2.target
|
target: value.code.target,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...Range.from(value.range),
|
...Range.from(value.range),
|
||||||
|
|||||||
@@ -247,22 +247,30 @@ export class ExtHostWebviewEditor extends Disposable implements vscode.WebviewPa
|
|||||||
|
|
||||||
type EditType = unknown;
|
type EditType = unknown;
|
||||||
|
|
||||||
class WebviewEditorCustomDocument extends Disposable implements vscode.WebviewEditorCustomDocument {
|
class WebviewEditorCustomDocument extends Disposable implements vscode.CustomDocument {
|
||||||
private _currentEditIndex: number = -1;
|
private _currentEditIndex: number = -1;
|
||||||
private _savePoint: number = -1;
|
private _savePoint: number = -1;
|
||||||
private readonly _edits: Array<EditType> = [];
|
private readonly _edits: Array<EditType> = [];
|
||||||
|
|
||||||
|
public userData: unknown;
|
||||||
|
|
||||||
|
public _capabilities?: vscode.CustomEditorCapabilities = undefined;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _proxy: MainThreadWebviewsShape,
|
private readonly _proxy: MainThreadWebviewsShape,
|
||||||
public readonly viewType: string,
|
public readonly viewType: string,
|
||||||
public readonly uri: vscode.Uri,
|
public readonly uri: vscode.Uri,
|
||||||
public readonly userData: unknown,
|
|
||||||
public readonly _capabilities: vscode.WebviewCustomEditorCapabilities,
|
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// Hook up events
|
_setCapabilities(capabilities: vscode.CustomEditorCapabilities) {
|
||||||
_capabilities.editing?.onDidEdit(edit => {
|
if (this._capabilities) {
|
||||||
|
throw new Error('Capabilities already provided');
|
||||||
|
}
|
||||||
|
|
||||||
|
this._capabilities = capabilities;
|
||||||
|
capabilities.editing?.onDidEdit(edit => {
|
||||||
this.pushEdit(edit, this);
|
this.pushEdit(edit, this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -356,12 +364,12 @@ class WebviewEditorCustomDocument extends Disposable implements vscode.WebviewEd
|
|||||||
return this.getEditingCapability().saveAs(target);
|
return this.getEditingCapability().saveAs(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
backup(cancellation: CancellationToken): boolean | PromiseLike<boolean> {
|
backup(cancellation: CancellationToken) {
|
||||||
throw new Error('Method not implemented.');
|
return this.getEditingCapability().backup(cancellation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getEditingCapability(): vscode.WebviewCustomEditorEditingCapability {
|
private getEditingCapability(): vscode.CustomEditorEditingCapability {
|
||||||
if (!this._capabilities.editing) {
|
if (!this._capabilities?.editing) {
|
||||||
throw new Error('Document is not editable');
|
throw new Error('Document is not editable');
|
||||||
}
|
}
|
||||||
return this._capabilities.editing;
|
return this._capabilities.editing;
|
||||||
@@ -401,21 +409,21 @@ const enum WebviewEditorType {
|
|||||||
type ProviderEntry = {
|
type ProviderEntry = {
|
||||||
readonly extension: IExtensionDescription;
|
readonly extension: IExtensionDescription;
|
||||||
readonly type: WebviewEditorType.Text;
|
readonly type: WebviewEditorType.Text;
|
||||||
readonly provider: vscode.WebviewTextEditorProvider;
|
readonly provider: vscode.CustomTextEditorProvider;
|
||||||
} | {
|
} | {
|
||||||
readonly extension: IExtensionDescription;
|
readonly extension: IExtensionDescription;
|
||||||
readonly type: WebviewEditorType.Custom;
|
readonly type: WebviewEditorType.Custom;
|
||||||
readonly provider: vscode.WebviewCustomEditorProvider;
|
readonly provider: vscode.CustomEditorProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditorProviderStore {
|
class EditorProviderStore {
|
||||||
private readonly _providers = new Map<string, ProviderEntry>();
|
private readonly _providers = new Map<string, ProviderEntry>();
|
||||||
|
|
||||||
public addTextProvider(viewType: string, extension: IExtensionDescription, provider: vscode.WebviewTextEditorProvider): vscode.Disposable {
|
public addTextProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider): vscode.Disposable {
|
||||||
return this.add(WebviewEditorType.Text, viewType, extension, provider);
|
return this.add(WebviewEditorType.Text, viewType, extension, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addCustomProvider(viewType: string, extension: IExtensionDescription, provider: vscode.WebviewCustomEditorProvider): vscode.Disposable {
|
public addCustomProvider(viewType: string, extension: IExtensionDescription, provider: vscode.CustomEditorProvider): vscode.Disposable {
|
||||||
return this.add(WebviewEditorType.Custom, viewType, extension, provider);
|
return this.add(WebviewEditorType.Custom, viewType, extension, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +431,7 @@ class EditorProviderStore {
|
|||||||
return this._providers.get(viewType);
|
return this._providers.get(viewType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private add(type: WebviewEditorType, viewType: string, extension: IExtensionDescription, provider: vscode.WebviewTextEditorProvider | vscode.WebviewCustomEditorProvider): vscode.Disposable {
|
private add(type: WebviewEditorType, viewType: string, extension: IExtensionDescription, provider: vscode.CustomTextEditorProvider | vscode.CustomEditorProvider): vscode.Disposable {
|
||||||
if (this._providers.has(viewType)) {
|
if (this._providers.has(viewType)) {
|
||||||
throw new Error(`Provider for viewType:${viewType} already registered`);
|
throw new Error(`Provider for viewType:${viewType} already registered`);
|
||||||
}
|
}
|
||||||
@@ -501,43 +509,26 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerWebviewTextEditorProvider(
|
public registerCustomEditorProvider(
|
||||||
extension: IExtensionDescription,
|
extension: IExtensionDescription,
|
||||||
viewType: string,
|
viewType: string,
|
||||||
provider: vscode.WebviewTextEditorProvider,
|
provider: vscode.CustomEditorProvider | vscode.CustomTextEditorProvider,
|
||||||
options: vscode.WebviewPanelOptions | undefined = {}
|
options: vscode.WebviewPanelOptions | undefined = {}
|
||||||
): vscode.Disposable {
|
): vscode.Disposable {
|
||||||
const unregisterProvider = this._editorProviders.addTextProvider(viewType, extension, provider);
|
let disposable: vscode.Disposable;
|
||||||
|
if ('resolveCustomTextEditor' in provider) {
|
||||||
|
disposable = this._editorProviders.addTextProvider(viewType, extension, provider);
|
||||||
this._proxy.$registerTextEditorProvider(toExtensionData(extension), viewType, options);
|
this._proxy.$registerTextEditorProvider(toExtensionData(extension), viewType, options);
|
||||||
|
} else {
|
||||||
return new VSCodeDisposable(() => {
|
disposable = this._editorProviders.addCustomProvider(viewType, extension, provider);
|
||||||
unregisterProvider.dispose();
|
|
||||||
this._proxy.$unregisterEditorProvider(viewType);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public registerWebviewCustomEditorProvider(
|
|
||||||
extension: IExtensionDescription,
|
|
||||||
viewType: string,
|
|
||||||
provider: vscode.WebviewCustomEditorProvider,
|
|
||||||
options: vscode.WebviewPanelOptions | undefined = {},
|
|
||||||
): vscode.Disposable {
|
|
||||||
const unregisterProvider = this._editorProviders.addCustomProvider(viewType, extension, provider);
|
|
||||||
this._proxy.$registerCustomEditorProvider(toExtensionData(extension), viewType, options);
|
this._proxy.$registerCustomEditorProvider(toExtensionData(extension), viewType, options);
|
||||||
|
|
||||||
return new VSCodeDisposable(() => {
|
|
||||||
unregisterProvider.dispose();
|
|
||||||
this._proxy.$unregisterEditorProvider(viewType);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public createWebviewEditorCustomDocument<UserDataType>(
|
return VSCodeDisposable.from(
|
||||||
viewType: string,
|
disposable,
|
||||||
resource: vscode.Uri,
|
new VSCodeDisposable(() => {
|
||||||
userData: UserDataType,
|
this._proxy.$unregisterEditorProvider(viewType);
|
||||||
capabilities: vscode.WebviewCustomEditorCapabilities,
|
}));
|
||||||
): vscode.WebviewEditorCustomDocument<UserDataType> {
|
|
||||||
return Object.seal(new WebviewEditorCustomDocument(this._proxy, viewType, resource, userData, capabilities) as vscode.WebviewEditorCustomDocument<UserDataType>);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public $onMessage(
|
public $onMessage(
|
||||||
@@ -631,10 +622,12 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const revivedResource = URI.revive(resource);
|
const revivedResource = URI.revive(resource);
|
||||||
const document = await entry.provider.provideWebviewCustomEditorDocument(revivedResource) as WebviewEditorCustomDocument;
|
const document = Object.seal(new WebviewEditorCustomDocument(this._proxy, viewType, revivedResource));
|
||||||
|
const capabilities = await entry.provider.resolveCustomDocument(document);
|
||||||
|
document._setCapabilities(capabilities);
|
||||||
this._documents.add(document);
|
this._documents.add(document);
|
||||||
return {
|
return {
|
||||||
editable: !!document._capabilities.editing
|
editable: !!capabilities.editing
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,13 +670,13 @@ export class ExtHostWebviews implements ExtHostWebviewsShape {
|
|||||||
case WebviewEditorType.Custom:
|
case WebviewEditorType.Custom:
|
||||||
{
|
{
|
||||||
const document = this.getDocument(viewType, revivedResource);
|
const document = this.getDocument(viewType, revivedResource);
|
||||||
return entry.provider.resolveWebviewCustomEditor(document, revivedPanel);
|
return entry.provider.resolveCustomEditor(document, revivedPanel);
|
||||||
}
|
}
|
||||||
case WebviewEditorType.Text:
|
case WebviewEditorType.Text:
|
||||||
{
|
{
|
||||||
await this._extHostDocuments.ensureDocumentData(revivedResource);
|
await this._extHostDocuments.ensureDocumentData(revivedResource);
|
||||||
const document = this._extHostDocuments.getDocument(revivedResource);
|
const document = this._extHostDocuments.getDocument(revivedResource);
|
||||||
return entry.provider.resolveWebviewTextEditor(document, revivedPanel);
|
return entry.provider.resolveCustomTextEditor(document, revivedPanel);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ export class JSONValidationExtensionPoint {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
collector.error(nls.localize('invalid.url.fileschema', "'configuration.jsonValidation.url' is an invalid relative URL: {0}", e.message));
|
collector.error(nls.localize('invalid.url.fileschema', "'configuration.jsonValidation.url' is an invalid relative URL: {0}", e.message));
|
||||||
}
|
}
|
||||||
} else if (!strings.startsWith(uri, 'https:/') && strings.startsWith(uri, 'https:/')) {
|
} else if (!/^[^:/?#]+:\/\//.test(uri)) {
|
||||||
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must start with 'http:', 'https:' or './' to reference schemas located in the extension"));
|
collector.error(nls.localize('invalid.url.schema', "'configuration.jsonValidation.url' must be an absolute URL or start with './' to reference schemas located in the extension."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -642,14 +642,13 @@ export abstract class BaseCloseAllAction extends Action {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let saveOrRevert: boolean;
|
|
||||||
if (confirm === ConfirmResult.DONT_SAVE) {
|
if (confirm === ConfirmResult.DONT_SAVE) {
|
||||||
saveOrRevert = await this.editorService.revertAll({ soft: true, includeUntitled: true });
|
await this.editorService.revertAll({ soft: true, includeUntitled: true });
|
||||||
} else {
|
} else {
|
||||||
saveOrRevert = await this.editorService.saveAll({ reason: SaveReason.EXPLICIT, includeUntitled: true });
|
await this.editorService.saveAll({ reason: SaveReason.EXPLICIT, includeUntitled: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveOrRevert) {
|
if (!this.workingCopyService.hasDirty) {
|
||||||
return this.doCloseAll();
|
return this.doCloseAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/comm
|
|||||||
import { IEditorCommandsContext } from 'vs/workbench/common/editor';
|
import { IEditorCommandsContext } from 'vs/workbench/common/editor';
|
||||||
import { CustomEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput';
|
import { CustomEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput';
|
||||||
import { defaultEditorId } from 'vs/workbench/contrib/customEditor/browser/customEditors';
|
import { defaultEditorId } from 'vs/workbench/contrib/customEditor/browser/customEditors';
|
||||||
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_HAS_CUSTOM_EDITORS, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_CUSTOM_EDITORS, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||||
import type { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
import type { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||||
@@ -80,7 +80,7 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
|||||||
title: REOPEN_WITH_TITLE,
|
title: REOPEN_WITH_TITLE,
|
||||||
category: viewCategory,
|
category: viewCategory,
|
||||||
},
|
},
|
||||||
when: CONTEXT_HAS_CUSTOM_EDITORS,
|
when: CONTEXT_CUSTOM_EDITORS.notEqualsTo(''),
|
||||||
});
|
});
|
||||||
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
||||||
@@ -89,9 +89,9 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|||||||
title: REOPEN_WITH_TITLE,
|
title: REOPEN_WITH_TITLE,
|
||||||
category: viewCategory,
|
category: viewCategory,
|
||||||
},
|
},
|
||||||
group: '3_open',
|
group: '6_reopen',
|
||||||
order: 20,
|
order: 20,
|
||||||
when: CONTEXT_HAS_CUSTOM_EDITORS,
|
when: CONTEXT_CUSTOM_EDITORS.notEqualsTo(''),
|
||||||
});
|
});
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
@@ -155,7 +155,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
id: ToggleCustomEditorCommand.ID,
|
id: ToggleCustomEditorCommand.ID,
|
||||||
precondition: CONTEXT_HAS_CUSTOM_EDITORS,
|
precondition: CONTEXT_CUSTOM_EDITORS,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
|||||||
import { EditorInput, EditorOptions, IEditor, IEditorInput } from 'vs/workbench/common/editor';
|
import { EditorInput, EditorOptions, IEditor, IEditorInput } from 'vs/workbench/common/editor';
|
||||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||||
import { webviewEditorsExtensionPoint } from 'vs/workbench/contrib/customEditor/browser/extensionPoint';
|
import { webviewEditorsExtensionPoint } from 'vs/workbench/contrib/customEditor/browser/extensionPoint';
|
||||||
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_HAS_CUSTOM_EDITORS, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority, CustomEditorSelector, ICustomEditor, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
import { CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CONTEXT_CUSTOM_EDITORS, CustomEditorInfo, CustomEditorInfoCollection, CustomEditorPriority, CustomEditorSelector, ICustomEditor, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||||
import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager';
|
import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager';
|
||||||
import { IWebviewService, webviewHasOwnEditFunctionsContext } from 'vs/workbench/contrib/webview/browser/webview';
|
import { IWebviewService, webviewHasOwnEditFunctionsContext } from 'vs/workbench/contrib/webview/browser/webview';
|
||||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||||
@@ -98,7 +98,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
|||||||
|
|
||||||
private readonly _models: CustomEditorModelManager;
|
private readonly _models: CustomEditorModelManager;
|
||||||
|
|
||||||
private readonly _hasCustomEditor: IContextKey<boolean>;
|
private readonly _customEditorContextKey: IContextKey<string>;
|
||||||
private readonly _focusedCustomEditorIsEditable: IContextKey<boolean>;
|
private readonly _focusedCustomEditorIsEditable: IContextKey<boolean>;
|
||||||
private readonly _webviewHasOwnEditFunctions: IContextKey<boolean>;
|
private readonly _webviewHasOwnEditFunctions: IContextKey<boolean>;
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
|||||||
|
|
||||||
this._models = new CustomEditorModelManager(workingCopyService, labelService);
|
this._models = new CustomEditorModelManager(workingCopyService, labelService);
|
||||||
|
|
||||||
this._hasCustomEditor = CONTEXT_HAS_CUSTOM_EDITORS.bindTo(contextKeyService);
|
this._customEditorContextKey = CONTEXT_CUSTOM_EDITORS.bindTo(contextKeyService);
|
||||||
this._focusedCustomEditorIsEditable = CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE.bindTo(contextKeyService);
|
this._focusedCustomEditorIsEditable = CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE.bindTo(contextKeyService);
|
||||||
this._webviewHasOwnEditFunctions = webviewHasOwnEditFunctionsContext.bindTo(contextKeyService);
|
this._webviewHasOwnEditFunctions = webviewHasOwnEditFunctionsContext.bindTo(contextKeyService);
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
|||||||
const activeControl = this.editorService.activeControl;
|
const activeControl = this.editorService.activeControl;
|
||||||
const resource = activeControl?.input.resource;
|
const resource = activeControl?.input.resource;
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
this._hasCustomEditor.reset();
|
this._customEditorContextKey.reset();
|
||||||
this._focusedCustomEditorIsEditable.reset();
|
this._focusedCustomEditorIsEditable.reset();
|
||||||
this._webviewHasOwnEditFunctions.reset();
|
this._webviewHasOwnEditFunctions.reset();
|
||||||
return;
|
return;
|
||||||
@@ -320,7 +320,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
|||||||
...this.getContributedCustomEditors(resource).allEditors,
|
...this.getContributedCustomEditors(resource).allEditors,
|
||||||
...this.getUserConfiguredCustomEditors(resource).allEditors,
|
...this.getUserConfiguredCustomEditors(resource).allEditors,
|
||||||
];
|
];
|
||||||
this._hasCustomEditor.set(possibleEditors.length > 0);
|
this._customEditorContextKey.set(possibleEditors.map(x => x.id).join(','));
|
||||||
this._focusedCustomEditorIsEditable.set(activeControl?.input instanceof CustomEditorInput);
|
this._focusedCustomEditorIsEditable.set(activeControl?.input instanceof CustomEditorInput);
|
||||||
this._webviewHasOwnEditFunctions.set(possibleEditors.length > 0);
|
this._webviewHasOwnEditFunctions.set(possibleEditors.length > 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ interface IWebviewEditorsExtensionPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const webviewEditorsContribution: IJSONSchema = {
|
const webviewEditorsContribution: IJSONSchema = {
|
||||||
description: nls.localize('contributes.webviewEditors', 'Contributes webview editors.'),
|
description: nls.localize('contributes.customEditors', 'Contributed custom editors.'),
|
||||||
type: 'array',
|
type: 'array',
|
||||||
defaultSnippets: [{ body: [{ viewType: '', displayName: '' }] }],
|
defaultSnippets: [{ body: [{ viewType: '', displayName: '' }] }],
|
||||||
items: {
|
items: {
|
||||||
@@ -76,7 +76,7 @@ const webviewEditorsContribution: IJSONSchema = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const webviewEditorsExtensionPoint = ExtensionsRegistry.registerExtensionPoint<IWebviewEditorsExtensionPoint[]>({
|
export const webviewEditorsExtensionPoint = ExtensionsRegistry.registerExtensionPoint<IWebviewEditorsExtensionPoint[]>({
|
||||||
extensionPoint: 'webviewEditors',
|
extensionPoint: 'customEditors',
|
||||||
deps: [languagesExtPoint],
|
deps: [languagesExtPoint],
|
||||||
jsonSchema: webviewEditorsContribution
|
jsonSchema: webviewEditorsContribution
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { IWorkingCopy } from 'vs/workbench/services/workingCopy/common/workingCo
|
|||||||
|
|
||||||
export const ICustomEditorService = createDecorator<ICustomEditorService>('customEditorService');
|
export const ICustomEditorService = createDecorator<ICustomEditorService>('customEditorService');
|
||||||
|
|
||||||
export const CONTEXT_HAS_CUSTOM_EDITORS = new RawContextKey<boolean>('hasCustomEditors', false);
|
export const CONTEXT_CUSTOM_EDITORS = new RawContextKey<string>('customEditors', '');
|
||||||
export const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE = new RawContextKey<boolean>('focusedCustomEditorIsEditable', false);
|
export const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE = new RawContextKey<boolean>('focusedCustomEditorIsEditable', false);
|
||||||
|
|
||||||
export interface ICustomEditor {
|
export interface ICustomEditor {
|
||||||
|
|||||||
@@ -1082,7 +1082,7 @@ export class ExtensionEditor extends BaseEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private renderCustomEditors(container: HTMLElement, manifest: IExtensionManifest, onDetailsToggle: Function): boolean {
|
private renderCustomEditors(container: HTMLElement, manifest: IExtensionManifest, onDetailsToggle: Function): boolean {
|
||||||
const webviewEditors = manifest.contributes?.webviewEditors || [];
|
const webviewEditors = manifest.contributes?.customEditors || [];
|
||||||
if (!webviewEditors.length) {
|
if (!webviewEditors.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -621,8 +621,6 @@ export class RepositoryPane extends ViewPane {
|
|||||||
protected contextKeyService: IContextKeyService;
|
protected contextKeyService: IContextKeyService;
|
||||||
private commitTemplate = '';
|
private commitTemplate = '';
|
||||||
|
|
||||||
shouldShowWelcome() { return true; }
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly repository: ISCMRepository,
|
readonly repository: ISCMRepository,
|
||||||
options: IViewPaneOptions,
|
options: IViewPaneOptions,
|
||||||
|
|||||||
@@ -141,6 +141,15 @@ export class Match {
|
|||||||
return thisMatchPreviewLines.join('\n');
|
return thisMatchPreviewLines.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rangeInPreview() {
|
||||||
|
// convert to editor's base 1 positions.
|
||||||
|
return {
|
||||||
|
...this._fullPreviewRange,
|
||||||
|
startColumn: this._fullPreviewRange.startColumn + 1,
|
||||||
|
endColumn: this._fullPreviewRange.endColumn + 1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fullPreviewLines(): string[] {
|
fullPreviewLines(): string[] {
|
||||||
return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber, this._fullPreviewRange.endLineNumber + 1);
|
return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber, this._fullPreviewRange.endLineNumber + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export const ToggleSearchEditorWholeWordCommandId = 'toggleSearchEditorWholeWord
|
|||||||
export const ToggleSearchEditorRegexCommandId = 'toggleSearchEditorRegex';
|
export const ToggleSearchEditorRegexCommandId = 'toggleSearchEditorRegex';
|
||||||
export const ToggleSearchEditorContextLinesCommandId = 'toggleSearchEditorContextLines';
|
export const ToggleSearchEditorContextLinesCommandId = 'toggleSearchEditorContextLines';
|
||||||
export const RerunSearchEditorSearchCommandId = 'rerunSearchEditorSearch';
|
export const RerunSearchEditorSearchCommandId = 'rerunSearchEditorSearch';
|
||||||
|
export const CleanSearchEditorStateCommandId = 'cleanSearchEditorState';
|
||||||
export const SelectAllSearchEditorMatchesCommandId = 'selectAllSearchEditorMatches';
|
export const SelectAllSearchEditorMatchesCommandId = 'selectAllSearchEditorMatches';
|
||||||
|
|
||||||
export const InSearchEditor = new RawContextKey<boolean>('inSearchEditor', false);
|
export const InSearchEditor = new RawContextKey<boolean>('inSearchEditor', false);
|
||||||
|
|||||||
@@ -162,6 +162,15 @@ CommandsRegistry.registerCommand(
|
|||||||
activeControl.triggerSearch({ resetCursor: false });
|
activeControl.triggerSearch({ resetCursor: false });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CommandsRegistry.registerCommand(
|
||||||
|
SearchEditorConstants.CleanSearchEditorStateCommandId,
|
||||||
|
(accessor: ServicesAccessor) => {
|
||||||
|
const activeControl = accessor.get(IEditorService).activeControl;
|
||||||
|
if (activeControl instanceof SearchEditor) {
|
||||||
|
activeControl.cleanState();
|
||||||
|
}
|
||||||
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Actions
|
//#region Actions
|
||||||
|
|||||||
@@ -297,6 +297,10 @@ export class SearchEditor extends BaseTextEditor {
|
|||||||
this.toggleIncludesExcludes();
|
this.toggleIncludesExcludes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanState() {
|
||||||
|
this.getInput()?.setDirty(false);
|
||||||
|
}
|
||||||
|
|
||||||
private get searchConfig(): ISearchConfigurationProperties {
|
private get searchConfig(): ISearchConfigurationProperties {
|
||||||
return this.configurationService.getValue<ISearchConfigurationProperties>('search');
|
return this.configurationService.getValue<ISearchConfigurationProperties>('search');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const matchToSearchResultFormat = (match: Match): { line: string, ranges: Range[
|
|||||||
|
|
||||||
const rangeOnThisLine = ({ start, end }: { start?: number; end?: number; }) => new Range(1, (start ?? 1) + prefixOffset, 1, (end ?? sourceLine.length + 1) + prefixOffset);
|
const rangeOnThisLine = ({ start, end }: { start?: number; end?: number; }) => new Range(1, (start ?? 1) + prefixOffset, 1, (end ?? sourceLine.length + 1) + prefixOffset);
|
||||||
|
|
||||||
const matchRange = match.range();
|
const matchRange = match.rangeInPreview();
|
||||||
const matchIsSingleLine = matchRange.startLineNumber === matchRange.endLineNumber;
|
const matchIsSingleLine = matchRange.startLineNumber === matchRange.endLineNumber;
|
||||||
|
|
||||||
let lineRange;
|
let lineRange;
|
||||||
@@ -211,9 +211,12 @@ export const serializeSearchResultForEditor =
|
|||||||
? contentPatternToSearchResultHeader(searchResult.query, rawIncludePattern, rawExcludePattern, contextLines)
|
? contentPatternToSearchResultHeader(searchResult.query, rawIncludePattern, rawExcludePattern, contextLines)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
const filecount = searchResult.fileCount() > 1 ? localize('numFiles', "{0} files", searchResult.fileCount()) : localize('oneFile', "1 file");
|
||||||
|
const resultcount = searchResult.count() > 1 ? localize('numResults', "{0} results", searchResult.count()) : localize('oneResult', "1 result");
|
||||||
|
|
||||||
const info = [
|
const info = [
|
||||||
searchResult.count()
|
searchResult.count()
|
||||||
? localize('resultCount', "{0} results in {1} files", searchResult.count(), searchResult.fileCount())
|
? `${filecount} - ${resultcount}`
|
||||||
: localize('noResults', "No Results"),
|
: localize('noResults', "No Results"),
|
||||||
''];
|
''];
|
||||||
|
|
||||||
|
|||||||
@@ -602,8 +602,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
|||||||
// Respect chords if the allowChords setting is set and it's not Escape. Escape is
|
// Respect chords if the allowChords setting is set and it's not Escape. Escape is
|
||||||
// handled specially for Zen Mode's Escape, Escape chord, plus it's important in
|
// handled specially for Zen Mode's Escape, Escape chord, plus it's important in
|
||||||
// terminals generally
|
// terminals generally
|
||||||
const allowChords = resolveResult && resolveResult.enterChord && this._configHelper.config.allowChords && event.key !== 'Escape';
|
const allowChords = resolveResult?.enterChord && this._configHelper.config.allowChords && event.key !== 'Escape';
|
||||||
if (allowChords || resolveResult && this._skipTerminalCommands.some(k => k === resolveResult.commandId)) {
|
if (this._keybindingService.inChordMode || allowChords || resolveResult && this._skipTerminalCommands.some(k => k === resolveResult.commandId)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ import { MenuItemAction, IMenuService, MenuId } from 'vs/platform/actions/common
|
|||||||
import { fromNow } from 'vs/base/common/date';
|
import { fromNow } from 'vs/base/common/date';
|
||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
|
|
||||||
// TODO[ECA]: Localize all the strings
|
|
||||||
|
|
||||||
const InitialPageSize = 20;
|
const InitialPageSize = 20;
|
||||||
const SubsequentPageSize = 40;
|
const SubsequentPageSize = 40;
|
||||||
|
|
||||||
@@ -240,7 +238,7 @@ export class TimelinePane extends ViewPane {
|
|||||||
|
|
||||||
// TODO[ECA]: Are these the right the list of schemes to exclude? Is there a better way?
|
// TODO[ECA]: Are these the right the list of schemes to exclude? Is there a better way?
|
||||||
if (this._uri && (this._uri.scheme === 'vscode-settings' || this._uri.scheme === 'webview-panel' || this._uri.scheme === 'walkThrough')) {
|
if (this._uri && (this._uri.scheme === 'vscode-settings' || this._uri.scheme === 'webview-panel' || this._uri.scheme === 'walkThrough')) {
|
||||||
this.message = 'The active editor cannot provide timeline information.';
|
this.message = localize('timeline.editorCannotProvideTimeline', 'The active editor cannot provide timeline information.');
|
||||||
this._tree.setChildren(null, undefined);
|
this._tree.setChildren(null, undefined);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -253,7 +251,7 @@ export class TimelinePane extends ViewPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._tree.setChildren(null, undefined);
|
this._tree.setChildren(null, undefined);
|
||||||
this.message = `Loading timeline for ${basename(uri.fsPath)}...`;
|
this.message = localize('timeline.loading', 'Loading timeline for ${0}...', basename(uri.fsPath));
|
||||||
}, 500, this._uri);
|
}, 500, this._uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,7 +408,7 @@ export class TimelinePane extends ViewPane {
|
|||||||
this._items.push({
|
this._items.push({
|
||||||
element: {
|
element: {
|
||||||
handle: 'vscode-command:loadMore',
|
handle: 'vscode-command:loadMore',
|
||||||
label: 'Load more',
|
label: localize('timeline.loadMore', 'Load more'),
|
||||||
timestamp: 0
|
timestamp: 0
|
||||||
} as CommandItem
|
} as CommandItem
|
||||||
});
|
});
|
||||||
@@ -512,7 +510,7 @@ export class TimelinePane extends ViewPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this._items.length === 0) {
|
if (this._items.length === 0) {
|
||||||
this.message = 'No timeline information was provided.';
|
this.message = localize('timeline.noTimelineInfo', 'No timeline information was provided.');
|
||||||
} else {
|
} else {
|
||||||
this.message = undefined;
|
this.message = undefined;
|
||||||
}
|
}
|
||||||
@@ -556,7 +554,7 @@ export class TimelinePane extends ViewPane {
|
|||||||
this._messageElement = DOM.append(this._container, DOM.$('.message'));
|
this._messageElement = DOM.append(this._container, DOM.$('.message'));
|
||||||
DOM.addClass(this._messageElement, 'timeline-subtle');
|
DOM.addClass(this._messageElement, 'timeline-subtle');
|
||||||
|
|
||||||
this.message = 'The active editor cannot provide timeline information.';
|
this.message = localize('timeline.editorCannotProvideTimeline', 'The active editor cannot provide timeline information.');
|
||||||
|
|
||||||
this._treeElement = document.createElement('div');
|
this._treeElement = document.createElement('div');
|
||||||
DOM.addClasses(this._treeElement, 'customview-tree', 'file-icon-themable-tree', 'hide-arrows');
|
DOM.addClasses(this._treeElement, 'customview-tree', 'file-icon-themable-tree', 'hide-arrows');
|
||||||
|
|||||||
@@ -3,50 +3,10 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||||
import { Registry } from 'vs/platform/registry/common/platform';
|
import { Registry } from 'vs/platform/registry/common/platform';
|
||||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||||
import { UserDataSyncWorkbenchContribution } from 'vs/workbench/contrib/userDataSync/browser/userDataSync';
|
import { UserDataSyncWorkbenchContribution } from 'vs/workbench/contrib/userDataSync/browser/userDataSync';
|
||||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
|
||||||
import { IUserDataSyncEnablementService, getUserDataSyncStore } from 'vs/platform/userDataSync/common/userDataSync';
|
|
||||||
import { IProductService } from 'vs/platform/product/common/productService';
|
|
||||||
|
|
||||||
class UserDataSyncSettingsMigrationContribution implements IWorkbenchContribution {
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
@IProductService productService: IProductService,
|
|
||||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
|
||||||
@IUserDataSyncEnablementService userDataSyncEnablementService: IUserDataSyncEnablementService,
|
|
||||||
) {
|
|
||||||
if (getUserDataSyncStore(productService, configurationService)) {
|
|
||||||
if (!configurationService.getValue('sync.enableSettings')) {
|
|
||||||
userDataSyncEnablementService.setResourceEnablement('settings', false);
|
|
||||||
}
|
|
||||||
if (!configurationService.getValue('sync.enableKeybindings')) {
|
|
||||||
userDataSyncEnablementService.setResourceEnablement('keybindings', false);
|
|
||||||
}
|
|
||||||
if (!configurationService.getValue('sync.enableUIState')) {
|
|
||||||
userDataSyncEnablementService.setResourceEnablement('globalState', false);
|
|
||||||
}
|
|
||||||
if (!configurationService.getValue('sync.enableExtensions')) {
|
|
||||||
userDataSyncEnablementService.setResourceEnablement('extensions', false);
|
|
||||||
}
|
|
||||||
if (configurationService.getValue('sync.enable')) {
|
|
||||||
userDataSyncEnablementService.setEnablement(true);
|
|
||||||
}
|
|
||||||
this.removeFromConfiguration();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async removeFromConfiguration(): Promise<void> {
|
|
||||||
await this.configurationService.updateValue('sync.enable', undefined, {}, ConfigurationTarget.USER, true);
|
|
||||||
await this.configurationService.updateValue('sync.enableSettings', undefined, {}, ConfigurationTarget.USER, true);
|
|
||||||
await this.configurationService.updateValue('sync.enableKeybindings', undefined, {}, ConfigurationTarget.USER, true);
|
|
||||||
await this.configurationService.updateValue('sync.enableUIState', undefined, {}, ConfigurationTarget.USER, true);
|
|
||||||
await this.configurationService.updateValue('sync.enableExtensions', undefined, {}, ConfigurationTarget.USER, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||||
workbenchRegistry.registerWorkbenchContribution(UserDataSyncWorkbenchContribution, LifecyclePhase.Ready);
|
workbenchRegistry.registerWorkbenchContribution(UserDataSyncWorkbenchContribution, LifecyclePhase.Ready);
|
||||||
workbenchRegistry.registerWorkbenchContribution(UserDataSyncSettingsMigrationContribution, LifecyclePhase.Ready);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user