Merge remote-tracking branch 'origin/main' into notebook/dev
This commit is contained in:
commit
75484f617b
49 changed files with 458 additions and 239 deletions
|
@ -185,12 +185,6 @@ steps:
|
|||
timeoutInMinutes: 7
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/integration/browser compile
|
||||
displayName: Compile integration tests
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
|
@ -224,12 +218,6 @@ steps:
|
|||
timeoutInMinutes: 7
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
displayName: Compile smoke tests
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
APP_ROOT=$(agent.builddirectory)/VSCode-darwin-$(VSCODE_ARCH)
|
||||
|
|
|
@ -143,12 +143,6 @@ steps:
|
|||
timeoutInMinutes: 7
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/integration/browser compile
|
||||
displayName: Compile integration tests
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
|
@ -184,12 +178,6 @@ steps:
|
|||
timeoutInMinutes: 7
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
displayName: Compile smoke tests
|
||||
condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
APP_PATH=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
|
||||
|
|
|
@ -38,7 +38,7 @@ steps:
|
|||
# using `genericNodeModules` instead of `nodeModules` here to avoid sharing the cache with builds running inside containers
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: 'genericNodeModules | $(Agent.OS) | .build/yarnlockhash'
|
||||
key: "genericNodeModules | $(Agent.OS) | .build/yarnlockhash"
|
||||
path: .build/node_modules_cache
|
||||
cacheHitVar: NODE_MODULES_RESTORED
|
||||
displayName: Restore node_modules cache
|
||||
|
@ -98,6 +98,13 @@ steps:
|
|||
yarn npm-run-all -lp core-ci extensions-ci hygiene eslint valid-layers-check
|
||||
displayName: Compile & Hygiene
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
yarn --cwd test/smoke compile
|
||||
yarn --cwd test/integration/browser compile
|
||||
displayName: Compile test suites
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
AZURE_STORAGE_ACCESS_KEY="$(ticino-storage-key)" \
|
||||
|
@ -121,7 +128,7 @@ steps:
|
|||
# we gotta tarball everything in order to preserve file permissions
|
||||
- script: |
|
||||
set -e
|
||||
tar -czf $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-*
|
||||
tar -czf $(Build.ArtifactStagingDirectory)/compilation.tar.gz .build out-* test/integration/browser/out test/smoke/out test/automation/out
|
||||
displayName: Compress compilation artifact
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
|
|
|
@ -154,13 +154,6 @@ steps:
|
|||
timeoutInMinutes: 7
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- powershell: |
|
||||
. build/azure-pipelines/win32/exec.ps1
|
||||
$ErrorActionPreference = "Stop"
|
||||
exec { yarn --cwd test/integration/browser compile }
|
||||
displayName: Compile integration tests
|
||||
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'), ne(variables['VSCODE_ARCH'], 'arm64'))
|
||||
|
||||
- powershell: |
|
||||
# Figure out the full absolute path of the product we just built
|
||||
# including the remote server and configure the integration tests
|
||||
|
|
|
@ -23,9 +23,14 @@ export enum ExecutionTarget {
|
|||
Syntax
|
||||
}
|
||||
|
||||
export interface TypeScriptServerExitEvent {
|
||||
readonly code: number | null;
|
||||
readonly signal: string | null;
|
||||
}
|
||||
|
||||
export interface ITypeScriptServer {
|
||||
readonly onEvent: vscode.Event<Proto.Event>;
|
||||
readonly onExit: vscode.Event<any>;
|
||||
readonly onExit: vscode.Event<TypeScriptServerExitEvent>;
|
||||
readonly onError: vscode.Event<any>;
|
||||
|
||||
readonly tsServerLogFile: string | undefined;
|
||||
|
@ -66,7 +71,7 @@ export interface TsServerProcess {
|
|||
write(serverRequest: Proto.Request): void;
|
||||
|
||||
onData(handler: (data: Proto.Response) => void): void;
|
||||
onExit(handler: (code: number | null) => void): void;
|
||||
onExit(handler: (code: number | null, signal: string | null) => void): void;
|
||||
onError(handler: (error: Error) => void): void;
|
||||
|
||||
kill(): void;
|
||||
|
@ -93,8 +98,8 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe
|
|||
this.dispatchMessage(msg);
|
||||
});
|
||||
|
||||
this._process.onExit(code => {
|
||||
this._onExit.fire(code);
|
||||
this._process.onExit((code, signal) => {
|
||||
this._onExit.fire({ code, signal });
|
||||
this._callbacks.destroy('server exited');
|
||||
});
|
||||
|
||||
|
@ -107,7 +112,7 @@ export class ProcessBasedTsServer extends Disposable implements ITypeScriptServe
|
|||
private readonly _onEvent = this._register(new vscode.EventEmitter<Proto.Event>());
|
||||
public readonly onEvent = this._onEvent.event;
|
||||
|
||||
private readonly _onExit = this._register(new vscode.EventEmitter<any>());
|
||||
private readonly _onExit = this._register(new vscode.EventEmitter<TypeScriptServerExitEvent>());
|
||||
public readonly onExit = this._onExit.event;
|
||||
|
||||
private readonly _onError = this._register(new vscode.EventEmitter<any>());
|
||||
|
@ -449,7 +454,7 @@ export class GetErrRoutingTsServer extends Disposable implements ITypeScriptServ
|
|||
private readonly _onEvent = this._register(new vscode.EventEmitter<Proto.Event>());
|
||||
public readonly onEvent = this._onEvent.event;
|
||||
|
||||
private readonly _onExit = this._register(new vscode.EventEmitter<any>());
|
||||
private readonly _onExit = this._register(new vscode.EventEmitter<TypeScriptServerExitEvent>());
|
||||
public readonly onExit = this._onExit.event;
|
||||
|
||||
private readonly _onError = this._register(new vscode.EventEmitter<any>());
|
||||
|
|
|
@ -36,7 +36,7 @@ export class WorkerServerProcess implements TsServerProcess {
|
|||
|
||||
private _onDataHandlers = new Set<(data: Proto.Response) => void>();
|
||||
private _onErrorHandlers = new Set<(err: Error) => void>();
|
||||
private _onExitHandlers = new Set<(code: number | null) => void>();
|
||||
private _onExitHandlers = new Set<(code: number | null, signal: string | null) => void>();
|
||||
|
||||
public constructor(
|
||||
private readonly worker: Worker,
|
||||
|
@ -73,7 +73,7 @@ export class WorkerServerProcess implements TsServerProcess {
|
|||
// Todo: not implemented
|
||||
}
|
||||
|
||||
onExit(handler: (code: number | null) => void): void {
|
||||
onExit(handler: (code: number | null, signal: string | null) => void): void {
|
||||
this._onExitHandlers.add(handler);
|
||||
// Todo: not implemented
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ export class ChildServerProcess extends Disposable implements TsServerProcess {
|
|||
this._reader.onData(handler);
|
||||
}
|
||||
|
||||
onExit(handler: (code: number | null) => void): void {
|
||||
onExit(handler: (code: number | null, signal: string | null) => void): void {
|
||||
this._process.on('exit', handler);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { EventName } from './protocol.const';
|
|||
import BufferSyncSupport from './tsServer/bufferSyncSupport';
|
||||
import { OngoingRequestCancellerFactory } from './tsServer/cancellation';
|
||||
import { ILogDirectoryProvider } from './tsServer/logDirectoryProvider';
|
||||
import { ITypeScriptServer, TsServerProcessFactory } from './tsServer/server';
|
||||
import { ITypeScriptServer, TsServerProcessFactory, TypeScriptServerExitEvent } from './tsServer/server';
|
||||
import { TypeScriptServerError } from './tsServer/serverError';
|
||||
import { TypeScriptServerSpawner } from './tsServer/spawner';
|
||||
import { TypeScriptVersionManager } from './tsServer/versionManager';
|
||||
|
@ -432,27 +432,30 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
|||
this.serviceExited(false);
|
||||
});
|
||||
|
||||
handle.onExit((code: any) => {
|
||||
handle.onExit((data: TypeScriptServerExitEvent) => {
|
||||
if (this.token !== mytoken) {
|
||||
// this is coming from an old process
|
||||
return;
|
||||
}
|
||||
|
||||
const { code, signal } = data;
|
||||
|
||||
if (code === null || typeof code === 'undefined') {
|
||||
this.info('TSServer exited');
|
||||
this.info(`TSServer exited. Signal: ${signal}`);
|
||||
} else {
|
||||
// In practice, the exit code is an integer with no ties to any identity,
|
||||
// so it can be classified as SystemMetaData, rather than CallstackOrException.
|
||||
this.error(`TSServer exited with code: ${code}`);
|
||||
this.error(`TSServer exited with code: ${code}. Signal: ${signal}`);
|
||||
/* __GDPR__
|
||||
"tsserver.exitWithCode" : {
|
||||
"code" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||
"signal" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
|
||||
"${include}": [
|
||||
"${TypeScriptCommonProperties}"
|
||||
]
|
||||
}
|
||||
*/
|
||||
this.logTelemetry('tsserver.exitWithCode', { code: code });
|
||||
this.logTelemetry('tsserver.exitWithCode', { code, signal: signal ?? undefined });
|
||||
}
|
||||
|
||||
if (handle.tsServerLogFile) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "code-oss-dev",
|
||||
"version": "1.58.0",
|
||||
"distro": "68c5c22efa9f79309df7a4e7c94b480124a43384",
|
||||
"distro": "eab7dce58d728b96fec604bb89d25e90c0124e01",
|
||||
"author": {
|
||||
"name": "Microsoft Corporation"
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@ import { ICommandDelegate } from 'vs/editor/browser/view/viewController';
|
|||
import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl';
|
||||
import { ViewUserInputEvents } from 'vs/editor/browser/view/viewUserInputEvents';
|
||||
import { ConfigurationChangedEvent, EditorLayoutInfo, IEditorOptions, EditorOption, IComputedEditorOptions, FindComputedEditorOptionValueById, filterValidationDecorations } from 'vs/editor/common/config/editorOptions';
|
||||
import { Cursor } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorsController } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorColumns } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { CursorChangeReason, ICursorPositionChangedEvent, ICursorSelectionChangedEvent } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { IPosition, Position } from 'vs/editor/common/core/position';
|
||||
|
@ -1540,7 +1540,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||
break;
|
||||
case OutgoingViewModelEventKind.CursorStateChanged: {
|
||||
if (e.reachedMaxCursorCount) {
|
||||
this._notificationService.warn(nls.localize('cursors.maximum', "The number of cursors has been limited to {0}.", Cursor.MAX_CURSOR_COUNT));
|
||||
this._notificationService.warn(nls.localize('cursors.maximum', "The number of cursors has been limited to {0}.", CursorsController.MAX_CURSOR_COUNT));
|
||||
}
|
||||
|
||||
const positions: Position[] = [];
|
||||
|
|
|
@ -29,7 +29,7 @@ export class CursorModelState {
|
|||
public readonly modelVersionId: number;
|
||||
public readonly cursorState: CursorState[];
|
||||
|
||||
constructor(model: ITextModel, cursor: Cursor) {
|
||||
constructor(model: ITextModel, cursor: CursorsController) {
|
||||
this.modelVersionId = model.getVersionId();
|
||||
this.cursorState = cursor.getCursorStates();
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class AutoClosedAction {
|
|||
}
|
||||
}
|
||||
|
||||
export class Cursor extends Disposable {
|
||||
export class CursorsController extends Disposable {
|
||||
|
||||
public static readonly MAX_CURSOR_COUNT = 10000;
|
||||
|
||||
|
@ -216,8 +216,8 @@ export class Cursor extends Disposable {
|
|||
|
||||
public setStates(eventsCollector: ViewModelEventsCollector, source: string | null | undefined, reason: CursorChangeReason, states: PartialCursorState[] | null): boolean {
|
||||
let reachedMaxCursorCount = false;
|
||||
if (states !== null && states.length > Cursor.MAX_CURSOR_COUNT) {
|
||||
states = states.slice(0, Cursor.MAX_CURSOR_COUNT);
|
||||
if (states !== null && states.length > CursorsController.MAX_CURSOR_COUNT) {
|
||||
states = states.slice(0, CursorsController.MAX_CURSOR_COUNT);
|
||||
reachedMaxCursorCount = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CursorContext, CursorState, PartialCursorState } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { OneCursor } from 'vs/editor/common/controller/oneCursor';
|
||||
import { Cursor } from 'vs/editor/common/controller/oneCursor';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { ISelection, Selection } from 'vs/editor/common/core/selection';
|
||||
|
||||
|
@ -12,15 +12,15 @@ export class CursorCollection {
|
|||
|
||||
private context: CursorContext;
|
||||
|
||||
private primaryCursor: OneCursor;
|
||||
private secondaryCursors: OneCursor[];
|
||||
private primaryCursor: Cursor;
|
||||
private secondaryCursors: Cursor[];
|
||||
|
||||
// An index which identifies the last cursor that was added / moved (think Ctrl+drag)
|
||||
private lastAddedCursorIndex: number;
|
||||
|
||||
constructor(context: CursorContext) {
|
||||
this.context = context;
|
||||
this.primaryCursor = new OneCursor(context);
|
||||
this.primaryCursor = new Cursor(context);
|
||||
this.secondaryCursors = [];
|
||||
this.lastAddedCursorIndex = 0;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ export class CursorCollection {
|
|||
}
|
||||
|
||||
private _addSecondaryCursor(): void {
|
||||
this.secondaryCursors.push(new OneCursor(this.context));
|
||||
this.secondaryCursors.push(new Cursor(this.context));
|
||||
this.lastAddedCursorIndex = this.secondaryCursors.length;
|
||||
}
|
||||
|
||||
|
@ -186,8 +186,8 @@ export class CursorCollection {
|
|||
this.secondaryCursors.splice(removeIndex, 1);
|
||||
}
|
||||
|
||||
private _getAll(): OneCursor[] {
|
||||
let result: OneCursor[] = [];
|
||||
private _getAll(): Cursor[] {
|
||||
let result: Cursor[] = [];
|
||||
result[0] = this.primaryCursor;
|
||||
for (let i = 0, len = this.secondaryCursors.length; i < len; i++) {
|
||||
result[i + 1] = this.secondaryCursors[i];
|
||||
|
|
|
@ -9,7 +9,10 @@ import { Range } from 'vs/editor/common/core/range';
|
|||
import { Selection, SelectionDirection } from 'vs/editor/common/core/selection';
|
||||
import { TrackedRangeStickiness } from 'vs/editor/common/model';
|
||||
|
||||
export class OneCursor {
|
||||
/**
|
||||
* Represents a single cursor.
|
||||
*/
|
||||
export class Cursor {
|
||||
|
||||
public modelState!: SingleCursorState;
|
||||
public viewState!: SingleCursorState;
|
||||
|
|
|
@ -235,7 +235,7 @@ class MirrorModel extends BaseMirrorModel implements ICommonModel {
|
|||
public offsetAt(position: IPosition): number {
|
||||
position = this._validatePosition(position);
|
||||
this._ensureLineStarts();
|
||||
return this._lineStarts!.getAccumulatedValue(position.lineNumber - 2) + (position.column - 1);
|
||||
return this._lineStarts!.getPrefixSum(position.lineNumber - 2) + (position.column - 1);
|
||||
}
|
||||
|
||||
public positionAt(offset: number): IPosition {
|
||||
|
|
|
@ -85,9 +85,9 @@ export class PrefixSumComputer {
|
|||
return true;
|
||||
}
|
||||
|
||||
public removeValues(startIndex: number, cnt: number): boolean {
|
||||
public removeValues(startIndex: number, count: number): boolean {
|
||||
startIndex = toUint32(startIndex);
|
||||
cnt = toUint32(cnt);
|
||||
count = toUint32(count);
|
||||
|
||||
const oldValues = this.values;
|
||||
const oldPrefixSum = this.prefixSum;
|
||||
|
@ -96,18 +96,18 @@ export class PrefixSumComputer {
|
|||
return false;
|
||||
}
|
||||
|
||||
let maxCnt = oldValues.length - startIndex;
|
||||
if (cnt >= maxCnt) {
|
||||
cnt = maxCnt;
|
||||
let maxCount = oldValues.length - startIndex;
|
||||
if (count >= maxCount) {
|
||||
count = maxCount;
|
||||
}
|
||||
|
||||
if (cnt === 0) {
|
||||
if (count === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.values = new Uint32Array(oldValues.length - cnt);
|
||||
this.values = new Uint32Array(oldValues.length - count);
|
||||
this.values.set(oldValues.subarray(0, startIndex), 0);
|
||||
this.values.set(oldValues.subarray(startIndex + cnt), startIndex);
|
||||
this.values.set(oldValues.subarray(startIndex + count), startIndex);
|
||||
|
||||
this.prefixSum = new Uint32Array(this.values.length);
|
||||
if (startIndex - 1 < this.prefixSumValidIndex[0]) {
|
||||
|
@ -119,23 +119,23 @@ export class PrefixSumComputer {
|
|||
return true;
|
||||
}
|
||||
|
||||
public getTotalValue(): number {
|
||||
public getTotalSum(): number {
|
||||
if (this.values.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
return this._getAccumulatedValue(this.values.length - 1);
|
||||
return this._getPrefixSum(this.values.length - 1);
|
||||
}
|
||||
|
||||
public getAccumulatedValue(index: number): number {
|
||||
public getPrefixSum(index: number): number {
|
||||
if (index < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
index = toUint32(index);
|
||||
return this._getAccumulatedValue(index);
|
||||
return this._getPrefixSum(index);
|
||||
}
|
||||
|
||||
private _getAccumulatedValue(index: number): number {
|
||||
private _getPrefixSum(index: number): number {
|
||||
if (index <= this.prefixSumValidIndex[0]) {
|
||||
return this.prefixSum[index];
|
||||
}
|
||||
|
@ -157,11 +157,11 @@ export class PrefixSumComputer {
|
|||
return this.prefixSum[index];
|
||||
}
|
||||
|
||||
public getIndexOf(accumulatedValue: number): PrefixSumIndexOfResult {
|
||||
accumulatedValue = Math.floor(accumulatedValue); //@perf
|
||||
public getIndexOf(sum: number): PrefixSumIndexOfResult {
|
||||
sum = Math.floor(sum); //@perf
|
||||
|
||||
// Compute all sums (to get a fully valid prefixSum)
|
||||
this.getTotalValue();
|
||||
this.getTotalSum();
|
||||
|
||||
let low = 0;
|
||||
let high = this.values.length - 1;
|
||||
|
@ -175,15 +175,15 @@ export class PrefixSumComputer {
|
|||
midStop = this.prefixSum[mid];
|
||||
midStart = midStop - this.values[mid];
|
||||
|
||||
if (accumulatedValue < midStart) {
|
||||
if (sum < midStart) {
|
||||
high = mid - 1;
|
||||
} else if (accumulatedValue >= midStop) {
|
||||
} else if (sum >= midStop) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return new PrefixSumIndexOfResult(mid, accumulatedValue - midStart);
|
||||
return new PrefixSumIndexOfResult(mid, sum - midStart);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import { ViewModelDecorations } from 'vs/editor/common/viewModel/viewModelDecora
|
|||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { EditorTheme } from 'vs/editor/common/view/viewContext';
|
||||
import { Cursor } from 'vs/editor/common/controller/cursor';
|
||||
import { CursorsController } from 'vs/editor/common/controller/cursor';
|
||||
import { PartialCursorState, CursorState, IColumnSelectData, EditOperationType, CursorConfiguration } from 'vs/editor/common/controller/cursorCommon';
|
||||
import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents';
|
||||
import { IWhitespaceChangeAccessor } from 'vs/editor/common/viewLayout/linesLayout';
|
||||
|
@ -52,7 +52,7 @@ export class ViewModel extends Disposable implements IViewModel {
|
|||
private readonly _lines: IViewModelLinesCollection;
|
||||
public readonly coordinatesConverter: ICoordinatesConverter;
|
||||
public readonly viewLayout: ViewLayout;
|
||||
private readonly _cursor: Cursor;
|
||||
private readonly _cursor: CursorsController;
|
||||
private readonly _decorations: ViewModelDecorations;
|
||||
|
||||
constructor(
|
||||
|
@ -103,7 +103,7 @@ export class ViewModel extends Disposable implements IViewModel {
|
|||
|
||||
this.coordinatesConverter = this._lines.createCoordinatesConverter();
|
||||
|
||||
this._cursor = this._register(new Cursor(model, this, this.coordinatesConverter, this.cursorConfig));
|
||||
this._cursor = this._register(new CursorsController(model, this, this.coordinatesConverter, this.cursorConfig));
|
||||
|
||||
this.viewLayout = this._register(new ViewLayout(this._configuration, this.getLineCount(), scheduleAtNextAnimationFrame));
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
let indexOfResult: PrefixSumIndexOfResult;
|
||||
|
||||
let psc = new PrefixSumComputer(toUint32Array([1, 1, 2, 1, 3]));
|
||||
assert.strictEqual(psc.getTotalValue(), 8);
|
||||
assert.strictEqual(psc.getAccumulatedValue(-1), 0);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 5);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 8);
|
||||
assert.strictEqual(psc.getTotalSum(), 8);
|
||||
assert.strictEqual(psc.getPrefixSum(-1), 0);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 5);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 8);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -59,21 +59,21 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
|
||||
// [1, 2, 2, 1, 3]
|
||||
psc.changeValue(1, 2);
|
||||
assert.strictEqual(psc.getTotalValue(), 9);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 3);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 5);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 6);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 9);
|
||||
assert.strictEqual(psc.getTotalSum(), 9);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 3);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 5);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 6);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 9);
|
||||
|
||||
// [1, 0, 2, 1, 3]
|
||||
psc.changeValue(1, 0);
|
||||
assert.strictEqual(psc.getTotalValue(), 7);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 3);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 7);
|
||||
assert.strictEqual(psc.getTotalSum(), 7);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 3);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 7);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -101,12 +101,12 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
|
||||
// [1, 0, 0, 1, 3]
|
||||
psc.changeValue(2, 0);
|
||||
assert.strictEqual(psc.getTotalValue(), 5);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 5);
|
||||
assert.strictEqual(psc.getTotalSum(), 5);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 5);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -128,12 +128,12 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
|
||||
// [1, 0, 0, 0, 3]
|
||||
psc.changeValue(3, 0);
|
||||
assert.strictEqual(psc.getTotalValue(), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 4);
|
||||
assert.strictEqual(psc.getTotalSum(), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 4);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
@ -154,12 +154,12 @@ suite('Editor ViewModel - PrefixSumComputer', () => {
|
|||
psc.changeValue(1, 1);
|
||||
psc.changeValue(3, 1);
|
||||
psc.changeValue(4, 1);
|
||||
assert.strictEqual(psc.getTotalValue(), 4);
|
||||
assert.strictEqual(psc.getAccumulatedValue(0), 1);
|
||||
assert.strictEqual(psc.getAccumulatedValue(1), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(2), 2);
|
||||
assert.strictEqual(psc.getAccumulatedValue(3), 3);
|
||||
assert.strictEqual(psc.getAccumulatedValue(4), 4);
|
||||
assert.strictEqual(psc.getTotalSum(), 4);
|
||||
assert.strictEqual(psc.getPrefixSum(0), 1);
|
||||
assert.strictEqual(psc.getPrefixSum(1), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(2), 2);
|
||||
assert.strictEqual(psc.getPrefixSum(3), 3);
|
||||
assert.strictEqual(psc.getPrefixSum(4), 4);
|
||||
indexOfResult = psc.getIndexOf(0);
|
||||
assert.strictEqual(indexOfResult.index, 0);
|
||||
assert.strictEqual(indexOfResult.remainder, 0);
|
||||
|
|
|
@ -17,6 +17,12 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
|||
import { fromNow } from 'vs/base/common/date';
|
||||
import { ActivationKind, IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
|
||||
interface TrustedExtensionsQuickPickItem {
|
||||
label: string;
|
||||
description: string;
|
||||
extension: AllowedExtension;
|
||||
}
|
||||
|
||||
export class MainThreadAuthenticationProvider extends Disposable {
|
||||
constructor(
|
||||
private readonly _proxy: ExtHostAuthenticationShape,
|
||||
|
@ -38,7 +44,7 @@ export class MainThreadAuthenticationProvider extends Disposable {
|
|||
return;
|
||||
}
|
||||
|
||||
const quickPick = this.quickInputService.createQuickPick<{ label: string, description: string, extension: AllowedExtension }>();
|
||||
const quickPick = this.quickInputService.createQuickPick<TrustedExtensionsQuickPickItem>();
|
||||
quickPick.canSelectMany = true;
|
||||
quickPick.customButton = true;
|
||||
quickPick.customLabel = nls.localize('manageTrustedExtensions.cancel', 'Cancel');
|
||||
|
@ -60,12 +66,23 @@ export class MainThreadAuthenticationProvider extends Disposable {
|
|||
quickPick.placeholder = nls.localize('manageExensions', "Choose which extensions can access this account");
|
||||
|
||||
quickPick.onDidAccept(() => {
|
||||
const updatedAllowedList = quickPick.selectedItems.map(item => item.extension);
|
||||
const updatedAllowedList = quickPick.items
|
||||
.map(i => (i as TrustedExtensionsQuickPickItem).extension);
|
||||
this.storageService.store(`${this.id}-${accountName}`, JSON.stringify(updatedAllowedList), StorageScope.GLOBAL, StorageTarget.USER);
|
||||
|
||||
quickPick.dispose();
|
||||
});
|
||||
|
||||
quickPick.onDidChangeSelection((changed) => {
|
||||
quickPick.items.forEach(item => {
|
||||
if ((item as TrustedExtensionsQuickPickItem).extension) {
|
||||
(item as TrustedExtensionsQuickPickItem).extension.allowed = false;
|
||||
}
|
||||
});
|
||||
|
||||
changed.forEach((item) => item.extension.allowed = true);
|
||||
});
|
||||
|
||||
quickPick.onDidHide(() => {
|
||||
quickPick.dispose();
|
||||
});
|
||||
|
|
|
@ -171,10 +171,14 @@ export class MainThreadWebviewPanels extends Disposable implements extHostProtoc
|
|||
|
||||
/* __GDPR__
|
||||
"webviews:createWebviewPanel" : {
|
||||
"extensionId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
"extensionId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"viewType" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
this._telemetryService.publicLog('webviews:createWebviewPanel', { extensionId: extension.id.value });
|
||||
this._telemetryService.publicLog('webviews:createWebviewPanel', {
|
||||
extensionId: extension.id.value,
|
||||
viewType
|
||||
});
|
||||
}
|
||||
|
||||
public $disposeWebview(handle: extHostProtocol.WebviewHandle): void {
|
||||
|
|
|
@ -143,7 +143,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
|||
private _offsetAt(position: vscode.Position): number {
|
||||
position = this._validatePosition(position);
|
||||
this._ensureLineStarts();
|
||||
return this._lineStarts!.getAccumulatedValue(position.line - 1) + position.character;
|
||||
return this._lineStarts!.getPrefixSum(position.line - 1) + position.character;
|
||||
}
|
||||
|
||||
private _positionAt(offset: number): vscode.Position {
|
||||
|
|
|
@ -123,7 +123,7 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
|
||||
offsetAt(position: vscode.Position): number {
|
||||
const idx = this._cellLines.getIndexOf(position.line);
|
||||
const offset1 = this._cellLengths.getAccumulatedValue(idx.index - 1);
|
||||
const offset1 = this._cellLengths.getPrefixSum(idx.index - 1);
|
||||
const offset2 = this._cells[idx.index].document.offsetAt(position.with(idx.remainder));
|
||||
return offset1 + offset2;
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
positionAt(locationOrOffset: vscode.Location | number): vscode.Position {
|
||||
if (typeof locationOrOffset === 'number') {
|
||||
const idx = this._cellLengths.getIndexOf(locationOrOffset);
|
||||
const lineCount = this._cellLines.getAccumulatedValue(idx.index - 1);
|
||||
const lineCount = this._cellLines.getPrefixSum(idx.index - 1);
|
||||
return this._cells[idx.index].document.positionAt(idx.remainder).translate(lineCount);
|
||||
}
|
||||
|
||||
const idx = this._cellUris.get(locationOrOffset.uri);
|
||||
if (idx !== undefined) {
|
||||
const line = this._cellLines.getAccumulatedValue(idx - 1);
|
||||
const line = this._cellLines.getPrefixSum(idx - 1);
|
||||
return new types.Position(line + locationOrOffset.range.start.line, locationOrOffset.range.start.character);
|
||||
}
|
||||
// do better?
|
||||
|
@ -180,7 +180,7 @@ export class ExtHostNotebookConcatDocument implements vscode.NotebookConcatTextD
|
|||
const cellPosition = new types.Position(startIdx.remainder, position.character);
|
||||
const validCellPosition = this._cells[startIdx.index].document.validatePosition(cellPosition);
|
||||
|
||||
const line = this._cellLines.getAccumulatedValue(startIdx.index - 1);
|
||||
const line = this._cellLines.getPrefixSum(startIdx.index - 1);
|
||||
return new types.Position(line + validCellPosition.line, validCellPosition.character);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import * as types from 'vs/workbench/api/common/extHostTypes';
|
|||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { IExtHostTunnelService, TunnelDto } from 'vs/workbench/api/common/extHostTunnelService';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { TunnelOptions, TunnelCreationOptions, ProvidedPortAttributes, ProvidedOnAutoForward } from 'vs/platform/remote/common/tunnel';
|
||||
import { TunnelOptions, TunnelCreationOptions, ProvidedPortAttributes, ProvidedOnAutoForward, isLocalhost, isAllInterfaces } from 'vs/platform/remote/common/tunnel';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { MovingAverage } from 'vs/base/common/numbers';
|
||||
import { CandidatePort } from 'vs/workbench/services/remote/common/remoteExplorerService';
|
||||
|
@ -270,7 +270,7 @@ export class ExtHostTunnelService extends Disposable implements IExtHostTunnelSe
|
|||
let oldPorts: { host: string, port: number, detail?: string }[] | undefined = undefined;
|
||||
while (this._candidateFindingEnabled) {
|
||||
const startTime = new Date().getTime();
|
||||
const newPorts = await this.findCandidatePorts();
|
||||
const newPorts = (await this.findCandidatePorts()).filter(candidate => (isLocalhost(candidate.host) || isAllInterfaces(candidate.host)));
|
||||
this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) found candidate ports ${newPorts.map(port => port.port).join(', ')}`);
|
||||
const timeTaken = new Date().getTime() - startTime;
|
||||
movingAverage.update(timeTaken);
|
||||
|
|
|
@ -59,6 +59,19 @@ export class Memento {
|
|||
globalMemento.save();
|
||||
}
|
||||
}
|
||||
|
||||
static clear(scope: StorageScope): void {
|
||||
|
||||
// Workspace
|
||||
if (scope === StorageScope.WORKSPACE) {
|
||||
Memento.workspaceMementos.clear();
|
||||
}
|
||||
|
||||
// Global
|
||||
if (scope === StorageScope.GLOBAL) {
|
||||
Memento.globalMementos.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ScopedMemento {
|
||||
|
|
|
@ -23,7 +23,7 @@ import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
|||
import { CONTEXT_ACTIVE_CUSTOM_EDITOR_ID, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorCapabilities, CustomEditorInfo, CustomEditorInfoCollection, ICustomEditorService } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { CustomEditorModelManager } from 'vs/workbench/contrib/customEditor/common/customEditorModelManager';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { ContributedEditorPriority, IEditorOverrideService, IEditorType } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority, IEditorOverrideService, IEditorType } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { ContributedCustomEditors } from '../common/contributedCustomEditors';
|
||||
|
@ -213,7 +213,7 @@ export class CustomEditorService extends Disposable implements ICustomEditorServ
|
|||
const possibleEditors = this.getAllCustomEditors(newResource);
|
||||
|
||||
// See if we have any non-optional custom editor for this resource
|
||||
if (!possibleEditors.allEditors.some(editor => editor.priority !== ContributedEditorPriority.option)) {
|
||||
if (!possibleEditors.allEditors.some(editor => editor.priority !== RegisteredEditorPriority.option)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storag
|
|||
import { Memento } from 'vs/workbench/common/memento';
|
||||
import { CustomEditorDescriptor, CustomEditorInfo } from 'vs/workbench/contrib/customEditor/common/customEditor';
|
||||
import { customEditorsExtensionPoint, ICustomEditorsExtensionPoint } from 'vs/workbench/contrib/customEditor/common/extensionPoint';
|
||||
import { ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
|
||||
export const defaultCustomEditor = new CustomEditorInfo({
|
||||
|
@ -22,7 +22,7 @@ export const defaultCustomEditor = new CustomEditorInfo({
|
|||
selector: [
|
||||
{ filenamePattern: '*' }
|
||||
],
|
||||
priority: ContributedEditorPriority.default,
|
||||
priority: RegisteredEditorPriority.default,
|
||||
});
|
||||
|
||||
export class ContributedCustomEditors extends Disposable {
|
||||
|
@ -100,17 +100,17 @@ export class ContributedCustomEditors extends Disposable {
|
|||
function getPriorityFromContribution(
|
||||
contribution: ICustomEditorsExtensionPoint,
|
||||
extension: IExtensionDescription,
|
||||
): ContributedEditorPriority {
|
||||
): RegisteredEditorPriority {
|
||||
switch (contribution.priority) {
|
||||
case ContributedEditorPriority.default:
|
||||
case ContributedEditorPriority.option:
|
||||
case RegisteredEditorPriority.default:
|
||||
case RegisteredEditorPriority.option:
|
||||
return contribution.priority;
|
||||
|
||||
case ContributedEditorPriority.builtin:
|
||||
case RegisteredEditorPriority.builtin:
|
||||
// Builtin is only valid for builtin extensions
|
||||
return extension.isBuiltin ? ContributedEditorPriority.builtin : ContributedEditorPriority.default;
|
||||
return extension.isBuiltin ? RegisteredEditorPriority.builtin : RegisteredEditorPriority.default;
|
||||
|
||||
default:
|
||||
return ContributedEditorPriority.default;
|
||||
return RegisteredEditorPriority.default;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
|||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IRevertOptions, ISaveOptions } from 'vs/workbench/common/editor';
|
||||
import { ContributedEditorPriority, globMatchesResource, priorityToRank } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority, globMatchesResource, priorityToRank } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
|
||||
export const ICustomEditorService = createDecorator<ICustomEditorService>('customEditorService');
|
||||
|
||||
|
@ -86,7 +86,7 @@ export interface CustomEditorDescriptor {
|
|||
readonly id: string;
|
||||
readonly displayName: string;
|
||||
readonly providerDisplayName: string;
|
||||
readonly priority: ContributedEditorPriority;
|
||||
readonly priority: RegisteredEditorPriority;
|
||||
readonly selector: readonly CustomEditorSelector[];
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ export class CustomEditorInfo implements CustomEditorDescriptor {
|
|||
public readonly id: string;
|
||||
public readonly displayName: string;
|
||||
public readonly providerDisplayName: string;
|
||||
public readonly priority: ContributedEditorPriority;
|
||||
public readonly priority: RegisteredEditorPriority;
|
||||
public readonly selector: readonly CustomEditorSelector[];
|
||||
|
||||
constructor(descriptor: CustomEditorDescriptor) {
|
||||
|
@ -130,8 +130,8 @@ export class CustomEditorInfoCollection {
|
|||
public get defaultEditor(): CustomEditorInfo | undefined {
|
||||
return this.allEditors.find(editor => {
|
||||
switch (editor.priority) {
|
||||
case ContributedEditorPriority.default:
|
||||
case ContributedEditorPriority.builtin:
|
||||
case RegisteredEditorPriority.default:
|
||||
case RegisteredEditorPriority.builtin:
|
||||
// A default editor must have higher priority than all other contributed editors.
|
||||
return this.allEditors.every(otherEditor =>
|
||||
otherEditor === editor || isLowerPriority(otherEditor, editor));
|
||||
|
|
|
@ -925,7 +925,7 @@ registerAction2(class ChangeCellToMarkdownAction extends NotebookCellAction {
|
|||
}
|
||||
|
||||
async runWithContext(accessor: ServicesAccessor, context: INotebookCellActionContext): Promise<void> {
|
||||
await changeCellToKind(CellKind.Markup, context);
|
||||
await changeCellToKind(CellKind.Markup, context, 'markdown');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ export class FindModel extends Disposable {
|
|||
} else {
|
||||
// const currIndex = this._findMatchesStarts!.getIndexOf(this._currentMatch);
|
||||
// currCell = this._findMatches[currIndex.index].cell;
|
||||
const totalVal = this._findMatchesStarts.getTotalValue();
|
||||
const totalVal = this._findMatchesStarts.getTotalSum();
|
||||
if (this._currentMatch === -1) {
|
||||
this._currentMatch = previous ? totalVal - 1 : 0;
|
||||
} else {
|
||||
|
|
|
@ -109,7 +109,7 @@ export class DiffNestedCellViewModel extends Disposable implements IDiffNestedCe
|
|||
throw new Error('Output index out of range!');
|
||||
}
|
||||
|
||||
return this._outputsTop!.getAccumulatedValue(index - 1);
|
||||
return this._outputsTop!.getPrefixSum(index - 1);
|
||||
}
|
||||
|
||||
updateOutputHeight(index: number, height: number): void {
|
||||
|
@ -127,6 +127,6 @@ export class DiffNestedCellViewModel extends Disposable implements IDiffNestedCe
|
|||
getOutputTotalHeight() {
|
||||
this._ensureOutputsTop();
|
||||
|
||||
return this._outputsTop?.getTotalValue() ?? 0;
|
||||
return this._outputsTop?.getTotalSum() ?? 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import { updateEditorTopPadding } from 'vs/workbench/contrib/notebook/common/not
|
|||
import { NotebookOutputRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookOutputRenderer';
|
||||
import { NotebookEditorDescriptor, NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider';
|
||||
import { ComplexNotebookProviderInfo, INotebookContentProvider, INotebookSerializer, INotebookService, SimpleNotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookService';
|
||||
import { ContributedEditorInfo, ContributedEditorPriority, DiffEditorInputFactoryFunction, EditorInputFactoryFunction, IEditorOverrideService, IEditorType } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorInfo, RegisteredEditorPriority, DiffEditorInputFactoryFunction, EditorInputFactoryFunction, IEditorOverrideService, IEditorType } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
|
||||
|
@ -124,14 +124,14 @@ export class NotebookProviderInfoStore extends Disposable {
|
|||
|
||||
private _convertPriority(priority?: string) {
|
||||
if (!priority) {
|
||||
return ContributedEditorPriority.default;
|
||||
return RegisteredEditorPriority.default;
|
||||
}
|
||||
|
||||
if (priority === NotebookEditorPriority.default) {
|
||||
return ContributedEditorPriority.default;
|
||||
return RegisteredEditorPriority.default;
|
||||
}
|
||||
|
||||
return ContributedEditorPriority.option;
|
||||
return RegisteredEditorPriority.option;
|
||||
|
||||
}
|
||||
|
||||
|
@ -141,11 +141,11 @@ export class NotebookProviderInfoStore extends Disposable {
|
|||
|
||||
for (const selector of notebookProviderInfo.selectors) {
|
||||
const globPattern = (selector as INotebookExclusiveDocumentFilter).include || selector as glob.IRelativePattern | string;
|
||||
const notebookEditorInfo: ContributedEditorInfo = {
|
||||
const notebookEditorInfo: RegisteredEditorInfo = {
|
||||
id: notebookProviderInfo.id,
|
||||
label: notebookProviderInfo.displayName,
|
||||
detail: notebookProviderInfo.providerDisplayName,
|
||||
priority: notebookProviderInfo.exclusive ? ContributedEditorPriority.exclusive : notebookProviderInfo.priority,
|
||||
priority: notebookProviderInfo.exclusive ? RegisteredEditorPriority.exclusive : notebookProviderInfo.priority,
|
||||
};
|
||||
const notebookEditorOptions = {
|
||||
canHandleDiff: () => !!this._configurationService.getValue(NotebookTextDiffEditorPreview) && !this._accessibilityService.isScreenReaderOptimized(),
|
||||
|
@ -182,7 +182,7 @@ export class NotebookProviderInfoStore extends Disposable {
|
|||
// Then register the schema handler as exclusive for that notebook
|
||||
disposables.add(this._editorOverrideService.registerEditor(
|
||||
`${Schemas.vscodeNotebookCell}:/**/${globPattern}`,
|
||||
{ ...notebookEditorInfo, priority: ContributedEditorPriority.exclusive },
|
||||
{ ...notebookEditorInfo, priority: RegisteredEditorPriority.exclusive },
|
||||
notebookEditorOptions,
|
||||
notebookEditorInputFactory,
|
||||
notebookEditorDiffFactory
|
||||
|
@ -474,7 +474,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
|||
displayName: data.displayName,
|
||||
providerDisplayName: data.providerDisplayName,
|
||||
exclusive: data.exclusive,
|
||||
priority: ContributedEditorPriority.default,
|
||||
priority: RegisteredEditorPriority.default,
|
||||
selectors: [],
|
||||
});
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
return viewIndex;
|
||||
}
|
||||
|
||||
const modelIndex = this.hiddenRangesPrefixSum.getAccumulatedValue(viewIndex - 1);
|
||||
const modelIndex = this.hiddenRangesPrefixSum.getPrefixSum(viewIndex - 1);
|
||||
return modelIndex;
|
||||
}
|
||||
|
||||
|
@ -486,9 +486,9 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
||||
|
||||
if (viewIndexInfo.remainder !== 0) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
||||
// it's already after the last hidden range
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount());
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
||||
}
|
||||
return undefined;
|
||||
} else {
|
||||
|
@ -504,7 +504,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
let modelIndex = topModelIndex;
|
||||
|
||||
while (index <= bottomViewIndex) {
|
||||
const accu = this.hiddenRangesPrefixSum!.getAccumulatedValue(index);
|
||||
const accu = this.hiddenRangesPrefixSum!.getPrefixSum(index);
|
||||
if (accu === modelIndex + 1) {
|
||||
// no hidden area after it
|
||||
if (stack.length) {
|
||||
|
@ -575,8 +575,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
||||
|
||||
if (viewIndexInfo.remainder !== 0) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount());
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -591,8 +591,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
|
|||
const viewIndexInfo = this.hiddenRangesPrefixSum.getIndexOf(modelIndex);
|
||||
|
||||
if (viewIndexInfo.remainder !== 0) {
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalValue()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalValue() - this.hiddenRangesPrefixSum.getCount());
|
||||
if (modelIndex >= this.hiddenRangesPrefixSum.getTotalSum()) {
|
||||
return modelIndex - (this.hiddenRangesPrefixSum.getTotalSum() - this.hiddenRangesPrefixSum.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
|
|||
const notebookLayoutConfiguration = this.viewContext.notebookOptions.getLayoutConfiguration();
|
||||
const bottomToolbarDimensions = this.viewContext.notebookOptions.computeBottomToolbarDimensions();
|
||||
const outputShowMoreContainerHeight = state.outputShowMoreContainerHeight ? state.outputShowMoreContainerHeight : this._layoutInfo.outputShowMoreContainerHeight;
|
||||
let outputTotalHeight = Math.max(this._outputMinHeight, this.metadata.outputCollapsed ? notebookLayoutConfiguration.collapsedIndicatorHeight : this._outputsTop!.getTotalValue());
|
||||
let outputTotalHeight = Math.max(this._outputMinHeight, this.metadata.outputCollapsed ? notebookLayoutConfiguration.collapsedIndicatorHeight : this._outputsTop!.getTotalSum());
|
||||
|
||||
const originalLayout = this.layoutInfo;
|
||||
if (!this.metadata.inputCollapsed) {
|
||||
|
@ -368,7 +368,7 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
|
|||
throw new Error('Output index out of range!');
|
||||
}
|
||||
|
||||
return this._outputsTop!.getAccumulatedValue(index - 1);
|
||||
return this._outputsTop!.getPrefixSum(index - 1);
|
||||
}
|
||||
|
||||
getOutputOffset(index: number): number {
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as glob from 'vs/base/common/glob';
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { INotebookExclusiveDocumentFilter, isDocumentExcludePattern, TransientOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
type NotebookSelector = string | glob.IRelativePattern | INotebookExclusiveDocumentFilter;
|
||||
|
@ -17,7 +17,7 @@ export interface NotebookEditorDescriptor {
|
|||
readonly id: string;
|
||||
readonly displayName: string;
|
||||
readonly selectors: readonly { filenamePattern?: string; excludeFileNamePattern?: string; }[];
|
||||
readonly priority: ContributedEditorPriority;
|
||||
readonly priority: RegisteredEditorPriority;
|
||||
readonly providerDisplayName: string;
|
||||
readonly exclusive: boolean;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export class NotebookProviderInfo {
|
|||
readonly extension: ExtensionIdentifier;
|
||||
readonly id: string;
|
||||
readonly displayName: string;
|
||||
readonly priority: ContributedEditorPriority;
|
||||
readonly priority: RegisteredEditorPriority;
|
||||
readonly providerDisplayName: string;
|
||||
readonly exclusive: boolean;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
|
|||
import { NotebookProviderInfoStore } from 'vs/workbench/contrib/notebook/browser/notebookServiceImpl';
|
||||
import { NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider';
|
||||
import { EditorOverrideService } from 'vs/workbench/services/editor/browser/editorOverrideService';
|
||||
import { ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IExtensionService, nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
|
||||
|
@ -52,7 +52,7 @@ suite('NotebookProviderInfoStore', function () {
|
|||
id: 'foo',
|
||||
displayName: 'foo',
|
||||
selectors: [{ filenamePattern: '*.foo' }],
|
||||
priority: ContributedEditorPriority.default,
|
||||
priority: RegisteredEditorPriority.default,
|
||||
exclusive: false,
|
||||
providerDisplayName: 'foo',
|
||||
});
|
||||
|
@ -61,7 +61,7 @@ suite('NotebookProviderInfoStore', function () {
|
|||
id: 'bar',
|
||||
displayName: 'bar',
|
||||
selectors: [{ filenamePattern: '*.bar' }],
|
||||
priority: ContributedEditorPriority.default,
|
||||
priority: RegisteredEditorPriority.default,
|
||||
exclusive: false,
|
||||
providerDisplayName: 'bar',
|
||||
});
|
||||
|
|
|
@ -22,7 +22,7 @@ import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuratio
|
|||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IEditorInputWithOptions } from 'vs/workbench/common/editor';
|
||||
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { ContributedEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { FOLDER_SETTINGS_PATH, IPreferencesService, USE_SPLIT_JSON_SETTING } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { PreferencesEditorInput } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
|
||||
|
@ -67,7 +67,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
|
|||
id: PreferencesEditorInput.ID,
|
||||
detail: 'Split Settings Editor (deprecated)',
|
||||
label: 'label',
|
||||
priority: ContributedEditorPriority.builtin,
|
||||
priority: RegisteredEditorPriority.builtin,
|
||||
},
|
||||
{},
|
||||
(resource: URI, options: IEditorOptions | undefined, group: IEditorGroup): IEditorInputWithOptions => {
|
||||
|
|
|
@ -32,7 +32,7 @@ import { createEditorFromSearchResult, modifySearchEditorContextLinesCommand, op
|
|||
import { getOrMakeSearchEditorInput, SearchConfiguration, SearchEditorInput, SEARCH_EDITOR_EXT } from 'vs/workbench/contrib/searchEditor/browser/searchEditorInput';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { VIEW_ID } from 'vs/workbench/services/search/common/search';
|
||||
import { ContributedEditorPriority, DEFAULT_EDITOR_ASSOCIATION, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority, DEFAULT_EDITOR_ASSOCIATION, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IWorkingCopyEditorService } from 'vs/workbench/services/workingCopy/common/workingCopyEditorService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
|
@ -81,7 +81,7 @@ class SearchEditorContribution implements IWorkbenchContribution {
|
|||
id: SearchEditorInput.ID,
|
||||
label: localize('promptOpenWith.searchEditor.displayName', "Search Editor"),
|
||||
detail: DEFAULT_EDITOR_ASSOCIATION.providerDisplayName,
|
||||
priority: ContributedEditorPriority.default,
|
||||
priority: RegisteredEditorPriority.default,
|
||||
},
|
||||
{
|
||||
singlePerResource: true,
|
||||
|
|
|
@ -518,7 +518,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
}
|
||||
|
||||
protected showOutput(runSource: TaskRunSource = TaskRunSource.User): void {
|
||||
if ((runSource === TaskRunSource.User) || (runSource === TaskRunSource.ConfigurationChange)) {
|
||||
if (!VirtualWorkspaceContext.getValue(this.contextKeyService) && ((runSource === TaskRunSource.User) || (runSource === TaskRunSource.ConfigurationChange))) {
|
||||
this.notificationService.prompt(Severity.Warning, nls.localize('taskServiceOutputPrompt', 'There are task errors. See the output for details.'),
|
||||
[{
|
||||
label: nls.localize('showOutput', "Show output"),
|
||||
|
@ -2021,7 +2021,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
if (this.executionEngine === ExecutionEngine.Process) {
|
||||
return this.emptyWorkspaceTaskResults(workspaceFolder);
|
||||
}
|
||||
const configuration = this.testParseExternalConfig(this.configurationService.inspect<TaskConfig.ExternalTaskRunnerConfiguration>('tasks').workspaceValue, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file'));
|
||||
const workspaceFileConfig = this.getConfiguration(workspaceFolder, TaskSourceKind.WorkspaceFile);
|
||||
const configuration = this.testParseExternalConfig(workspaceFileConfig.config, nls.localize('TasksSystem.locationWorkspaceConfig', 'workspace file'));
|
||||
let customizedTasks: { byIdentifier: IStringDictionary<ConfiguringTask>; } = {
|
||||
byIdentifier: Object.create(null)
|
||||
};
|
||||
|
@ -2040,7 +2041,8 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
if (this.executionEngine === ExecutionEngine.Process) {
|
||||
return this.emptyWorkspaceTaskResults(workspaceFolder);
|
||||
}
|
||||
const configuration = this.testParseExternalConfig(this.configurationService.inspect<TaskConfig.ExternalTaskRunnerConfiguration>('tasks').userValue, nls.localize('TasksSystem.locationUserConfig', 'user settings'));
|
||||
const userTasksConfig = this.getConfiguration(workspaceFolder, TaskSourceKind.User);
|
||||
const configuration = this.testParseExternalConfig(userTasksConfig.config, nls.localize('TasksSystem.locationUserConfig', 'user settings'));
|
||||
let customizedTasks: { byIdentifier: IStringDictionary<ConfiguringTask>; } = {
|
||||
byIdentifier: Object.create(null)
|
||||
};
|
||||
|
@ -2157,9 +2159,20 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
|
|||
} else {
|
||||
const wholeConfig = this.configurationService.inspect<TaskConfig.ExternalTaskRunnerConfiguration>('tasks', { resource: workspaceFolder.uri });
|
||||
switch (source) {
|
||||
case TaskSourceKind.User: result = Objects.deepClone(wholeConfig.userValue); break;
|
||||
case TaskSourceKind.User: {
|
||||
if (wholeConfig.userValue !== wholeConfig.workspaceFolderValue) {
|
||||
result = Objects.deepClone(wholeConfig.userValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TaskSourceKind.Workspace: result = Objects.deepClone(wholeConfig.workspaceFolderValue); break;
|
||||
case TaskSourceKind.WorkspaceFile: result = Objects.deepClone(wholeConfig.workspaceValue); break;
|
||||
case TaskSourceKind.WorkspaceFile: {
|
||||
if ((this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE)
|
||||
&& (wholeConfig.workspaceFolderValue !== wholeConfig.workspaceValue)) {
|
||||
result = Objects.deepClone(wholeConfig.workspaceValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: result = Objects.deepClone(wholeConfig.workspaceFolderValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -543,6 +543,7 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
|
|||
mime: result.mimeType,
|
||||
data: buffer,
|
||||
etag: result.etag,
|
||||
mtime: result.mtime
|
||||
});
|
||||
}
|
||||
case WebviewResourceResponse.Type.NotModified:
|
||||
|
@ -552,6 +553,7 @@ export abstract class BaseWebview<T extends HTMLElement> extends Disposable {
|
|||
status: 304, // not modified
|
||||
path: uri.path,
|
||||
mime: result.mimeType,
|
||||
mtime: result.mtime
|
||||
});
|
||||
}
|
||||
case WebviewResourceResponse.Type.AccessDenied:
|
||||
|
|
|
@ -100,7 +100,9 @@ class RequestStore {
|
|||
|
||||
/**
|
||||
* Map of requested paths to responses.
|
||||
* @typedef {{ type: 'response', body: any, mime: string, etag: string | undefined, } | { type: 'not-modified', mime: string } | undefined} ResourceResponse
|
||||
* @typedef {{ type: 'response', body: Uint8Array, mime: string, etag: string | undefined, mtime: number | undefined } |
|
||||
* { type: 'not-modified', mime: string, mtime: number | undefined } |
|
||||
* undefined} ResourceResponse
|
||||
* @type {RequestStore<ResourceResponse>}
|
||||
*/
|
||||
const resourceRequestStore = new RequestStore();
|
||||
|
@ -142,12 +144,12 @@ sw.addEventListener('message', async (event) => {
|
|||
switch (data.status) {
|
||||
case 200:
|
||||
{
|
||||
response = { type: 'response', body: data.data, mime: data.mime, etag: data.etag };
|
||||
response = { type: 'response', body: data.data, mime: data.mime, etag: data.etag, mtime: data.mtime };
|
||||
break;
|
||||
}
|
||||
case 304:
|
||||
{
|
||||
response = { type: 'not-modified', mime: data.mime };
|
||||
response = { type: 'not-modified', mime: data.mime, mtime: data.mtime };
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -233,15 +235,19 @@ async function processResourceRequest(event, requestUrl) {
|
|||
}
|
||||
}
|
||||
|
||||
/** @type {Record<String, string>} */
|
||||
/** @type {Record<string, string>} */
|
||||
const headers = {
|
||||
'Content-Type': entry.mime,
|
||||
'Content-Length': entry.body.byteLength.toString(),
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
};
|
||||
if (entry.etag) {
|
||||
headers['ETag'] = entry.etag;
|
||||
headers['Cache-Control'] = 'no-cache';
|
||||
}
|
||||
if (entry.mtime) {
|
||||
headers['Last-Modified'] = new Date(entry.mtime).toUTCString();
|
||||
}
|
||||
const response = new Response(entry.body, {
|
||||
status: 200,
|
||||
headers
|
||||
|
|
|
@ -22,6 +22,7 @@ export namespace WebviewResourceResponse {
|
|||
constructor(
|
||||
public readonly stream: VSBufferReadableStream,
|
||||
public readonly etag: string | undefined,
|
||||
public readonly mtime: number | undefined,
|
||||
public readonly mimeType: string,
|
||||
) { }
|
||||
}
|
||||
|
@ -34,6 +35,7 @@ export namespace WebviewResourceResponse {
|
|||
|
||||
constructor(
|
||||
public readonly mimeType: string,
|
||||
public readonly mtime: number | undefined,
|
||||
) { }
|
||||
}
|
||||
|
||||
|
@ -50,7 +52,7 @@ export async function loadLocalResource(
|
|||
logService: ILogService,
|
||||
token: CancellationToken,
|
||||
): Promise<WebviewResourceResponse.StreamResponse> {
|
||||
logService.debug(`loadLocalResource - being. requestUri=${requestUri}`);
|
||||
logService.debug(`loadLocalResource - begin. requestUri=${requestUri}`);
|
||||
|
||||
const resourceToLoad = getResourceToLoad(requestUri, options.roots);
|
||||
|
||||
|
@ -64,14 +66,14 @@ export async function loadLocalResource(
|
|||
|
||||
try {
|
||||
const result = await fileService.readFileStream(resourceToLoad, { etag: options.ifNoneMatch });
|
||||
return new WebviewResourceResponse.StreamSuccess(result.value, result.etag, mime);
|
||||
return new WebviewResourceResponse.StreamSuccess(result.value, result.etag, result.mtime, mime);
|
||||
} catch (err) {
|
||||
if (err instanceof FileOperationError) {
|
||||
const result = err.fileOperationResult;
|
||||
|
||||
// NotModified status is expected and can be handled gracefully
|
||||
if (result === FileOperationResult.FILE_NOT_MODIFIED_SINCE) {
|
||||
return new WebviewResourceResponse.NotModified(mime);
|
||||
return new WebviewResourceResponse.NotModified(mime, err.options?.mtime);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -908,20 +908,22 @@ export class SimpleFileDialog {
|
|||
return child.substring(parent.length);
|
||||
}
|
||||
|
||||
private createBackItem(currFolder: URI): FileQuickPickItem | null {
|
||||
private async createBackItem(currFolder: URI): Promise<FileQuickPickItem | undefined> {
|
||||
const fileRepresentationCurr = this.currentFolder.with({ scheme: Schemas.file, authority: '' });
|
||||
const fileRepresentationParent = resources.dirname(fileRepresentationCurr);
|
||||
if (!resources.isEqual(fileRepresentationCurr, fileRepresentationParent)) {
|
||||
const parentFolder = resources.dirname(currFolder);
|
||||
if (await this.fileService.exists(parentFolder)) {
|
||||
return { label: '..', uri: resources.addTrailingPathSeparator(parentFolder, this.separator), isFolder: true };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private async createItems(folder: IFileStat | undefined, currentFolder: URI, token: CancellationToken): Promise<FileQuickPickItem[]> {
|
||||
const result: FileQuickPickItem[] = [];
|
||||
|
||||
const backDir = this.createBackItem(currentFolder);
|
||||
const backDir = await this.createBackItem(currentFolder);
|
||||
try {
|
||||
if (!folder) {
|
||||
folder = await this.fileService.resolve(currentFolder);
|
||||
|
|
|
@ -13,7 +13,7 @@ import { EditorActivation, EditorOverride, IEditorOptions } from 'vs/platform/ed
|
|||
import { EditorResourceAccessor, IEditorInput, IEditorInputWithOptions, isResourceDiffEditorInput, SideBySideEditor } from 'vs/workbench/common/editor';
|
||||
import { IEditorGroup, IEditorGroupsService, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { ContributedEditorInfo, ContributedEditorPriority, RegisteredEditorOptions, DEFAULT_EDITOR_ASSOCIATION, DiffEditorInputFactoryFunction, EditorAssociation, EditorAssociations, EditorInputFactoryFunction, editorsAssociationsSettingId, globMatchesResource, IEditorOverrideService, priorityToRank, ReturnedOverride, OverrideStatus } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorInfo, RegisteredEditorPriority, RegisteredEditorOptions, DEFAULT_EDITOR_ASSOCIATION, DiffEditorInputFactoryFunction, EditorAssociation, EditorAssociations, EditorInputFactoryFunction, editorsAssociationsSettingId, globMatchesResource, IEditorOverrideService, priorityToRank, ReturnedOverride, OverrideStatus } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IKeyMods, IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { localize } from 'vs/nls';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
|
@ -23,13 +23,13 @@ import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storag
|
|||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
||||
interface IContributedEditorInput extends IEditorInput {
|
||||
interface IRegisteredEditorInput extends IEditorInput {
|
||||
viewType?: string;
|
||||
}
|
||||
|
||||
interface RegisteredEditor {
|
||||
globPattern: string | glob.IRelativePattern,
|
||||
editorInfo: ContributedEditorInfo,
|
||||
editorInfo: RegisteredEditorInfo,
|
||||
options?: RegisteredEditorOptions,
|
||||
createEditorInput: EditorInputFactoryFunction
|
||||
createDiffEditorInput?: DiffEditorInputFactoryFunction
|
||||
|
@ -124,12 +124,9 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
}
|
||||
|
||||
// If it's the currently active editor we shouldn't do anything
|
||||
const currentEditor = firstOrDefault(group.findEditors(resource));
|
||||
let currentViewType = undefined;
|
||||
if (currentEditor) {
|
||||
currentViewType = (currentEditor as IContributedEditorInput).viewType;
|
||||
}
|
||||
if (currentViewType && selectedEditor.editorInfo.id === currentViewType) {
|
||||
const currentEditors = group.findEditors(resource);
|
||||
const isActive = currentEditors.find(editor => (editor as IRegisteredEditorInput).viewType === selectedEditor.editorInfo.id);
|
||||
if (isActive) {
|
||||
return OverrideStatus.ABORT;
|
||||
}
|
||||
const input = await this.doOverrideEditorInput(resource, editor, options, group, selectedEditor);
|
||||
|
@ -148,7 +145,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
|
||||
registerEditor(
|
||||
globPattern: string | glob.IRelativePattern,
|
||||
editorInfo: ContributedEditorInfo,
|
||||
editorInfo: RegisteredEditorInfo,
|
||||
options: RegisteredEditorOptions,
|
||||
createEditorInput: EditorInputFactoryFunction,
|
||||
createDiffEditorInput?: DiffEditorInputFactoryFunction
|
||||
|
@ -273,9 +270,9 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
|
||||
const associationsFromSetting = this.getAssociationsForResource(resource);
|
||||
// We only want built-in+ if no user defined setting is found, else we won't override
|
||||
const possibleEditors = editors.filter(editor => priorityToRank(editor.editorInfo.priority) >= priorityToRank(ContributedEditorPriority.builtin) && editor.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id);
|
||||
const possibleEditors = editors.filter(editor => priorityToRank(editor.editorInfo.priority) >= priorityToRank(RegisteredEditorPriority.builtin) && editor.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id);
|
||||
// If the editor is exclusive we use that, else use the user setting, else use the built-in+ editor
|
||||
const selectedViewType = possibleEditors[0]?.editorInfo.priority === ContributedEditorPriority.exclusive ?
|
||||
const selectedViewType = possibleEditors[0]?.editorInfo.priority === RegisteredEditorPriority.exclusive ?
|
||||
possibleEditors[0]?.editorInfo.id :
|
||||
associationsFromSetting[0]?.viewType || possibleEditors[0]?.editorInfo.id;
|
||||
|
||||
|
@ -362,7 +359,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
|
||||
for (const group of orderedGroups) {
|
||||
for (const editor of group.editors) {
|
||||
if (isEqual(editor.resource, resource) && (editor as IContributedEditorInput).viewType === viewType) {
|
||||
if (isEqual(editor.resource, resource) && (editor as IRegisteredEditorInput).viewType === viewType) {
|
||||
out.push({ editor, group });
|
||||
}
|
||||
}
|
||||
|
@ -370,7 +367,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
return out;
|
||||
}
|
||||
|
||||
private async doHandleConflictingDefaults(resource: URI, editorName: string, currentEditor: IContributedEditorInput, options: IEditorOptions | undefined, group: IEditorGroup) {
|
||||
private async doHandleConflictingDefaults(resource: URI, editorName: string, currentEditor: IRegisteredEditorInput, options: IEditorOptions | undefined, group: IEditorGroup) {
|
||||
type StoredChoice = {
|
||||
[key: string]: string[];
|
||||
};
|
||||
|
@ -448,7 +445,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
const currentDefaultAndActiveLabel = localize('promptOpenWith.currentDefaultAndActive', "Active and Default");
|
||||
// Default order = setting -> highest priority -> text
|
||||
let defaultViewType = defaultSetting;
|
||||
if (!defaultViewType && registeredEditors.length > 2 && registeredEditors[1]?.editorInfo.priority !== ContributedEditorPriority.option) {
|
||||
if (!defaultViewType && registeredEditors.length > 2 && registeredEditors[1]?.editorInfo.priority !== RegisteredEditorPriority.option) {
|
||||
defaultViewType = registeredEditors[1]?.editorInfo.id;
|
||||
}
|
||||
if (!defaultViewType) {
|
||||
|
@ -456,7 +453,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
}
|
||||
// Map the editors to quickpick entries
|
||||
registeredEditors.forEach(editor => {
|
||||
const currentViewType = (currentEditor as IContributedEditorInput).viewType ?? DEFAULT_EDITOR_ASSOCIATION.id;
|
||||
const currentViewType = (currentEditor as IRegisteredEditorInput).viewType ?? DEFAULT_EDITOR_ASSOCIATION.id;
|
||||
const isActive = currentEditor ? editor.editorInfo.id === currentViewType : false;
|
||||
const isDefault = editor.editorInfo.id === defaultViewType;
|
||||
const quickPickEntry: IQuickPickItem = {
|
||||
|
@ -578,7 +575,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
return undefined;
|
||||
}
|
||||
|
||||
private sendOverrideTelemetry(chosenInput: IContributedEditorInput): void {
|
||||
private sendOverrideTelemetry(chosenInput: IRegisteredEditorInput): void {
|
||||
type editorOverrideClassification = {
|
||||
viewType: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
|
||||
};
|
||||
|
@ -596,7 +593,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
|
|||
|
||||
// Store just the relative pattern pieces without any path info
|
||||
for (const [globPattern, contribPoint] of this._editors) {
|
||||
const nonOptional = !!contribPoint.find(c => c.editorInfo.priority !== ContributedEditorPriority.option && c.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id);
|
||||
const nonOptional = !!contribPoint.find(c => c.editorInfo.priority !== RegisteredEditorPriority.option && c.editorInfo.id !== DEFAULT_EDITOR_ASSOCIATION.id);
|
||||
// Don't keep a cache of the optional ones as those wouldn't be opened on start anyways
|
||||
if (!nonOptional) {
|
||||
continue;
|
||||
|
|
|
@ -34,7 +34,7 @@ import { Promises, timeout } from 'vs/base/common/async';
|
|||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { indexOfPath } from 'vs/base/common/extpath';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { ContributedEditorPriority, DEFAULT_EDITOR_ASSOCIATION, IEditorOverrideService, OverrideStatus } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority, DEFAULT_EDITOR_ASSOCIATION, IEditorOverrideService, OverrideStatus } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IWorkspaceTrustRequestService, WorkspaceTrustUriResponse } from 'vs/platform/workspace/common/workspaceTrust';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
|
@ -121,7 +121,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
|||
id: DEFAULT_EDITOR_ASSOCIATION.id,
|
||||
label: DEFAULT_EDITOR_ASSOCIATION.displayName,
|
||||
detail: DEFAULT_EDITOR_ASSOCIATION.providerDisplayName,
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
resource => ({ editor: this.createEditorInput({ resource }) }),
|
||||
|
|
|
@ -64,7 +64,7 @@ configurationRegistry.registerConfiguration(editorAssociationsConfigurationNode)
|
|||
//#endregion
|
||||
|
||||
//#region EditorOverrideService types
|
||||
export enum ContributedEditorPriority {
|
||||
export enum RegisteredEditorPriority {
|
||||
builtin = 'builtin',
|
||||
option = 'option',
|
||||
exclusive = 'exclusive',
|
||||
|
@ -100,11 +100,11 @@ export type RegisteredEditorOptions = {
|
|||
canSupportResource?: (resource: URI) => boolean;
|
||||
};
|
||||
|
||||
export type ContributedEditorInfo = {
|
||||
export type RegisteredEditorInfo = {
|
||||
id: string;
|
||||
label: string;
|
||||
detail?: string;
|
||||
priority: ContributedEditorPriority;
|
||||
priority: RegisteredEditorPriority;
|
||||
};
|
||||
|
||||
export type EditorInputFactoryFunction = (resource: URI, options: IEditorOptions | undefined, group: IEditorGroup) => IEditorInputWithOptions;
|
||||
|
@ -136,7 +136,7 @@ export interface IEditorOverrideService {
|
|||
*/
|
||||
registerEditor(
|
||||
globPattern: string | glob.IRelativePattern,
|
||||
editorInfo: ContributedEditorInfo,
|
||||
editorInfo: RegisteredEditorInfo,
|
||||
options: RegisteredEditorOptions,
|
||||
createEditorInput: EditorInputFactoryFunction,
|
||||
createDiffEditorInput?: DiffEditorInputFactoryFunction
|
||||
|
@ -162,16 +162,16 @@ export interface IEditorOverrideService {
|
|||
//#endregion
|
||||
|
||||
//#region Util functions
|
||||
export function priorityToRank(priority: ContributedEditorPriority): number {
|
||||
export function priorityToRank(priority: RegisteredEditorPriority): number {
|
||||
switch (priority) {
|
||||
case ContributedEditorPriority.exclusive:
|
||||
case RegisteredEditorPriority.exclusive:
|
||||
return 5;
|
||||
case ContributedEditorPriority.default:
|
||||
case RegisteredEditorPriority.default:
|
||||
return 4;
|
||||
case ContributedEditorPriority.builtin:
|
||||
case RegisteredEditorPriority.builtin:
|
||||
return 3;
|
||||
// Text editor is priority 2
|
||||
case ContributedEditorPriority.option:
|
||||
case RegisteredEditorPriority.option:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
|||
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { MockScopableContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
|
||||
import { ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IWorkspaceTrustRequestService, WorkspaceTrustUriResponse } from 'vs/platform/workspace/common/workspaceTrust';
|
||||
import { TestWorkspaceTrustRequestService } from 'vs/workbench/services/workspaces/test/common/testWorkspaceTrustService';
|
||||
import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput';
|
||||
|
@ -1131,7 +1131,7 @@ suite('EditorService', () => {
|
|||
id: 'TestEditor',
|
||||
label: 'Test Editor',
|
||||
detail: 'Test Editor Provider',
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource) => {
|
||||
|
@ -1166,7 +1166,7 @@ suite('EditorService', () => {
|
|||
id: 'TestEditor',
|
||||
label: 'Test Editor',
|
||||
detail: 'Test Editor Provider',
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource) => {
|
||||
|
@ -1197,7 +1197,7 @@ suite('EditorService', () => {
|
|||
id: 'TestEditor',
|
||||
label: 'Test Editor',
|
||||
detail: 'Test Editor Provider',
|
||||
priority: ContributedEditorPriority.builtin
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(resource) => {
|
||||
|
|
|
@ -129,10 +129,12 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork
|
|||
|
||||
private initializeWorkspaceTrust(): void {
|
||||
// Resolve canonical Uris
|
||||
this.resolveCanonicalUris().then(async () => {
|
||||
this.resolveCanonicalUris()
|
||||
.then(async () => {
|
||||
this._canonicalUrisResolved = true;
|
||||
await this.updateWorkspaceTrust();
|
||||
|
||||
})
|
||||
.finally(() => {
|
||||
this._workspaceResolvedPromiseResolve();
|
||||
if (!this.environmentService.remoteAuthority) {
|
||||
this._workspaceTrustInitializedPromiseResolve();
|
||||
|
@ -145,7 +147,8 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork
|
|||
.then(async result => {
|
||||
this._remoteAuthority = result;
|
||||
await this.updateWorkspaceTrust();
|
||||
|
||||
})
|
||||
.finally(() => {
|
||||
this._workspaceTrustInitializedPromiseResolve();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { AuthenticationProviderInformation } from 'vs/editor/common/modes';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { IQuickInputHideEvent, IQuickInputService, IQuickPickDidAcceptEvent } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { MainThreadAuthentication } from 'vs/workbench/api/browser/mainThreadAuthentication';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IActivityService } from 'vs/workbench/services/activity/common/activity';
|
||||
import { AuthenticationService, IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
|
||||
import { ExtensionHostKind, IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { TestRemoteAgentService } from 'vs/workbench/services/remote/test/common/testServices';
|
||||
import { TestQuickInputService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestActivityService, TestExtensionService, TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
|
||||
function createSession(id: string = '1234', scope: string[] = []) {
|
||||
return {
|
||||
accessToken: '1234',
|
||||
account: {
|
||||
id: 'test@test.com',
|
||||
label: 'Test Person'
|
||||
},
|
||||
id: id,
|
||||
scopes: scope
|
||||
};
|
||||
}
|
||||
|
||||
class AuthQuickPick {
|
||||
private listener: ((e: IQuickPickDidAcceptEvent) => any) | undefined;
|
||||
public items = [];
|
||||
public get selectedItems(): string[] {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
onDidAccept(listener: (e: IQuickPickDidAcceptEvent) => any) {
|
||||
this.listener = listener;
|
||||
}
|
||||
onDidHide(listener: (e: IQuickInputHideEvent) => any) {
|
||||
|
||||
}
|
||||
dispose() {
|
||||
|
||||
}
|
||||
show() {
|
||||
this.listener!({
|
||||
inBackground: false
|
||||
});
|
||||
}
|
||||
}
|
||||
class AuthTestQuickInputService extends TestQuickInputService {
|
||||
override createQuickPick() {
|
||||
return <any>new AuthQuickPick();
|
||||
}
|
||||
}
|
||||
|
||||
suite('MainThreadAuthentication', () => {
|
||||
let mainThreadAuthentication: MainThreadAuthentication;
|
||||
suiteSetup(async () => {
|
||||
// extHostContext: IExtHostContext,
|
||||
const services = new ServiceCollection();
|
||||
const dialogService = new TestDialogService();
|
||||
const storageService = new TestStorageService();
|
||||
const quickInputService = new AuthTestQuickInputService();
|
||||
const extensionService = new TestExtensionService();
|
||||
|
||||
const activityService = new TestActivityService();
|
||||
const remoteAgentService = new TestRemoteAgentService();
|
||||
|
||||
services.set(IDialogService, dialogService);
|
||||
services.set(IStorageService, storageService);
|
||||
services.set(INotificationService, new TestNotificationService());
|
||||
services.set(IQuickInputService, quickInputService);
|
||||
services.set(IExtensionService, extensionService);
|
||||
services.set(IActivityService, activityService);
|
||||
services.set(IRemoteAgentService, remoteAgentService);
|
||||
|
||||
const instaService = new InstantiationService(services);
|
||||
services.set(IAuthenticationService, instaService.createInstance(AuthenticationService));
|
||||
|
||||
mainThreadAuthentication = instaService.createInstance(MainThreadAuthentication,
|
||||
new class implements IExtHostContext {
|
||||
remoteAuthority = '';
|
||||
extensionHostKind = ExtensionHostKind.LocalProcess;
|
||||
assertRegistered() { }
|
||||
set(v: any): any { return null; }
|
||||
getProxy(): any {
|
||||
return {
|
||||
$getSessions(id: string, scopes: string[]) {
|
||||
return Promise.resolve([createSession(id, scopes)]);
|
||||
},
|
||||
$createSession(id: string, scopes: string[]) {
|
||||
return Promise.resolve(createSession(id, scopes));
|
||||
},
|
||||
$removeSession(id: string, sessionId: string) { return Promise.resolve(); },
|
||||
$onDidChangeAuthenticationSessions(id: string, label: string) { return Promise.resolve(); },
|
||||
$onDidChangeAuthenticationProviders(added: AuthenticationProviderInformation[], removed: AuthenticationProviderInformation[]) { return Promise.resolve(); },
|
||||
$setProviders(providers: AuthenticationProviderInformation[]) { return Promise.resolve(); }
|
||||
};
|
||||
}
|
||||
drain(): any { return null; }
|
||||
});
|
||||
|
||||
await mainThreadAuthentication.$registerAuthenticationProvider('test', 'test provider', true);
|
||||
});
|
||||
|
||||
suiteTeardown(() => {
|
||||
mainThreadAuthentication.$unregisterAuthenticationProvider('test');
|
||||
mainThreadAuthentication.dispose();
|
||||
});
|
||||
|
||||
test('Can get a session', async () => {
|
||||
const session = await mainThreadAuthentication.$getSession('test', ['foo'], 'testextension', 'test extension', { createIfNone: true, clearSessionPreference: false });
|
||||
assert.strictEqual(session?.id, 'test');
|
||||
assert.strictEqual(session?.scopes[0], 'foo');
|
||||
});
|
||||
});
|
|
@ -14,6 +14,8 @@ suite('Memento', () => {
|
|||
|
||||
setup(() => {
|
||||
storage = new TestStorageService();
|
||||
Memento.clear(StorageScope.GLOBAL);
|
||||
Memento.clear(StorageScope.WORKSPACE);
|
||||
});
|
||||
|
||||
test('Loading and Saving Memento with Scopes', () => {
|
||||
|
@ -176,4 +178,30 @@ suite('Memento', () => {
|
|||
memento = myMemento2.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
||||
assert.deepStrictEqual(memento, { foo: 'Hello World', bar: 'Hello World' });
|
||||
});
|
||||
|
||||
test('Clear Memento', () => {
|
||||
let myMemento = new Memento('memento.test', storage);
|
||||
|
||||
// Global
|
||||
let globalMemento = myMemento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
globalMemento.foo = 'Hello World';
|
||||
|
||||
// Workspace
|
||||
let workspaceMemento = myMemento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
||||
workspaceMemento.bar = 'Hello World';
|
||||
|
||||
myMemento.saveMemento();
|
||||
|
||||
// Clear
|
||||
storage = new TestStorageService();
|
||||
Memento.clear(StorageScope.GLOBAL);
|
||||
Memento.clear(StorageScope.WORKSPACE);
|
||||
|
||||
myMemento = new Memento('memento.test', storage);
|
||||
globalMemento = myMemento.getMemento(StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
workspaceMemento = myMemento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
||||
|
||||
assert.deepStrictEqual(globalMemento, {});
|
||||
assert.deepStrictEqual(workspaceMemento, {});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@ import { IFileStatWithMetadata } from 'vs/platform/files/common/files';
|
|||
import { ISaveOptions, IRevertOptions } from 'vs/workbench/common/editor';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IActivity, IActivityService } from 'vs/workbench/services/activity/common/activity';
|
||||
|
||||
export class TestTextResourcePropertiesService implements ITextResourcePropertiesService {
|
||||
|
||||
|
@ -214,3 +215,21 @@ export interface Ctor<T> {
|
|||
export class TestExtensionService extends NullExtensionService { }
|
||||
|
||||
export const TestProductService = { _serviceBrand: undefined, ...product };
|
||||
|
||||
export class TestActivityService implements IActivityService {
|
||||
_serviceBrand: undefined;
|
||||
showViewContainerActivity(viewContainerId: string, badge: IActivity): IDisposable {
|
||||
return this;
|
||||
}
|
||||
showViewActivity(viewId: string, badge: IActivity): IDisposable {
|
||||
return this;
|
||||
}
|
||||
showAccountsActivity(activity: IActivity): IDisposable {
|
||||
return this;
|
||||
}
|
||||
showGlobalActivity(activity: IActivity): IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
dispose() { }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue