Merge from vscode 10492ba146318412cbee8b76a8c630f226914734

This commit is contained in:
ADS Merger
2020-04-08 06:33:38 +00:00
parent fca2344c2e
commit 1868a7d370
339 changed files with 3795 additions and 3146 deletions

View File

@@ -168,7 +168,7 @@ export function workbenchInstantiationService(overrides?: { textFileService?: (i
instantiationService.stub(ICodeEditorService, new CodeEditorService(editorService, themeService));
instantiationService.stub(IViewletService, new TestViewletService());
instantiationService.stub(IListService, new TestListService());
instantiationService.stub(IQuickInputService, new QuickInputService(TestEnvironmentService, configService, instantiationService, keybindingService, contextKeyService, themeService, accessibilityService, layoutService));
instantiationService.stub(IQuickInputService, new QuickInputService(configService, instantiationService, keybindingService, contextKeyService, themeService, accessibilityService, layoutService));
instantiationService.stub(IStorageKeysSyncRegistryService, new StorageKeysSyncRegistryService());
return instantiationService;
@@ -261,7 +261,11 @@ export class TestTextFileService extends BrowserTextFileService {
}
}
export const TestEnvironmentService = new BrowserWorkbenchEnvironmentService(Object.create(null));
class TestEnvironmentServiceWithArgs extends BrowserWorkbenchEnvironmentService {
args = [];
}
export const TestEnvironmentService = new TestEnvironmentServiceWithArgs(Object.create(null));
export class TestProgressService implements IProgressService {
@@ -1105,7 +1109,8 @@ export class TestRemotePathService implements IRemotePathService {
get path() { return Promise.resolve(isWindows ? win32 : posix); }
get userHome() { return Promise.resolve(URI.file(this.environmentService.userHome)); }
get userHome() { return Promise.resolve(this.environmentService.userHome!); }
get userHomeSync() { return this.environmentService.userHome; }
async fileURI(path: string): Promise<URI> {
return URI.file(path);

View File

@@ -5,6 +5,7 @@
import * as assert from 'assert';
import { IFullSemanticTokensDto, IDeltaSemanticTokensDto, encodeSemanticTokensDto, ISemanticTokensDto, decodeSemanticTokensDto } from 'vs/workbench/api/common/shared/semanticTokensDto';
import { VSBuffer } from 'vs/base/common/buffer';
suite('SemanticTokensDto', () => {
@@ -107,4 +108,29 @@ suite('SemanticTokensDto', () => {
});
});
test('issue #94521: unusual backing array buffer', () => {
function wrapAndSliceUint8Arry(buff: Uint8Array, prefixLength: number, suffixLength: number): Uint8Array {
const wrapped = new Uint8Array(prefixLength + buff.byteLength + suffixLength);
wrapped.set(buff, prefixLength);
return wrapped.subarray(prefixLength, prefixLength + buff.byteLength);
}
function wrapAndSlice(buff: VSBuffer, prefixLength: number, suffixLength: number): VSBuffer {
return VSBuffer.wrap(wrapAndSliceUint8Arry(buff.buffer, prefixLength, suffixLength));
}
const dto: ISemanticTokensDto = {
id: 5,
type: 'full',
data: new Uint32Array([1, 2, 3, 4, 5])
};
const encoded = encodeSemanticTokensDto(dto);
// with misaligned prefix and misaligned suffix
assertEqualFull(<IFullSemanticTokensDto>decodeSemanticTokensDto(wrapAndSlice(encoded, 1, 1)), dto);
// with misaligned prefix and aligned suffix
assertEqualFull(<IFullSemanticTokensDto>decodeSemanticTokensDto(wrapAndSlice(encoded, 1, 4)), dto);
// with aligned prefix and misaligned suffix
assertEqualFull(<IFullSemanticTokensDto>decodeSemanticTokensDto(wrapAndSlice(encoded, 4, 1)), dto);
// with aligned prefix and aligned suffix
assertEqualFull(<IFullSemanticTokensDto>decodeSemanticTokensDto(wrapAndSlice(encoded, 4, 4)), dto);
});
});

View File

@@ -25,7 +25,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import { URI } from 'vs/base/common/uri';
import { IReadTextFileOptions, ITextFileStreamContent, ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { createTextBufferFactoryFromStream } from 'vs/editor/common/model/textModel';
import { IOpenedWindow, IOpenEmptyWindowOptions, IWindowOpenable, IOpenWindowOptions } from 'vs/platform/windows/common/windows';
import { IOpenEmptyWindowOptions, IWindowOpenable, IOpenWindowOptions } from 'vs/platform/windows/common/windows';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { LogLevel, ILogService } from 'vs/platform/log/common/log';
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
@@ -37,7 +37,7 @@ import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { NodeTestBackupFileService } from 'vs/workbench/services/backup/test/electron-browser/backupFileService.test';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { INativeWindowConfiguration } from 'vs/platform/windows/node/window';
import { INativeWindowConfiguration, IOpenedWindow } from 'vs/platform/windows/node/window';
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
export const TestWindowConfiguration: INativeWindowConfiguration = {