Skip to content

Commit

Permalink
parse through typescript compiler wide-berth
Browse files Browse the repository at this point in the history
Signed-off-by: Nikola Hristov <[email protected]>
  • Loading branch information
NikolaRHristov committed Nov 6, 2024
1 parent 9a7e64b commit ee72818
Show file tree
Hide file tree
Showing 625 changed files with 77,697 additions and 92,144 deletions.
16 changes: 10 additions & 6 deletions Source/vs/base/browser/ui/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,16 @@ export class Button extends Disposable implements IButton {
}));
// Also set hover background when button is focused for feedback
this.focusTracker = this._register(trackFocus(this._element));
this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) {
this.updateBackground(true);
} }));
this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) {
this.updateBackground(false);
} }));
this._register(this.focusTracker.onDidFocus(() => {
if (this.enabled) {
this.updateBackground(true);
}
}));
this._register(this.focusTracker.onDidBlur(() => {
if (this.enabled) {
this.updateBackground(false);
}
}));
}
public override dispose(): void {
super.dispose();
Expand Down
16 changes: 10 additions & 6 deletions Source/vs/base/browser/ui/tree/abstractTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2137,14 +2137,18 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
private readonly _onWillRefilter = new Emitter<void>();
readonly onWillRefilter: Event<void> = this._onWillRefilter.event;
get findMode(): TreeFindMode { return this.findController?.mode ?? TreeFindMode.Highlight; }
set findMode(findMode: TreeFindMode) { if (this.findController) {
this.findController.mode = findMode;
} }
set findMode(findMode: TreeFindMode) {
if (this.findController) {
this.findController.mode = findMode;
}
}
readonly onDidChangeFindMode: Event<TreeFindMode>;
get findMatchType(): TreeFindMatchType { return this.findController?.matchType ?? TreeFindMatchType.Fuzzy; }
set findMatchType(findFuzzy: TreeFindMatchType) { if (this.findController) {
this.findController.matchType = findFuzzy;
} }
set findMatchType(findFuzzy: TreeFindMatchType) {
if (this.findController) {
this.findController.matchType = findFuzzy;
}
}
readonly onDidChangeFindMatchType: Event<TreeFindMatchType>;
get onDidChangeFindPattern(): Event<string> { return this.findController ? this.findController.onDidChangePattern : Event.None; }
get expandOnDoubleClick(): boolean { return typeof this._options.expandOnDoubleClick === 'undefined' ? true : this._options.expandOnDoubleClick; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ export class DiffEditorViewZones extends Disposable {
const updateImmediately = this._register(new RunOnceScheduler(() => {
state.set(state.get() + 1, undefined);
}, 0));
this._register(this._editors.original.onDidChangeViewZones((_args) => { if (!this._canIgnoreViewZoneUpdateEvent()) {
updateImmediately.schedule();
} }));
this._register(this._editors.modified.onDidChangeViewZones((_args) => { if (!this._canIgnoreViewZoneUpdateEvent()) {
updateImmediately.schedule();
} }));
this._register(this._editors.original.onDidChangeViewZones((_args) => {
if (!this._canIgnoreViewZoneUpdateEvent()) {
updateImmediately.schedule();
}
}));
this._register(this._editors.modified.onDidChangeViewZones((_args) => {
if (!this._canIgnoreViewZoneUpdateEvent()) {
updateImmediately.schedule();
}
}));
this._register(this._editors.original.onDidChangeConfiguration((args) => {
if (args.hasChanged(EditorOption.wrappingInfo) || args.hasChanged(EditorOption.lineHeight)) {
updateImmediately.schedule();
Expand Down
16 changes: 10 additions & 6 deletions Source/vs/editor/browser/widget/diffEditor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,11 @@ export function applyViewZones(editor: ICodeEditor, viewZones: IObservable<IObse
if (setIsUpdating) {
setIsUpdating(true);
}
editor.changeViewZones(a => { for (const id of changeSummary.zoneIds) {
a.layoutZone(id);
} });
editor.changeViewZones(a => {
for (const id of changeSummary.zoneIds) {
a.layoutZone(id);
}
});
if (setIsUpdating) {
setIsUpdating(false);
}
Expand All @@ -313,9 +315,11 @@ export function applyViewZones(editor: ICodeEditor, viewZones: IObservable<IObse
if (setIsUpdating) {
setIsUpdating(true);
}
editor.changeViewZones(a => { for (const id of lastViewZoneIds) {
a.removeZone(id);
} });
editor.changeViewZones(a => {
for (const id of lastViewZoneIds) {
a.removeZone(id);
}
});
zoneIds?.clear();
if (setIsUpdating) {
setIsUpdating(false);
Expand Down
14 changes: 8 additions & 6 deletions Source/vs/platform/languagePacks/node/languagePacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,14 @@ class LanguagePacksCache extends Disposable {
.then(undefined, err => err.code === 'ENOENT' ? Promise.resolve('{}') : Promise.reject(err))
.then<{
[language: string]: ILanguagePack;
}>(raw => { try {
return JSON.parse(raw);
}
catch (e) {
return {};
} })
}>(raw => {
try {
return JSON.parse(raw);
}
catch (e) {
return {};
}
})
.then(languagePacks => { result = fn(languagePacks); return languagePacks; })
.then(languagePacks => {
for (const language of Object.keys(languagePacks)) {
Expand Down
8 changes: 5 additions & 3 deletions Source/vs/platform/userDataSync/common/extensionsMerge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ export function merge(localExtensions: ILocalSyncExtension[], remoteExtensions:
remoteExtensions = remoteExtensions.map(massageIncomingExtension);
lastSyncExtensions = lastSyncExtensions ? lastSyncExtensions.map(massageIncomingExtension) : null;
const uuids: Map<string, string> = new Map<string, string>();
const addUUID = (identifier: IExtensionIdentifier) => { if (identifier.uuid) {
uuids.set(identifier.id.toLowerCase(), identifier.uuid);
} };
const addUUID = (identifier: IExtensionIdentifier) => {
if (identifier.uuid) {
uuids.set(identifier.id.toLowerCase(), identifier.uuid);
}
};
localExtensions.forEach(({ identifier }) => addUUID(identifier));
remoteExtensions.forEach(({ identifier }) => addUUID(identifier));
lastSyncExtensions?.forEach(({ identifier }) => addUUID(identifier));
Expand Down
2 changes: 2 additions & 0 deletions Source/vs/workbench/api/common/extHostDiagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
const name = '_generated_mirror';
const collection = new DiagnosticCollection(name, name, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, // no limits because this collection is just a mirror of "sanitized" data
// no limits because this collection is just a mirror of "sanitized" data
// no limits because this collection is just a mirror of "sanitized" data
// no limits because this collection is just a mirror of "sanitized" data
_uri => undefined, this._fileSystemInfoService.extUri, undefined, this._onDidChangeDiagnostics);
this._collections.set(name, collection);
this._mirrorCollection = collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,9 +1030,11 @@ export class DropDownExtensionActionViewItem extends ActionViewItem {
getAnchor: () => anchor,
getActions: () => actions,
actionRunner: this.actionRunner,
onHide: () => { if (disposeActionsOnHide) {
disposeIfDisposable(actions);
} }
onHide: () => {
if (disposeActionsOnHide) {
disposeIfDisposable(actions);
}
}
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,11 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
this.builtInExtensionsContextKey = BuiltInExtensionsContext.bindTo(contextKeyService);
this.searchBuiltInExtensionsContextKey = SearchBuiltInExtensionsContext.bindTo(contextKeyService);
this.recommendedExtensionsContextKey = RecommendedExtensionsContext.bindTo(contextKeyService);
this._register(this.paneCompositeService.onDidPaneCompositeOpen(e => { if (e.viewContainerLocation === ViewContainerLocation.Sidebar) {
this.onViewletOpen(e.composite);
} }, this));
this._register(this.paneCompositeService.onDidPaneCompositeOpen(e => {
if (e.viewContainerLocation === ViewContainerLocation.Sidebar) {
this.onViewletOpen(e.composite);
}
}, this));
this._register(extensionsWorkbenchService.onReset(() => this.refresh()));
this.searchViewletState = this.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,12 @@ class MarkerWidget extends Disposable {
action.enabled = !!viewModel && marker.lines.length > 1;
action.tooltip = multiline ? localize('single line', "Show message in single line") : localize('multi line', "Show message in multiple lines");
action.class = ThemeIcon.asClassName(multiline ? expandedIcon : collapsedIcon);
action.run = () => { if (viewModel) {
viewModel.multiline = !viewModel.multiline;
} return Promise.resolve(); };
action.run = () => {
if (viewModel) {
viewModel.multiline = !viewModel.multiline;
}
return Promise.resolve();
};
multilineActionbar.push([action], { icon: true, label: false });
}
private renderMessageAndDetails(element: Marker, filterData: MarkerFilterData | undefined): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ export class DocumentRangeMap {
public readonly rangeMappings: RangeMapping[], public readonly inputLineCount: number) {
assertFn(() => checkAdjacentItems(rangeMappings, (m1, m2) => rangeIsBeforeOrTouching(m1.inputRange, m2.inputRange) &&
rangeIsBeforeOrTouching(m1.outputRange, m2.outputRange) /*&&
lengthBetweenPositions(m1.inputRange.getEndPosition(), m2.inputRange.getStartPosition()).equals(
lengthBetweenPositions(m1.outputRange.getEndPosition(), m2.outputRange.getStartPosition())
)*/));
lengthBetweenPositions(m1.inputRange.getEndPosition(), m2.inputRange.getStartPosition()).equals(
lengthBetweenPositions(m1.outputRange.getEndPosition(), m2.outputRange.getStartPosition())
)*/));
}
public project(position: Position): RangeMapping {
const lastBefore = findLast(this.rangeMappings, r => r.inputRange.getStartPosition().isBeforeOrEqual(position));
Expand Down
9 changes: 6 additions & 3 deletions Source/vs/workbench/contrib/remote/browser/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,12 @@ class VisibleProgress {
this._currentProgress = null;
this._currentTimer = null;
const promise = new Promise<void>((resolve) => this._currentProgressPromiseResolve = resolve);
progressService.withProgress({ location: location, buttons: buttons }, (progress) => { if (!this._isDisposed) {
this._currentProgress = progress;
} return promise; }, (choice) => onDidCancel(choice, this._lastReport));
progressService.withProgress({ location: location, buttons: buttons }, (progress) => {
if (!this._isDisposed) {
this._currentProgress = progress;
}
return promise;
}, (choice) => onDidCancel(choice, this._lastReport));
if (this._lastReport) {
this.report();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ export class SearchModelImpl extends Disposable implements ISearchModel {
const notebookResult = this.notebookSearchService.notebookSearch(query, tokenSource.token, searchInstanceID, asyncGenerateOnProgress);
const textResult = this.searchService.textSearchSplitSyncAsync(searchQuery, tokenSource.token, asyncGenerateOnProgress, notebookResult.openFilesToScan, notebookResult.allScannedFiles);
const syncResults = textResult.syncResults.results;
syncResults.forEach(p => { if (p) {
syncGenerateOnProgress(p);
} });
syncResults.forEach(p => {
if (p) {
syncGenerateOnProgress(p);
}
});
const getAsyncResults = async (): Promise<ISearchComplete> => {
const searchStart = Date.now();
// resolve async parts of search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ export class BufferContentTracker extends Disposable {
let linesToRemove = this._priorEditorViewportLineCount;
let index = 1;
while (linesToRemove) {
this.bufferToEditorLineMapping.forEach((value, key) => { if (value === this._lines.length - index) {
this.bufferToEditorLineMapping.delete(key);
} });
this.bufferToEditorLineMapping.forEach((value, key) => {
if (value === this._lines.length - index) {
this.bufferToEditorLineMapping.delete(key);
}
});
this._lines.pop();
index++;
linesToRemove--;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ export class GettingStartedIndexList<T extends {
onDidChange(listener: () => void) {
this._register(this.onDidChangeEntries(listener));
}
register(d: IDisposable) { if (this.isDisposed) {
d.dispose();
register(d: IDisposable) {
if (this.isDisposed) {
d.dispose();
}
else {
this._register(d);
}
}
else {
this._register(d);
} }
override dispose() {
this.isDisposed = true;
super.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ class NewFileTemplatesManager extends Disposable {
menuService: IMenuService) {
super();
NewFileTemplatesManager.Instance = this;
this._register({ dispose() { if (NewFileTemplatesManager.Instance === this) {
NewFileTemplatesManager.Instance = undefined;
} } });
this._register({ dispose() {
if (NewFileTemplatesManager.Instance === this) {
NewFileTemplatesManager.Instance = undefined;
}
} });
this.menu = menuService.createMenu(MenuId.NewFile, contextKeyService);
}
private allEntries(): NewFileItem[] {
Expand Down
6 changes: 1 addition & 5 deletions build/azure-pipelines/common/computeBuiltInDepsCacheKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as fs from 'fs';
import * as path from 'path';
import * as crypto from 'crypto';

const productjson = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../product.json'), 'utf8'));
const shasum = crypto.createHash('sha256');

for (const ext of productjson.builtInExtensions) {
shasum.update(`${ext.name}@${ext.version}`);
shasum.update(`${ext.name}@${ext.version}`);
}

process.stdout.write(shasum.digest('hex'));
34 changes: 13 additions & 21 deletions build/azure-pipelines/common/computeNodeModulesCacheKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,33 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as fs from 'fs';
import * as path from 'path';
import * as crypto from 'crypto';
const { dirs } = require('../../npm/dirs');

const ROOT = path.join(__dirname, '../../../');

const shasum = crypto.createHash('sha256');

shasum.update(fs.readFileSync(path.join(ROOT, 'build/.cachesalt')));
shasum.update(fs.readFileSync(path.join(ROOT, '.npmrc')));
shasum.update(fs.readFileSync(path.join(ROOT, 'build', '.npmrc')));
shasum.update(fs.readFileSync(path.join(ROOT, 'remote', '.npmrc')));

// Add `package.json` and `package-lock.json` files
for (const dir of dirs) {
const packageJsonPath = path.join(ROOT, dir, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
const relevantPackageJsonSections = {
dependencies: packageJson.dependencies,
devDependencies: packageJson.devDependencies,
optionalDependencies: packageJson.optionalDependencies,
resolutions: packageJson.resolutions,
distro: packageJson.distro
};
shasum.update(JSON.stringify(relevantPackageJsonSections));

const packageLockPath = path.join(ROOT, dir, 'package-lock.json');
shasum.update(fs.readFileSync(packageLockPath));
const packageJsonPath = path.join(ROOT, dir, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString());
const relevantPackageJsonSections = {
dependencies: packageJson.dependencies,
devDependencies: packageJson.devDependencies,
optionalDependencies: packageJson.optionalDependencies,
resolutions: packageJson.resolutions,
distro: packageJson.distro
};
shasum.update(JSON.stringify(relevantPackageJsonSections));
const packageLockPath = path.join(ROOT, dir, 'package-lock.json');
shasum.update(fs.readFileSync(packageLockPath));
}

// Add any other command line arguments
for (let i = 2; i < process.argv.length; i++) {
shasum.update(process.argv[i]);
shasum.update(process.argv[i]);
}

process.stdout.write(shasum.digest('hex'));
Loading

0 comments on commit ee72818

Please sign in to comment.