Merge branch 'main' into tyriar/141009

This commit is contained in:
Daniel Imms 2022-02-17 13:28:51 -08:00 committed by GitHub
commit 16584bceb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 35 deletions

View file

@ -1153,13 +1153,6 @@ export interface ITextModel {
* @event * @event
*/ */
readonly onDidChangeContentOrInjectedText: Event<ModelRawContentChangedEvent | ModelInjectedTextChangedEvent>; readonly onDidChangeContentOrInjectedText: Event<ModelRawContentChangedEvent | ModelInjectedTextChangedEvent>;
/**
* @deprecated Please use `onDidChangeContent` instead.
* An event emitted when the contents of the model have changed.
* @internal
* @event
*/
readonly onDidChangeRawContent: Event<ModelRawContentChangedEvent>;
/** /**
* An event emitted when the contents of the model have changed. * An event emitted when the contents of the model have changed.
* @event * @event

View file

@ -245,12 +245,6 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
private readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>()); private readonly _onDidChangeInjectedText: Emitter<ModelInjectedTextChangedEvent> = this._register(new Emitter<ModelInjectedTextChangedEvent>());
private readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter()); private readonly _eventEmitter: DidChangeContentEmitter = this._register(new DidChangeContentEmitter());
public onDidChangeRawContent(listener: (e: ModelRawContentChangedEvent) => void): IDisposable {
return this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.rawContentChangedEvent));
}
public onDidChangeContentFast(listener: (e: IModelContentChangedEvent) => void): IDisposable {
return this._eventEmitter.fastEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));
}
public onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable { public onDidChangeContent(listener: (e: IModelContentChangedEvent) => void): IDisposable {
return this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent)); return this._eventEmitter.slowEvent((e: InternalModelContentChangeEvent) => listener(e.contentChangedEvent));
} }

View file

@ -993,7 +993,7 @@ suite('EditorModel - EditableTextModel.applyEdits', () => {
}, (model) => { }, (model) => {
let isFirstTime = true; let isFirstTime = true;
model.onDidChangeRawContent(() => { model.onDidChangeContent(() => {
if (!isFirstTime) { if (!isFirstTime) {
return; return;
} }

View file

@ -9,7 +9,7 @@ import { EditOperation } from 'vs/editor/common/core/editOperation';
import { Position } from 'vs/editor/common/core/position'; import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { TextModel } from 'vs/editor/common/model/textModel'; import { TextModel } from 'vs/editor/common/model/textModel';
import { ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from 'vs/editor/common/textModelEvents'; import { ModelInjectedTextChangedEvent, ModelRawContentChangedEvent, ModelRawFlush, ModelRawLineChanged, ModelRawLinesDeleted, ModelRawLinesInserted } from 'vs/editor/common/textModelEvents';
import { EncodedTokenizationResult, IState, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/languages'; import { EncodedTokenizationResult, IState, MetadataConsts, TokenizationRegistry } from 'vs/editor/common/languages';
import { LanguageConfigurationRegistry } from 'vs/editor/common/languages/languageConfigurationRegistry'; import { LanguageConfigurationRegistry } from 'vs/editor/common/languages/languageConfigurationRegistry';
import { NullState } from 'vs/editor/common/languages/nullTokenize'; import { NullState } from 'vs/editor/common/languages/nullTokenize';
@ -96,15 +96,15 @@ suite('Editor Model - Model', () => {
// --------- insert text eventing // --------- insert text eventing
test('model insert empty text does not trigger eventing', () => { test('model insert empty text does not trigger eventing', () => {
thisModel.onDidChangeRawContent((e) => { thisModel.onDidChangeContentOrInjectedText((e) => {
assert.ok(false, 'was not expecting event'); assert.ok(false, 'was not expecting event');
}); });
thisModel.applyEdits([EditOperation.insert(new Position(1, 1), '')]); thisModel.applyEdits([EditOperation.insert(new Position(1, 1), '')]);
}); });
test('model insert text without newline eventing', () => { test('model insert text without newline eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }
@ -122,8 +122,8 @@ suite('Editor Model - Model', () => {
}); });
test('model insert text with one newline eventing', () => { test('model insert text with one newline eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }
@ -192,15 +192,15 @@ suite('Editor Model - Model', () => {
// --------- delete text eventing // --------- delete text eventing
test('model delete empty text does not trigger eventing', () => { test('model delete empty text does not trigger eventing', () => {
thisModel.onDidChangeRawContent((e) => { thisModel.onDidChangeContentOrInjectedText((e) => {
assert.ok(false, 'was not expecting event'); assert.ok(false, 'was not expecting event');
}); });
thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 1))]); thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 1))]);
}); });
test('model delete text from one line eventing', () => { test('model delete text from one line eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }
@ -218,8 +218,8 @@ suite('Editor Model - Model', () => {
}); });
test('model delete all text from a line eventing', () => { test('model delete all text from a line eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }
@ -237,8 +237,8 @@ suite('Editor Model - Model', () => {
}); });
test('model delete text from two lines eventing', () => { test('model delete text from two lines eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }
@ -257,8 +257,8 @@ suite('Editor Model - Model', () => {
}); });
test('model delete text from many lines eventing', () => { test('model delete text from many lines eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }
@ -308,8 +308,8 @@ suite('Editor Model - Model', () => {
// --------- setValue // --------- setValue
test('setValue eventing', () => { test('setValue eventing', () => {
let e: ModelRawContentChangedEvent | null = null; let e: ModelRawContentChangedEvent | ModelInjectedTextChangedEvent | null = null;
thisModel.onDidChangeRawContent((_e) => { thisModel.onDidChangeContentOrInjectedText((_e) => {
if (e !== null) { if (e !== null) {
assert.fail('Unexpected assertion error'); assert.fail('Unexpected assertion error');
} }

View file

@ -442,7 +442,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this._xtermReadyPromise.then(async () => { this._xtermReadyPromise.then(async () => {
// Wait for a period to allow a container to be ready // Wait for a period to allow a container to be ready
await this._containerReadyBarrier.wait(); await this._containerReadyBarrier.wait();
if (this._configHelper.config.shellIntegration.enabled && !this.shellLaunchConfig.executable) { if (this._configHelper.config.shellIntegration?.enabled && !this.shellLaunchConfig.executable) {
const os = await this._processManager.getBackendOS(); const os = await this._processManager.getBackendOS();
this.shellLaunchConfig.executable = (await this._terminalProfileResolverService.getDefaultProfile({ remoteAuthority: this.remoteAuthority, os })).path; this.shellLaunchConfig.executable = (await this._terminalProfileResolverService.getDefaultProfile({ remoteAuthority: this.remoteAuthority, os })).path;
} }

View file

@ -243,7 +243,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
os: this.os os: this.os
}); });
try { try {
const shellIntegration = terminalEnvironment.injectShellIntegrationArgs(this._logService, this._configurationService, env, this._configHelper.config.shellIntegration.enabled, shellLaunchConfig, this.os); const shellIntegration = terminalEnvironment.injectShellIntegrationArgs(this._logService, this._configurationService, env, this._configHelper.config.shellIntegration?.enabled || false, shellLaunchConfig, this.os);
this.shellIntegrationAttempted = shellIntegration.enableShellIntegration; this.shellIntegrationAttempted = shellIntegration.enableShellIntegration;
if (this.shellIntegrationAttempted && shellIntegration.args) { if (this.shellIntegrationAttempted && shellIntegration.args) {
const remoteEnv = await this._remoteAgentService.getEnvironment(); const remoteEnv = await this._remoteAgentService.getEnvironment();
@ -448,7 +448,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
const env = await this._resolveEnvironment(backend, variableResolver, shellLaunchConfig); const env = await this._resolveEnvironment(backend, variableResolver, shellLaunchConfig);
const shellIntegration = terminalEnvironment.injectShellIntegrationArgs(this._logService, this._configurationService, env, this._configHelper.config.shellIntegration.enabled, shellLaunchConfig, OS); const shellIntegration = terminalEnvironment.injectShellIntegrationArgs(this._logService, this._configurationService, env, this._configHelper.config.shellIntegration?.enabled || false, shellLaunchConfig, OS);
if (shellIntegration.enableShellIntegration) { if (shellIntegration.enableShellIntegration) {
shellLaunchConfig.args = shellIntegration.args; shellLaunchConfig.args = shellIntegration.args;
// Always resolve the injected arguments on local processes // Always resolve the injected arguments on local processes

View file

@ -290,7 +290,7 @@ export interface ITerminalConfiguration {
persistentSessionReviveProcess: 'onExit' | 'onExitAndWindowClose' | 'never'; persistentSessionReviveProcess: 'onExit' | 'onExitAndWindowClose' | 'never';
ignoreProcessNames: string[]; ignoreProcessNames: string[];
autoReplies: { [key: string]: string }; autoReplies: { [key: string]: string };
shellIntegration: { shellIntegration?: {
enabled: boolean; enabled: boolean;
}; };
} }