Skip to content

Commit

Permalink
Rebase against the upstream 23605b1
Browse files Browse the repository at this point in the history
vscode-upstream-sha1: 23605b1
  • Loading branch information
Eclipse Che Sync committed Sep 14, 2023
2 parents 6ea749d + 23605b1 commit 10d1c09
Show file tree
Hide file tree
Showing 34 changed files with 654 additions and 305 deletions.
22 changes: 17 additions & 5 deletions code/extensions/emmet/src/test/cssAbbreviationAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ nav#
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
};

return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
return Promise.all([completionPromise1, completionPromise2]).then(([result1, result2]) => {
assert.ok(result1);
assert.ok(result2);
callBack(result1, '#121212');
callBack(result2, '!important');
editor.selections = [new Selection(2, 12, 2, 12), new Selection(2, 14, 2, 14)];
Expand Down Expand Up @@ -244,7 +246,9 @@ nav#
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
};

return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
return Promise.all([completionPromise1, completionPromise2]).then(([result1, result2]) => {
assert.ok(result1);
assert.ok(result2);
callBack(result1, '#121212');
callBack(result2, '!important');
editor.selections = [new Selection(3, 12, 3, 12), new Selection(3, 14, 3, 14)];
Expand Down Expand Up @@ -303,7 +307,9 @@ nav#
assert.strictEqual((<string>emmetCompletionItem.documentation || '').replace(/\|/g, ''), expandedText, `Docs of completion item doesnt match.`);
};

return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
return Promise.all([completionPromise1, completionPromise2]).then(([result1, result2]) => {
assert.ok(result1);
assert.ok(result2);
callBack(result1, '#121212');
callBack(result2, '!important');
editor.selections = [new Selection(2, 12, 2, 12), new Selection(2, 14, 2, 14)];
Expand Down Expand Up @@ -361,7 +367,9 @@ nav#
assert.strictEqual(emmetCompletionItem.filterText, abbreviation, `FilterText of completion item doesnt match.`);
};

return Promise.all<CompletionList>([completionPromise1, completionPromise2]).then(([result1, result2]) => {
return Promise.all([completionPromise1, completionPromise2]).then(([result1, result2]) => {
assert.ok(result1);
assert.ok(result2);
callBack(result1);
callBack(result2);
return Promise.resolve();
Expand Down Expand Up @@ -421,7 +429,11 @@ nav#
assert.strictEqual(emmetCompletionItem.filterText, abbreviation, `FilterText of completion item doesnt match.`);
};

return Promise.all<CompletionList>([completionPromise1, completionPromise2, completionPromise3, completionPromise4]).then(([result1, result2, result3, result4]) => {
return Promise.all([completionPromise1, completionPromise2, completionPromise3, completionPromise4]).then(([result1, result2, result3, result4]) => {
assert.ok(result1);
assert.ok(result2);
assert.ok(result3);
assert.ok(result4);
callBack(result1, 'p10', 'padding: 10px;');
callBack(result2, 'p20', 'padding: 20px;');
callBack(result3, 'p30', 'padding: 30px;');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,8 @@ export class BetterTokenStorage<T> {
},
err => {
Logger.error(err);
resolve(tokens);
}).then(resolve, err => {
Logger.error(err);
resolve(tokens);
});
return tokens;
}).then(resolve);
});
this._operationInProgress = false;
}
Expand Down
6 changes: 6 additions & 0 deletions code/extensions/typescript-language-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,12 @@
"default": false,
"description": "%configuration.preferGoToSourceDefinition%",
"scope": "window"
},
"typescript.workspaceSymbols.excludeLibrarySymbols": {
"type": "boolean",
"default": true,
"markdownDescription": "%typescript.workspaceSymbols.excludeLibrarySymbols%",
"scope": "window"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"typescript.preferences.includePackageJsonAutoImports.on": "Always search dependencies.",
"typescript.preferences.includePackageJsonAutoImports.off": "Never search dependencies.",
"typescript.preferences.autoImportFileExcludePatterns": "Specify glob patterns of files to exclude from auto imports. Relative paths are resolved relative to the workspace root. Patterns are evaluated using tsconfig.json [`exclude`](https://www.typescriptlang.org/tsconfig#exclude) semantics. Requires using TypeScript 4.8 or newer in the workspace.",
"typescript.workspaceSymbols.excludeLibrarySymbols": "Exclude symbols that come from library files in `Go To Symbol in Workspace` results. Requires using TypeScript 5.3+ in the workspace.",
"typescript.updateImportsOnFileMove.enabled": "Enable/disable automatic updating of import paths when you rename or move a file in VS Code.",
"typescript.updateImportsOnFileMove.enabled.prompt": "Prompt on each rename.",
"typescript.updateImportsOnFileMove.enabled.always": "Always update paths automatically.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export interface TypeScriptServiceConfiguration {
readonly enableTsServerTracing: boolean;
readonly localNodePath: string | null;
readonly globalNodePath: string | null;
readonly workspaceSymbolsExcludeLibrarySymbols: boolean;
}

export function areServiceConfigurationsEqual(a: TypeScriptServiceConfiguration, b: TypeScriptServiceConfiguration): boolean {
Expand Down Expand Up @@ -158,6 +159,7 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
enableTsServerTracing: this.readEnableTsServerTracing(configuration),
localNodePath: this.readLocalNodePath(configuration),
globalNodePath: this.readGlobalNodePath(configuration),
workspaceSymbolsExcludeLibrarySymbols: this.readWorkspaceSymbolsExcludeLibrarySymbols(configuration),
};
}

Expand Down Expand Up @@ -255,4 +257,8 @@ export abstract class BaseServiceConfigurationProvider implements ServiceConfigu
private readWebProjectWideIntellisenseSuppressSemanticErrors(configuration: vscode.WorkspaceConfiguration): boolean {
return configuration.get<boolean>('typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors', true);
}

private readWorkspaceSymbolsExcludeLibrarySymbols(configuration: vscode.WorkspaceConfiguration): boolean {
return configuration.get<boolean>('typescript.workspaceSymbols.excludeLibrarySymbols', true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,38 +56,39 @@ class UpdateImportsOnFileRenameHandler extends Disposable {
super();

this._register(vscode.workspace.onDidRenameFiles(async (e) => {
const [{ newUri, oldUri }] = e.files;
const newFilePath = this.client.toTsFilePath(newUri);
if (!newFilePath) {
return;
}
for (const { newUri, oldUri } of e.files) {
const newFilePath = this.client.toTsFilePath(newUri);
if (!newFilePath) {
continue;
}

const oldFilePath = this.client.toTsFilePath(oldUri);
if (!oldFilePath) {
return;
}
const oldFilePath = this.client.toTsFilePath(oldUri);
if (!oldFilePath) {
continue;
}

const config = this.getConfiguration(newUri);
const setting = config.get<UpdateImportsOnFileMoveSetting>(updateImportsOnFileMoveName);
if (setting === UpdateImportsOnFileMoveSetting.Never) {
return;
}
const config = this.getConfiguration(newUri);
const setting = config.get<UpdateImportsOnFileMoveSetting>(updateImportsOnFileMoveName);
if (setting === UpdateImportsOnFileMoveSetting.Never) {
continue;
}

// Try to get a js/ts file that is being moved
// For directory moves, this returns a js/ts file under the directory.
const jsTsFileThatIsBeingMoved = await this.getJsTsFileBeingMoved(newUri);
if (!jsTsFileThatIsBeingMoved || !this.client.toTsFilePath(jsTsFileThatIsBeingMoved)) {
return;
}
// Try to get a js/ts file that is being moved
// For directory moves, this returns a js/ts file under the directory.
const jsTsFileThatIsBeingMoved = await this.getJsTsFileBeingMoved(newUri);
if (!jsTsFileThatIsBeingMoved || !this.client.toTsFilePath(jsTsFileThatIsBeingMoved)) {
continue;
}

this._pendingRenames.add({ oldUri, newUri, newFilePath, oldFilePath, jsTsFileThatIsBeingMoved });
this._pendingRenames.add({ oldUri, newUri, newFilePath, oldFilePath, jsTsFileThatIsBeingMoved });

this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: vscode.l10n.t("Checking for update of JS/TS imports")
}, () => this.flushRenames());
});
this._delayer.trigger(() => {
vscode.window.withProgress({
location: vscode.ProgressLocation.Window,
title: vscode.l10n.t("Checking for update of JS/TS imports")
}, () => this.flushRenames());
});
}
}));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
providePrefixAndSuffixTextForRename: true,
allowRenameOfImportPath: true,
includePackageJsonAutoImports: this._configuration.includePackageJsonAutoImports,
excludeLibrarySymbolsInNavTo: this._configuration.workspaceSymbolsExcludeLibrarySymbols,
},
watchOptions
};
Expand Down
11 changes: 1 addition & 10 deletions code/src/typings/thenable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,4 @@
* enables reusing existing code without migrating to a specific promise implementation. Still,
* we recommend the use of native promises which are available in VS Code.
*/
interface Thenable<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}
interface Thenable<T> extends PromiseLike<T> { }
16 changes: 10 additions & 6 deletions code/src/vs/editor/common/services/markerDecorationsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Range } from 'vs/editor/common/core/range';
import { IMarkerDecorationsService } from 'vs/editor/common/services/markerDecorations';
import { Schemas } from 'vs/base/common/network';
import { Emitter, Event } from 'vs/base/common/event';
import { minimapWarning, minimapError } from 'vs/platform/theme/common/colorRegistry';
import { minimapInfo, minimapWarning, minimapError } from 'vs/platform/theme/common/colorRegistry';
import { BidirectionalMap, ResourceMap } from 'vs/base/common/map';
import { diffSets } from 'vs/base/common/collections';

