mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-31 03:07:50 +01:00
This reverts commit 6336ee7530.
This commit is contained in:
@@ -705,7 +705,6 @@ class BranchNode implements ISplitView<ILayoutContext>, IDisposable {
|
||||
this.splitviewSashResetDisposable.dispose();
|
||||
this.childrenSashResetDisposable.dispose();
|
||||
this.childrenChangeDisposable.dispose();
|
||||
this.onDidScrollDisposable.dispose();
|
||||
this.splitview.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,11 +565,11 @@ export class SplitView<TLayoutContext = undefined> extends Disposable {
|
||||
this.sashContainer = append(this.el, $('.sash-container'));
|
||||
this.viewContainer = $('.split-view-container');
|
||||
|
||||
this.scrollable = this._register(new Scrollable({
|
||||
this.scrollable = new Scrollable({
|
||||
forceIntegerValues: true,
|
||||
smoothScrollDuration: 125,
|
||||
scheduleAtNextAnimationFrame
|
||||
}));
|
||||
});
|
||||
this.scrollableElement = this._register(new SmoothScrollableElement(this.viewContainer, {
|
||||
vertical: this.orientation === Orientation.VERTICAL ? (options.scrollbarVisibility ?? ScrollbarVisibility.Auto) : ScrollbarVisibility.Hidden,
|
||||
horizontal: this.orientation === Orientation.HORIZONTAL ? (options.scrollbarVisibility ?? ScrollbarVisibility.Auto) : ScrollbarVisibility.Hidden
|
||||
|
||||
@@ -212,7 +212,6 @@ export class ToolBar extends Disposable {
|
||||
|
||||
override dispose(): void {
|
||||
this.clear();
|
||||
this.disposables.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,14 +519,13 @@ export function consumeStream<T, R = T>(stream: ReadableStreamEvents<T>, reducer
|
||||
return new Promise((resolve, reject) => {
|
||||
const chunks: T[] = [];
|
||||
|
||||
const l = listenStream(stream, {
|
||||
listenStream(stream, {
|
||||
onData: chunk => {
|
||||
if (reducer) {
|
||||
chunks.push(chunk);
|
||||
}
|
||||
},
|
||||
onError: error => {
|
||||
l.dispose();
|
||||
if (reducer) {
|
||||
reject(error);
|
||||
} else {
|
||||
@@ -534,7 +533,6 @@ export function consumeStream<T, R = T>(stream: ReadableStreamEvents<T>, reducer
|
||||
}
|
||||
},
|
||||
onEnd: () => {
|
||||
l.dispose();
|
||||
if (reducer) {
|
||||
resolve(reducer(chunks));
|
||||
} else {
|
||||
@@ -572,18 +570,15 @@ export interface IStreamListener<T> {
|
||||
export function listenStream<T>(stream: ReadableStreamEvents<T>, listener: IStreamListener<T>): IDisposable {
|
||||
let destroyed = false;
|
||||
|
||||
// error and end events are in the next microtask so that a stream that is
|
||||
// closed synchronously (e.g from a memory `toStream`) can get its disposable
|
||||
// and destroy the stream.
|
||||
stream.on('error', error => {
|
||||
if (!destroyed) {
|
||||
queueMicrotask(() => listener.onError(error));
|
||||
listener.onError(error);
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('end', () => {
|
||||
if (!destroyed) {
|
||||
queueMicrotask(() => listener.onEnd());
|
||||
listener.onEnd();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -697,16 +692,10 @@ export function toReadable<T>(t: T): Readable<T> {
|
||||
export function transform<Original, Transformed>(stream: ReadableStreamEvents<Original>, transformer: ITransformer<Original, Transformed>, reducer: IReducer<Transformed>): ReadableStream<Transformed> {
|
||||
const target = newWriteableStream<Transformed>(reducer);
|
||||
|
||||
const l = listenStream(stream, {
|
||||
listenStream(stream, {
|
||||
onData: data => target.write(transformer.data(data)),
|
||||
onError: error => {
|
||||
l.dispose();
|
||||
target.error(transformer.error ? transformer.error(error) : error);
|
||||
},
|
||||
onEnd: () => {
|
||||
l.dispose();
|
||||
target.end();
|
||||
}
|
||||
onError: error => target.error(transformer.error ? transformer.error(error) : error),
|
||||
onEnd: () => target.end()
|
||||
});
|
||||
|
||||
return target;
|
||||
@@ -751,7 +740,7 @@ export function prefixedStream<T>(prefix: T, stream: ReadableStream<T>, reducer:
|
||||
|
||||
const target = newWriteableStream<T>(reducer);
|
||||
|
||||
const l = listenStream(stream, {
|
||||
listenStream(stream, {
|
||||
onData: data => {
|
||||
|
||||
// Handle prefix only once
|
||||
@@ -763,12 +752,8 @@ export function prefixedStream<T>(prefix: T, stream: ReadableStream<T>, reducer:
|
||||
|
||||
return target.write(data);
|
||||
},
|
||||
onError: error => {
|
||||
l.dispose();
|
||||
target.error(error);
|
||||
},
|
||||
onError: error => target.error(error),
|
||||
onEnd: () => {
|
||||
l.dispose();
|
||||
|
||||
// Handle prefix only once
|
||||
if (!prefixHandled) {
|
||||
|
||||
@@ -315,14 +315,14 @@ suite('Stream', () => {
|
||||
assert.strictEqual(consumed, undefined);
|
||||
});
|
||||
|
||||
test('listenStream', async () => {
|
||||
test('listenStream', () => {
|
||||
const stream = newWriteableStream<string>(strings => strings.join());
|
||||
|
||||
let error = false;
|
||||
let end = false;
|
||||
let data = '';
|
||||
|
||||
const l = listenStream(stream, {
|
||||
listenStream(stream, {
|
||||
onData: d => {
|
||||
data = d;
|
||||
},
|
||||
@@ -345,14 +345,10 @@ suite('Stream', () => {
|
||||
assert.strictEqual(end, false);
|
||||
|
||||
stream.error(new Error());
|
||||
await new Promise<void>(r => queueMicrotask(r));
|
||||
assert.strictEqual(error, true);
|
||||
|
||||
stream.end('Final Bit');
|
||||
await new Promise<void>(r => queueMicrotask(r));
|
||||
assert.strictEqual(end, true);
|
||||
|
||||
l.dispose();
|
||||
});
|
||||
|
||||
test('listenStream - dispose', () => {
|
||||
|
||||
@@ -35,8 +35,8 @@ export class DiffEditorEditors extends Disposable {
|
||||
) {
|
||||
super();
|
||||
|
||||
this.original = this._register(this._createLeftHandSideEditor(_options.editorOptions.get(), codeEditorWidgetOptions.originalEditor || {}));
|
||||
this.modified = this._register(this._createRightHandSideEditor(_options.editorOptions.get(), codeEditorWidgetOptions.modifiedEditor || {}));
|
||||
this.original = this._createLeftHandSideEditor(_options.editorOptions.get(), codeEditorWidgetOptions.originalEditor || {});
|
||||
this.modified = this._createRightHandSideEditor(_options.editorOptions.get(), codeEditorWidgetOptions.modifiedEditor || {});
|
||||
|
||||
this._register(autorunHandleChanges({
|
||||
createEmptyChangeSummary: () => ({} as IDiffEditorConstructionOptions),
|
||||
|
||||
@@ -67,21 +67,19 @@ export function createTextBufferFactoryFromStream(stream: ITextStream | VSBuffer
|
||||
|
||||
let done = false;
|
||||
|
||||
const l = listenStream<string | VSBuffer>(stream, {
|
||||
listenStream<string | VSBuffer>(stream, {
|
||||
onData: chunk => {
|
||||
builder.acceptChunk((typeof chunk === 'string') ? chunk : chunk.toString());
|
||||
},
|
||||
onError: error => {
|
||||
if (!done) {
|
||||
done = true;
|
||||
l.dispose();
|
||||
reject(error);
|
||||
}
|
||||
},
|
||||
onEnd: () => {
|
||||
if (!done) {
|
||||
done = true;
|
||||
l.dispose();
|
||||
resolve(builder.finish());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ export class SuggestController implements IEditorContribution {
|
||||
// context key: update insert/replace mode
|
||||
const ctxInsertMode = SuggestContext.InsertMode.bindTo(_contextKeyService);
|
||||
ctxInsertMode.set(editor.getOption(EditorOption.suggest).insertMode);
|
||||
this._toDispose.add(this.model.onDidTrigger(() => ctxInsertMode.set(editor.getOption(EditorOption.suggest).insertMode)));
|
||||
this.model.onDidTrigger(() => ctxInsertMode.set(editor.getOption(EditorOption.suggest).insertMode));
|
||||
|
||||
this.widget = this._toDispose.add(new IdleValue(() => {
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export class MenuWorkbenchButtonBar extends ButtonBar {
|
||||
'workbenchActionExecuted',
|
||||
{ id: e.action.id, from: options.telemetrySource! }
|
||||
);
|
||||
}, undefined, this._store);
|
||||
}, this._store);
|
||||
}
|
||||
|
||||
const conifgProvider: IButtonConfigProvider = options?.buttonConfigProvider ?? (() => ({ showLabel: true }));
|
||||
|
||||
@@ -20,16 +20,10 @@ export class ChecksumService implements IChecksumService {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const hash = createHash('md5');
|
||||
|
||||
const l = listenStream(stream, {
|
||||
listenStream(stream, {
|
||||
onData: data => hash.update(data.buffer),
|
||||
onError: error => {
|
||||
l.dispose();
|
||||
reject(error);
|
||||
},
|
||||
onEnd: () => {
|
||||
l.dispose();
|
||||
resolve(hash.digest('base64').replace(/=+$/, ''));
|
||||
}
|
||||
onError: error => reject(error),
|
||||
onEnd: () => resolve(hash.digest('base64').replace(/=+$/, ''))
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1228,7 +1228,7 @@ export class FileService extends Disposable implements IFileService {
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const l = listenStream(stream, {
|
||||
listenStream(stream, {
|
||||
onData: async chunk => {
|
||||
|
||||
// pause stream to perform async write operation
|
||||
@@ -1248,14 +1248,8 @@ export class FileService extends Disposable implements IFileService {
|
||||
// handler again before finishing.
|
||||
setTimeout(() => stream.resume());
|
||||
},
|
||||
onError: error => {
|
||||
l.dispose();
|
||||
reject(error);
|
||||
},
|
||||
onEnd: () => {
|
||||
l.dispose();
|
||||
resolve();
|
||||
}
|
||||
onError: error => reject(error),
|
||||
onEnd: () => resolve()
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,19 +106,16 @@ export abstract class AbstractDiskFileSystemProviderChannel<T> extends Disposabl
|
||||
|
||||
// Ensure to cancel the read operation when there is no more
|
||||
// listener on the other side to prevent unneeded work.
|
||||
cts.dispose(true);
|
||||
cts.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
const fileStream = this.provider.readFileStream(resource, opts, cts.token);
|
||||
const l = listenStream(fileStream, {
|
||||
listenStream(fileStream, {
|
||||
onData: chunk => emitter.fire(VSBuffer.wrap(chunk)),
|
||||
onError: error => {
|
||||
l.dispose();
|
||||
emitter.fire(error);
|
||||
},
|
||||
onError: error => emitter.fire(error),
|
||||
onEnd: () => {
|
||||
l.dispose();
|
||||
|
||||
// Forward event
|
||||
emitter.fire('end');
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ITreeDragOverReaction } from 'vs/base/browser/ui/tree/tree';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { UriList, VSDataTransfer } from 'vs/base/common/dataTransfer';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { Disposable, DisposableStore, IDisposable, markAsSingleton } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { stringify } from 'vs/base/common/marshalling';
|
||||
import { Mimes } from 'vs/base/common/mime';
|
||||
import { FileAccess, Schemas } from 'vs/base/common/network';
|
||||
@@ -427,10 +427,8 @@ export class CompositeDragAndDropObserver extends Disposable {
|
||||
static get INSTANCE(): CompositeDragAndDropObserver {
|
||||
if (!CompositeDragAndDropObserver.instance) {
|
||||
CompositeDragAndDropObserver.instance = new CompositeDragAndDropObserver();
|
||||
markAsSingleton(CompositeDragAndDropObserver.instance);
|
||||
}
|
||||
|
||||
|
||||
return CompositeDragAndDropObserver.instance;
|
||||
}
|
||||
|
||||
@@ -525,7 +523,7 @@ export class CompositeDragAndDropObserver extends Disposable {
|
||||
if (callbacks.onDragEnd) {
|
||||
this.onDragEnd.event(e => {
|
||||
callbacks.onDragEnd!(e);
|
||||
}, this, disposableStore);
|
||||
});
|
||||
}
|
||||
|
||||
return this._register(disposableStore);
|
||||
|
||||
@@ -244,7 +244,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
|
||||
const groupEditorsCountContext = EditorGroupEditorsCountContext.bindTo(this.scopedContextKeyService);
|
||||
const groupLockedContext = ActiveEditorGroupLockedContext.bindTo(this.scopedContextKeyService);
|
||||
|
||||
const activeEditorListener = this._register(new MutableDisposable());
|
||||
const activeEditorListener = new MutableDisposable();
|
||||
|
||||
const observeActiveEditor = () => {
|
||||
activeEditorListener.clear();
|
||||
|
||||
@@ -90,7 +90,7 @@ export class EditorGroupWatermark extends Disposable {
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
|
||||
this.lifecycleService.onDidShutdown(() => this.dispose());
|
||||
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('workbench.tips.enabled')) {
|
||||
|
||||
@@ -184,7 +184,7 @@ export class TabsTitleControl extends TitleControl {
|
||||
this.updateTabSizing(false);
|
||||
|
||||
// Tabs Scrollbar
|
||||
this.tabsScrollbar = this.createTabsScrollbar(this.tabsContainer);
|
||||
this.tabsScrollbar = this._register(this.createTabsScrollbar(this.tabsContainer));
|
||||
this.tabsAndActionsContainer.appendChild(this.tabsScrollbar.getDomNode());
|
||||
|
||||
// Tabs Container listeners
|
||||
@@ -206,19 +206,19 @@ export class TabsTitleControl extends TitleControl {
|
||||
}
|
||||
|
||||
private createTabsScrollbar(scrollable: HTMLElement): ScrollableElement {
|
||||
const tabsScrollbar = this._register(new ScrollableElement(scrollable, {
|
||||
const tabsScrollbar = new ScrollableElement(scrollable, {
|
||||
horizontal: ScrollbarVisibility.Auto,
|
||||
horizontalScrollbarSize: this.getTabsScrollbarSizing(),
|
||||
vertical: ScrollbarVisibility.Hidden,
|
||||
scrollYToX: true,
|
||||
useShadows: false
|
||||
}));
|
||||
});
|
||||
|
||||
this._register(tabsScrollbar.onScroll(e => {
|
||||
tabsScrollbar.onScroll(e => {
|
||||
if (e.scrollLeftChanged) {
|
||||
scrollable.scrollLeft = e.scrollLeft;
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
return tabsScrollbar;
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ export class EditorGroupModel extends Disposable {
|
||||
}
|
||||
|
||||
private registerEditorListeners(editor: EditorInput): void {
|
||||
const listeners = this._register(new DisposableStore());
|
||||
const listeners = new DisposableStore();
|
||||
|
||||
// Re-emit disposal of editor input as our own event
|
||||
listeners.add(Event.once(editor.onWillDispose)(() => {
|
||||
|
||||
@@ -47,7 +47,7 @@ export class TextFileEditorTracker extends Disposable implements IWorkbenchContr
|
||||
this._register(this.hostService.onDidChangeFocus(hasFocus => hasFocus ? this.reloadVisibleTextFileEditors() : undefined));
|
||||
|
||||
// Lifecycle
|
||||
this._register(this.lifecycleService.onDidShutdown(() => this.dispose()));
|
||||
this.lifecycleService.onDidShutdown(() => this.dispose());
|
||||
}
|
||||
|
||||
//#region Text File: Ensure every dirty text and untitled file is opened in an editor
|
||||
|
||||
@@ -77,7 +77,6 @@ suite('Files - TextFileEditorTracker', () => {
|
||||
instantiationService.stub(IWorkspaceTrustRequestService, new TestWorkspaceTrustRequestService(false));
|
||||
|
||||
const editorService: EditorService = instantiationService.createInstance(EditorService);
|
||||
disposables.add(editorService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
|
||||
const accessor = instantiationService.createInstance(TestServiceAccessor);
|
||||
@@ -94,7 +93,6 @@ suite('Files - TextFileEditorTracker', () => {
|
||||
const resource = toResource.call(this, '/path/index.txt');
|
||||
|
||||
const model = await accessor.textFileService.files.resolve(resource) as IResolvedTextFileEditorModel;
|
||||
disposables.add(model);
|
||||
|
||||
model.textEditorModel.setValue('Super Good');
|
||||
assert.strictEqual(snapshotToString(model.createSnapshot()!), 'Super Good');
|
||||
@@ -143,7 +141,6 @@ suite('Files - TextFileEditorTracker', () => {
|
||||
}
|
||||
|
||||
const model = await accessor.textFileService.files.resolve(resource) as IResolvedTextFileEditorModel;
|
||||
disposables.add(model);
|
||||
|
||||
model.textEditorModel.setValue('Super Good');
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ export class InlineChatController implements IEditorContribution {
|
||||
|
||||
private _messages = this._store.add(new Emitter<Message>());
|
||||
|
||||
private readonly _sessionStore: DisposableStore = this._store.add(new DisposableStore());
|
||||
private readonly _sessionStore: DisposableStore = new DisposableStore();
|
||||
private readonly _stashedSession: MutableDisposable<StashedSession> = this._store.add(new MutableDisposable());
|
||||
private _activeSession?: Session;
|
||||
private _strategy?: EditModeStrategy;
|
||||
@@ -146,7 +146,6 @@ export class InlineChatController implements IEditorContribution {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this._strategy?.dispose();
|
||||
this._stashedSession.clear();
|
||||
this.finishExistingSession();
|
||||
this._store.dispose();
|
||||
|
||||
@@ -385,8 +385,6 @@ export interface IInlineChatSessionService {
|
||||
//
|
||||
|
||||
recordings(): readonly Recording[];
|
||||
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
type SessionData = {
|
||||
|
||||
@@ -230,7 +230,7 @@ export class InlineChatWidget {
|
||||
}));
|
||||
|
||||
const uri = URI.from({ scheme: 'vscode', authority: 'inline-chat', path: `/inline-chat/model${InlineChatWidget._modelPool++}.txt` });
|
||||
this._inputModel = this._store.add(this._modelService.getModel(uri) ?? this._modelService.createModel('', null, uri));
|
||||
this._inputModel = this._modelService.getModel(uri) ?? this._modelService.createModel('', null, uri);
|
||||
this._inputEditor.setModel(this._inputModel);
|
||||
|
||||
// --- context keys
|
||||
@@ -359,13 +359,13 @@ export class InlineChatWidget {
|
||||
this._store.add(feedbackToolbar);
|
||||
|
||||
// preview editors
|
||||
this._previewDiffEditor = this._store.add(new IdleValue(() => this._store.add(_instantiationService.createInstance(EmbeddedDiffEditorWidget2, this._elements.previewDiff, {
|
||||
this._previewDiffEditor = new IdleValue(() => this._store.add(_instantiationService.createInstance(EmbeddedDiffEditorWidget2, this._elements.previewDiff, {
|
||||
..._previewEditorEditorOptions,
|
||||
onlyShowAccessibleDiffViewer: this._accessibilityService.isScreenReaderOptimized(),
|
||||
}, { modifiedEditor: codeEditorWidgetOptions, originalEditor: codeEditorWidgetOptions }, parentEditor))));
|
||||
}, { modifiedEditor: codeEditorWidgetOptions, originalEditor: codeEditorWidgetOptions }, parentEditor)));
|
||||
|
||||
this._previewCreateTitle = this._store.add(_instantiationService.createInstance(ResourceLabel, this._elements.previewCreateTitle, { supportIcons: true }));
|
||||
this._previewCreateEditor = this._store.add(new IdleValue(() => this._store.add(_instantiationService.createInstance(EmbeddedCodeEditorWidget, this._elements.previewCreate, _previewEditorEditorOptions, codeEditorWidgetOptions, parentEditor))));
|
||||
this._previewCreateEditor = new IdleValue(() => this._store.add(_instantiationService.createInstance(EmbeddedCodeEditorWidget, this._elements.previewCreate, _previewEditorEditorOptions, codeEditorWidgetOptions, parentEditor)));
|
||||
|
||||
this._elements.message.tabIndex = 0;
|
||||
this._elements.message.ariaLabel = this._accessibleViewService.getOpenAriaHint(AccessibilityVerbositySettingId.InlineChat);
|
||||
|
||||
@@ -24,6 +24,7 @@ import { IEditorProgressService, IProgressRunner } from 'vs/platform/progress/co
|
||||
import { mock } from 'vs/base/test/common/mock';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { IChatAccessibilityService } from 'vs/workbench/contrib/chat/browser/chat';
|
||||
import { IChatResponseViewModel } from 'vs/workbench/contrib/chat/common/chatViewModel';
|
||||
import { IAccessibleViewService } from 'vs/workbench/contrib/accessibility/browser/accessibleView';
|
||||
@@ -113,11 +114,11 @@ suite('InteractiveChatController', function () {
|
||||
}]
|
||||
);
|
||||
|
||||
instaService = store.add(workbenchInstantiationService(undefined, store).createChild(serviceCollection));
|
||||
inlineChatSessionService = store.add(instaService.get(IInlineChatSessionService));
|
||||
instaService = workbenchInstantiationService(undefined, store).createChild(serviceCollection);
|
||||
inlineChatSessionService = instaService.get(IInlineChatSessionService);
|
||||
|
||||
model = store.add(instaService.get(IModelService).createModel('Hello\nWorld\nHello Again\nHello World\n', null));
|
||||
editor = store.add(instantiateTestCodeEditor(instaService, model));
|
||||
model = instaService.get(IModelService).createModel('Hello\nWorld\nHello Again\nHello World\n', null);
|
||||
editor = instantiateTestCodeEditor(instaService, model);
|
||||
|
||||
store.add(inlineChatService.addProvider({
|
||||
debugName: 'Unit Test',
|
||||
@@ -141,6 +142,8 @@ suite('InteractiveChatController', function () {
|
||||
});
|
||||
|
||||
teardown(function () {
|
||||
editor.dispose();
|
||||
model.dispose();
|
||||
store.clear();
|
||||
ctrl?.dispose();
|
||||
});
|
||||
@@ -292,8 +295,19 @@ suite('InteractiveChatController', function () {
|
||||
wholeRange: new Range(3, 1, 3, 3)
|
||||
};
|
||||
},
|
||||
provideResponse(session, request) {
|
||||
return new Promise<never>(() => { });
|
||||
async provideResponse(session, request) {
|
||||
|
||||
// SLOW response
|
||||
await timeout(50000);
|
||||
|
||||
return {
|
||||
type: InlineChatResponseType.EditorEdit,
|
||||
id: Math.random(),
|
||||
edits: [{
|
||||
range: new Range(1, 1, 1, 1), // EDIT happens outside of whole range
|
||||
text: `${request.prompt}\n${request.prompt}`
|
||||
}]
|
||||
};
|
||||
}
|
||||
});
|
||||
store.add(d);
|
||||
|
||||
@@ -8,7 +8,6 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { IMarker, MarkerSeverity, IRelatedInformation } from 'vs/platform/markers/common/markers';
|
||||
import { MarkersModel, Marker, ResourceMarkers, RelatedInformation } from 'vs/workbench/contrib/markers/browser/markersModel';
|
||||
import { groupBy } from 'vs/base/common/collections';
|
||||
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
|
||||
|
||||
class TestMarkersModel extends MarkersModel {
|
||||
|
||||
@@ -28,8 +27,6 @@ class TestMarkersModel extends MarkersModel {
|
||||
|
||||
suite('MarkersModel Test', () => {
|
||||
|
||||
ensureNoDisposablesAreLeakedInTestSuite();
|
||||
|
||||
test('marker ids are unique', function () {
|
||||
const marker1 = anErrorWithRange(3);
|
||||
const marker2 = anErrorWithRange(3);
|
||||
|
||||
@@ -25,8 +25,8 @@ export class CodeEditorService extends AbstractCodeEditorService {
|
||||
) {
|
||||
super(themeService);
|
||||
|
||||
this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditor.bind(this)));
|
||||
this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditorFromDiff.bind(this)));
|
||||
this.registerCodeEditorOpenHandler(this.doOpenCodeEditor.bind(this));
|
||||
this.registerCodeEditorOpenHandler(this.doOpenCodeEditorFromDiff.bind(this));
|
||||
}
|
||||
|
||||
getActiveCodeEditor(): ICodeEditor | null {
|
||||
|
||||
@@ -83,9 +83,9 @@ export class EditorService extends Disposable implements EditorServiceImpl {
|
||||
|
||||
// Editor & group changes
|
||||
this.editorGroupService.whenReady.then(() => this.onEditorGroupsReady());
|
||||
this._register(this.editorGroupService.onDidChangeActiveGroup(group => this.handleActiveEditorChange(group)));
|
||||
this._register(this.editorGroupService.onDidAddGroup(group => this.registerGroupListeners(group as IEditorGroupView)));
|
||||
this._register(this.editorsObserver.onDidMostRecentlyActiveEditorsChange(() => this._onDidMostRecentlyActiveEditorsChange.fire()));
|
||||
this.editorGroupService.onDidChangeActiveGroup(group => this.handleActiveEditorChange(group));
|
||||
this.editorGroupService.onDidAddGroup(group => this.registerGroupListeners(group as IEditorGroupView));
|
||||
this.editorsObserver.onDidMostRecentlyActiveEditorsChange(() => this._onDidMostRecentlyActiveEditorsChange.fire());
|
||||
|
||||
// Out of workspace file watchers
|
||||
this._register(this.onDidVisibleEditorsChange(() => this.handleVisibleEditorsChange()));
|
||||
|
||||
@@ -54,7 +54,7 @@ export class BrowserTextFileService extends AbstractTextFileService {
|
||||
private registerListeners(): void {
|
||||
|
||||
// Lifecycle
|
||||
this._register(this.lifecycleService.onBeforeShutdown(event => event.veto(this.onBeforeShutdown(), 'veto.textFiles')));
|
||||
this.lifecycleService.onBeforeShutdown(event => event.veto(this.onBeforeShutdown(), 'veto.textFiles'));
|
||||
}
|
||||
|
||||
private onBeforeShutdown(): boolean {
|
||||
|
||||
@@ -89,7 +89,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
|
||||
private provideDecorations(): void {
|
||||
|
||||
// Text file model decorations
|
||||
const provider = new class extends Disposable implements IDecorationsProvider {
|
||||
this.decorationsService.registerDecorationsProvider(new class extends Disposable implements IDecorationsProvider {
|
||||
|
||||
readonly label = localize('textFileModelDecorations', "Text File Model Decorations");
|
||||
|
||||
@@ -160,10 +160,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}(this.files);
|
||||
|
||||
this._register(provider);
|
||||
this._register(this.decorationsService.registerDecorationsProvider(provider));
|
||||
}(this.files));
|
||||
}
|
||||
|
||||
//#endregin
|
||||
|
||||
@@ -60,14 +60,11 @@ export class TextFileSaveParticipant extends Disposable {
|
||||
model.textEditorModel?.pushStackElement();
|
||||
}, () => {
|
||||
// user cancel
|
||||
cts.cancel();
|
||||
}).finally(() => {
|
||||
cts.dispose();
|
||||
cts.dispose(true);
|
||||
});
|
||||
}
|
||||
|
||||
override dispose(): void {
|
||||
this.saveParticipants.splice(0, this.saveParticipants.length);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,8 +638,8 @@ suite('Files - TextFileEditorModel', () => {
|
||||
});
|
||||
|
||||
test('save() and isDirty() - proper with check for mtimes', async function () {
|
||||
const input1 = disposables.add(createFileEditorInput(instantiationService, toResource.call(this, '/path/index_async2.txt')));
|
||||
const input2 = disposables.add(createFileEditorInput(instantiationService, toResource.call(this, '/path/index_async.txt')));
|
||||
const input1 = createFileEditorInput(instantiationService, toResource.call(this, '/path/index_async2.txt'));
|
||||
const input2 = createFileEditorInput(instantiationService, toResource.call(this, '/path/index_async.txt'));
|
||||
|
||||
const model1 = await input1.resolve() as TextFileEditorModel;
|
||||
const model2 = await input2.resolve() as TextFileEditorModel;
|
||||
|
||||
@@ -69,6 +69,5 @@ export class StoredFileWorkingCopySaveParticipant extends Disposable {
|
||||
|
||||
override dispose(): void {
|
||||
this.saveParticipants.splice(0, this.saveParticipants.length);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,5 @@ export class WorkingCopyFileOperationParticipant extends Disposable {
|
||||
|
||||
override dispose(): void {
|
||||
this.participants.clear();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,16 +283,15 @@ export function workbenchInstantiationService(
|
||||
instantiationService.stub(IUndoRedoService, instantiationService.createInstance(UndoRedoService));
|
||||
const themeService = new TestThemeService();
|
||||
instantiationService.stub(IThemeService, themeService);
|
||||
instantiationService.stub(ILanguageConfigurationService, disposables.add(new TestLanguageConfigurationService()));
|
||||
instantiationService.stub(ILanguageConfigurationService, new TestLanguageConfigurationService());
|
||||
instantiationService.stub(IModelService, disposables.add(instantiationService.createInstance(ModelService)));
|
||||
const fileService = overrides?.fileService ? overrides.fileService(instantiationService) : new TestFileService();
|
||||
instantiationService.stub(IFileService, fileService);
|
||||
const uriIdentityService = new UriIdentityService(fileService);
|
||||
disposables.add(uriIdentityService);
|
||||
instantiationService.stub(IFilesConfigurationService, disposables.add(new TestFilesConfigurationService(contextKeyService, configService, workspaceContextService, environmentService, uriIdentityService, fileService)));
|
||||
instantiationService.stub(IUriIdentityService, uriIdentityService);
|
||||
const userDataProfilesService = instantiationService.stub(IUserDataProfilesService, disposables.add(new UserDataProfilesService(environmentService, fileService, uriIdentityService, new NullLogService())));
|
||||
instantiationService.stub(IUserDataProfileService, disposables.add(new UserDataProfileService(userDataProfilesService.defaultProfile, userDataProfilesService)));
|
||||
const userDataProfilesService = instantiationService.stub(IUserDataProfilesService, new UserDataProfilesService(environmentService, fileService, uriIdentityService, new NullLogService()));
|
||||
instantiationService.stub(IUserDataProfileService, new UserDataProfileService(userDataProfilesService.defaultProfile, userDataProfilesService));
|
||||
instantiationService.stub(IWorkingCopyBackupService, overrides?.workingCopyBackupService ? overrides?.workingCopyBackupService(instantiationService) : new TestWorkingCopyBackupService());
|
||||
instantiationService.stub(ITelemetryService, NullTelemetryService);
|
||||
instantiationService.stub(INotificationService, new TestNotificationService());
|
||||
@@ -306,7 +305,7 @@ export function workbenchInstantiationService(
|
||||
instantiationService.stub(ITextFileService, overrides?.textFileService ? overrides.textFileService(instantiationService) : disposables.add(<ITextFileService>instantiationService.createInstance(TestTextFileService)));
|
||||
instantiationService.stub(IHostService, <IHostService>instantiationService.createInstance(TestHostService));
|
||||
instantiationService.stub(ITextModelService, <ITextModelService>disposables.add(instantiationService.createInstance(TextModelResolverService)));
|
||||
instantiationService.stub(ILoggerService, disposables.add(new TestLoggerService(TestEnvironmentService.logsHome)));
|
||||
instantiationService.stub(ILoggerService, new TestLoggerService(TestEnvironmentService.logsHome));
|
||||
instantiationService.stub(ILogService, new NullLogService());
|
||||
const editorGroupService = new TestEditorGroupsService([new TestEditorGroupView(0)]);
|
||||
instantiationService.stub(IEditorGroupsService, editorGroupService);
|
||||
@@ -315,10 +314,10 @@ export function workbenchInstantiationService(
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
instantiationService.stub(IWorkingCopyEditorService, disposables.add(instantiationService.createInstance(WorkingCopyEditorService)));
|
||||
instantiationService.stub(IEditorResolverService, disposables.add(instantiationService.createInstance(EditorResolverService)));
|
||||
const textEditorService = overrides?.textEditorService ? overrides.textEditorService(instantiationService) : disposables.add(instantiationService.createInstance(TextEditorService));
|
||||
const textEditorService = overrides?.textEditorService ? overrides.textEditorService(instantiationService) : instantiationService.createInstance(TextEditorService);
|
||||
instantiationService.stub(ITextEditorService, textEditorService);
|
||||
instantiationService.stub(ICodeEditorService, disposables.add(new CodeEditorService(editorService, themeService, configService)));
|
||||
instantiationService.stub(IPaneCompositePartService, disposables.add(new TestPaneCompositeService()));
|
||||
instantiationService.stub(IPaneCompositePartService, new TestPaneCompositeService());
|
||||
instantiationService.stub(IListService, new TestListService());
|
||||
const hoverService = instantiationService.stub(IHoverService, instantiationService.createInstance(TestHoverService));
|
||||
instantiationService.stub(IQuickInputService, disposables.add(new QuickInputService(configService, instantiationService, keybindingService, contextKeyService, themeService, layoutService, hoverService)));
|
||||
|
||||
Reference in New Issue
Block a user