Expand Down Expand Up @@ -208,6 +208,15 @@ class MarkerDecorations extends Disposable {
}
zIndex = 0;
break;
case MarkerSeverity.Info:
className = ClassName.EditorInfoDecoration;
color = themeColorFromId(overviewRulerInfo);
zIndex = 10;
minimap = {
color: themeColorFromId(minimapInfo),
position: MinimapPosition.Inline
};
break;
case MarkerSeverity.Warning:
className = ClassName.EditorWarningDecoration;
color = themeColorFromId(overviewRulerWarning);
Expand All @@ -217,11 +226,6 @@ class MarkerDecorations extends Disposable {
position: MinimapPosition.Inline
};
break;
case MarkerSeverity.Info:
className = ClassName.EditorInfoDecoration;
color = themeColorFromId(overviewRulerInfo);
zIndex = 10;
break;
case MarkerSeverity.Error:
default:
className = ClassName.EditorErrorDecoration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class CodeLensContribution implements IEditorContribution {
return;
}

if (!this._editor.getOption(EditorOption.codeLens)) {
if (!this._editor.getOption(EditorOption.codeLens) || model.isTooLargeForTokenization()) {
return;
}

Expand Down
4 changes: 4 additions & 0 deletions code/src/vs/editor/contrib/links/browser/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export class LinkDetector extends Disposable implements IEditorContribution {

const model = this.editor.getModel();

if (model.isTooLargeForSyncing()) {
return;
}

if (!this.providers.has(model)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class StickyLineCandidateProvider extends Disposable implements IStickyLi

private async updateStickyModel(token: CancellationToken): Promise<void> {

if (!this._editor.hasModel() || !this._stickyModelProvider) {
if (!this._editor.hasModel() || !this._stickyModelProvider || this._editor.getModel().isTooLargeForTokenization()) {
this._model = null;
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ export class WordHighlighterContribution extends Disposable implements IEditorCo
this.wordHighlighter = null;
this.linkedContributions = new Set();
const createWordHighlighterIfPossible = () => {
if (editor.hasModel()) {
if (editor.hasModel() && !editor.getModel().isTooLargeForTokenization()) {
this.wordHighlighter = new WordHighlighter(editor, languageFeaturesService.documentHighlightProvider, () => Iterable.map(this.linkedContributions, c => c.wordHighlighter), contextKeyService);
}
};
Expand Down
5 changes: 3 additions & 2 deletions code/src/vs/platform/theme/common/colorRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export const editorInlayHintParameterForeground = registerColor('editorInlayHint
export const editorInlayHintParameterBackground = registerColor('editorInlayHint.parameterBackground', { dark: editorInlayHintBackground, light: editorInlayHintBackground, hcDark: editorInlayHintBackground, hcLight: editorInlayHintBackground }, nls.localize('editorInlayHintBackgroundParameter', 'Background color of inline hints for parameters'));

/**
* Editor lighbulb icon colors
* Editor lightbulb icon colors
*/
export const editorLightBulbForeground = registerColor('editorLightBulb.foreground', { dark: '#FFCC00', light: '#DDB100', hcDark: '#FFCC00', hcLight: '#007ACC' }, nls.localize('editorLightBulbForeground', "The color used for the lightbulb actions icon."));
export const editorLightBulbAutoFixForeground = registerColor('editorLightBulbAutoFix.foreground', { dark: '#75BEFF', light: '#007ACC', hcDark: '#75BEFF', hcLight: '#007ACC' }, nls.localize('editorLightBulbAutoFixForeground', "The color used for the lightbulb auto fix actions icon."));
Expand Down Expand Up @@ -547,8 +547,9 @@ export const overviewRulerSelectionHighlightForeground = registerColor('editorOv
export const minimapFindMatch = registerColor('minimap.findMatchHighlight', { light: '#d18616', dark: '#d18616', hcDark: '#AB5A00', hcLight: '#0F4A85' }, nls.localize('minimapFindMatchHighlight', 'Minimap marker color for find matches.'), true);
export const minimapSelectionOccurrenceHighlight = registerColor('minimap.selectionOccurrenceHighlight', { light: '#c9c9c9', dark: '#676767', hcDark: '#ffffff', hcLight: '#0F4A85' }, nls.localize('minimapSelectionOccurrenceHighlight', 'Minimap marker color for repeating editor selections.'), true);
export const minimapSelection = registerColor('minimap.selectionHighlight', { light: '#ADD6FF', dark: '#264F78', hcDark: '#ffffff', hcLight: '#0F4A85' }, nls.localize('minimapSelectionHighlight', 'Minimap marker color for the editor selection.'), true);
export const minimapError = registerColor('minimap.errorHighlight', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hcDark: new Color(new RGBA(255, 50, 50, 1)), hcLight: '#B5200D' }, nls.localize('minimapError', 'Minimap marker color for errors.'));
export const minimapInfo = registerColor('minimap.infoHighlight', { dark: editorInfoForeground, light: editorInfoForeground, hcDark: editorInfoBorder, hcLight: editorInfoBorder }, nls.localize('minimapInfo', 'Minimap marker color for infos.'));
export const minimapWarning = registerColor('minimap.warningHighlight', { dark: editorWarningForeground, light: editorWarningForeground, hcDark: editorWarningBorder, hcLight: editorWarningBorder }, nls.localize('overviewRuleWarning', 'Minimap marker color for warnings.'));
export const minimapError = registerColor('minimap.errorHighlight', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hcDark: new Color(new RGBA(255, 50, 50, 1)), hcLight: '#B5200D' }, nls.localize('minimapError', 'Minimap marker color for errors.'));
export const minimapBackground = registerColor('minimap.background', { dark: null, light: null, hcDark: null, hcLight: null }, nls.localize('minimapBackground', "Minimap background color."));
export const minimapForegroundOpacity = registerColor('minimap.foregroundOpacity', { dark: Color.fromHex('#000f'), light: Color.fromHex('#000f'), hcDark: Color.fromHex('#000f'), hcLight: Color.fromHex('#000f') }, nls.localize('minimapForegroundOpacity', 'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.'));

Expand Down
16 changes: 16 additions & 0 deletions code/src/vs/workbench/api/common/extHostExtensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,18 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
return new Promise<number>((resolve, reject) => {
const oldTestRunnerCallback = (error: Error, failures: number | undefined) => {
if (error) {
if (isCI) {
this._logService.error(`Test runner called back with error`, error);
}
reject(error);
} else {
if (isCI) {
if (failures) {
this._logService.info(`Test runner called back with ${failures} failures.`);
} else {
this._logService.info(`Test runner called back with successful outcome.`);
}
}
resolve((typeof failures === 'number' && failures > 0) ? 1 /* ERROR */ : 0 /* OK */);
}
};
Expand All @@ -754,9 +764,15 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
if (runResult && runResult.then) {
runResult
.then(() => {
if (isCI) {
this._logService.info(`Test runner finished successfully.`);
}
resolve(0);
})
.catch((err: unknown) => {
if (isCI) {
this._logService.error(`Test runner finished with error`, err);
}
reject(err instanceof Error && err.stack ? err.stack : String(err));
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
'Variable 0 will be a file name.'
]
},
"{0}: tokenization, wrapping, folding and sticky scroll have been turned off for this large file in order to reduce memory usage and avoid freezing or crashing.",
"{0}: tokenization, wrapping, folding, codelens, word highlighting and sticky scroll have been turned off for this large file in order to reduce memory usage and avoid freezing or crashing.",
path.basename(model.uri.path)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class ToggleBreakpointAction extends Action2 {
// Does not account for multi line selections, Set to remove multiple cursor on the same line
const lineNumbers = [...new Set(editor.getSelections().map(s => s.getPosition().lineNumber))];

const bps = debugService.getModel().getBreakpoints();
await Promise.all(lineNumbers.map(async line => {
const bps = debugService.getModel().getBreakpoints({ lineNumber: line, uri: modelUri });
if (bps.length) {
await Promise.all(bps.map(bp => debugService.removeBreakpoints(bp.getId())));
} else if (canSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo

async run(accessor: ServicesAccessor, editSessionId?: string): Promise<void> {
const data = await that.quickInputService.input({ prompt: 'Enter serialized data' });
if (data) {
that.editSessionsStorageService.lastReadResources.set('editSessions', { content: data, ref: '' });
}
await that.progressService.withProgress({ ...resumeProgressOptions, title: resumeProgressOptionsTitle }, async () => await that.resumeEditSession(editSessionId, undefined, undefined, undefined, undefined, data));
}
}));
Expand Down
Loading

0 comments on commit 10d1c09

Please sign in to comment.