Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreadman committed Dec 14, 2024
2 parents 090559a + 6fb1f6f commit 2c27e8c
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 46 deletions.
11 changes: 10 additions & 1 deletion extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,16 @@ export class Repository implements Disposable {
}

switch (raw.y) {
case 'M': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.MODIFIED, useIcons, renameUri)); break;
case 'M': {
// https://git-scm.com/docs/git-status#_porcelain_format_version_1
// When using `-z` with the porcelain v1 format any submodule changes
// are reported as modified M instead of m or single ?. Due to that we
// will ignore any changes reported for the submodule folder.
if (this.submodules.every(s => !pathEquals(s.path, raw.path))) {
workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.MODIFIED, useIcons, renameUri));
}
break;
}
case 'D': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.DELETED, useIcons, renameUri)); break;
case 'A': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.INTENT_TO_ADD, useIcons, renameUri)); break;
case 'R': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.INTENT_TO_RENAME, useIcons, renameUri)); break;
Expand Down
22 changes: 20 additions & 2 deletions extensions/terminal-suggest/src/terminalSuggestMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ function createCompletionItem(commandLine: string, cursorPosition: number, prefi
};
}

async function isExecutable(filePath: string): Promise<boolean> {
// Windows doesn't have the concept of an executable bit and running any
// file is possible. We considered using $PATHEXT here but since it's mostly
// there for legacy reasons and it would be easier and more intuitive to add
// a setting if needed instead.
if (osIsWindows()) {
return true;
}
try {
const stats = await fs.stat(filePath);
// On macOS/Linux, check if the executable bit is set
return (stats.mode & 0o100) !== 0;
} catch (error) {
// If the file does not exist or cannot be accessed, it's not executable
return false;
}
}

async function getCommandsInPath(): Promise<Set<string> | undefined> {
if (cachedAvailableCommands) {
return cachedAvailableCommands;
Expand All @@ -176,7 +194,7 @@ async function getCommandsInPath(): Promise<Set<string> | undefined> {
if (!paths) {
return;
}

const pathSeparator = osIsWindows() ? '\\' : '/';
const executables = new Set<string>();
for (const path of paths) {
try {
Expand All @@ -187,7 +205,7 @@ async function getCommandsInPath(): Promise<Set<string> | undefined> {
const files = await vscode.workspace.fs.readDirectory(vscode.Uri.file(path));

for (const [file, fileType] of files) {
if (fileType !== vscode.FileType.Unknown && fileType !== vscode.FileType.Directory) {
if (fileType !== vscode.FileType.Unknown && fileType !== vscode.FileType.Directory && await isExecutable(path + pathSeparator + file)) {
executables.add(file);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/vs/editor/contrib/hover/browser/contentHoverWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,15 @@ export class ContentHoverWidget extends ResizableContentWidget {

private _setHoverWidgetMaxDimensions(width: number | string, height: number | string): void {
ContentHoverWidget._applyMaxDimensions(this._hover.contentsDomNode, width, height);
ContentHoverWidget._applyMaxDimensions(this._hover.scrollbar.getDomNode(), width, height);
ContentHoverWidget._applyMaxDimensions(this._hover.containerDomNode, width, height);
this._hover.containerDomNode.style.setProperty('--vscode-hover-maxWidth', typeof width === 'number' ? `${width}px` : width);
this._layoutContentWidget();
}

private _setAdjustedHoverWidgetDimensions(size: dom.Dimension): void {
this._setHoverWidgetMaxDimensions('none', 'none');
const width = size.width;
const height = size.height;
this._setHoverWidgetDimensions(width, height);
this._setHoverWidgetDimensions(size.width, size.height);
}

private _updateResizableNodeMaxDimensions(): void {
Expand Down Expand Up @@ -297,14 +296,14 @@ export class ContentHoverWidget extends ResizableContentWidget {
private _updateMaxDimensions() {
const height = Math.max(this._editor.getLayoutInfo().height / 4, 250, ContentHoverWidget._lastDimensions.height);
const width = Math.max(this._editor.getLayoutInfo().width * 0.66, 750, ContentHoverWidget._lastDimensions.width);
this._resizableNode.maxSize = new dom.Dimension(width, height);
this._setHoverWidgetMaxDimensions(width, height);
}

private _render(renderedHover: RenderedContentHover) {
this._setRenderedHover(renderedHover);
this._updateFont();
this._updateContent(renderedHover.domNode);
this._updateMaxDimensions();
this.onContentsChanged();
// Simply force a synchronous render on the editor
// such that the widget does not really render with left = '0px'
Expand Down Expand Up @@ -371,6 +370,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
const layoutInfo = this._editor.getLayoutInfo();
this._resizableNode.layout(layoutInfo.height, layoutInfo.width);
this._setHoverWidgetDimensions('auto', 'auto');
this._updateMaxDimensions();
}

public setMinimumDimensions(dimensions: dom.Dimension): void {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/contrib/snippet/browser/snippetSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export class SnippetSession {
const readClipboardText = () => clipboardText;

// know what text the overwrite[Before|After] extensions
// of the primary curser have selected because only when
// of the primary cursor have selected because only when
// secondary selections extend to the same text we can grow them
const firstBeforeText = model.getValueInRange(SnippetSession.adjustSelection(model, editor.getSelection(), overwriteBefore, 0));
const firstAfterText = model.getValueInRange(SnippetSession.adjustSelection(model, editor.getSelection(), 0, overwriteAfter));
Expand Down Expand Up @@ -530,7 +530,7 @@ export class SnippetSession {
]));

// store snippets with the index of their originating selection.
// that ensures the primiary cursor stays primary despite not being
// that ensures the primary cursor stays primary despite not being
// the one with lowest start position
edits[idx] = EditOperation.replace(snippetSelection, snippet.toString());
edits[idx].identifier = { major: idx, minor: 0 }; // mark the edit so only our undo edits will be used to generate end cursors
Expand Down
12 changes: 10 additions & 2 deletions src/vs/platform/extensionManagement/common/extensionManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Platform } from '../../../base/common/platform.js';
import { URI } from '../../../base/common/uri.js';
import { localize2 } from '../../../nls.js';
import { ExtensionType, IExtension, IExtensionManifest, TargetPlatform } from '../../extensions/common/extensions.js';
import { IFileService } from '../../files/common/files.js';
import { FileOperationError, FileOperationResult, IFileService, IFileStat } from '../../files/common/files.js';
import { createDecorator } from '../../instantiation/common/instantiation.js';

export const EXTENSION_IDENTIFIER_PATTERN = '^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$';
Expand Down Expand Up @@ -640,7 +640,15 @@ export interface IAllowedExtensionsService {
}

export async function computeSize(location: URI, fileService: IFileService): Promise<number> {
const stat = await fileService.resolve(location);
let stat: IFileStat;
try {
stat = await fileService.resolve(location);
} catch (e) {
if ((<FileOperationError>e).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
return 0;
}
throw e;
}
if (stat.children) {
const sizes = await Promise.all(stat.children.map(c => computeSize(c.resource, fileService)));
return sizes.reduce((r, s) => r + s, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class ImplicitContextAttachmentWidget extends Disposable {
this._register(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), hintElement, title));

const buttonMsg = this.attachment.enabled ? localize('disable', "Disable current file context") : localize('enable', "Enable current file context");
this.domNode.ariaLabel = buttonMsg;
const toggleButton = this.renderDisposables.add(new Button(this.domNode, { supportIcons: true, title: buttonMsg }));
toggleButton.icon = this.attachment.enabled ? Codicon.eye : Codicon.eyeClosed;
this.renderDisposables.add(toggleButton.onDidClick((e) => {
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/contrib/chat/browser/chatInputPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,8 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
} else {
suggestedFilesInWorkingSetCount = entries.filter(e => e.kind === 'reference' && e.state === WorkingSetEntryState.Suggested).length;
}
overviewTitle.ariaLabel = overviewTitle.textContent;
overviewTitle.tabIndex = 0;

if (excludedEntries.length > 0) {
overviewFileCount.textContent = ' ' + localize('chatEditingSession.excludedFiles', '({0}/{1} files)', this.chatEditingService.editingSessionFileLimit + excludedEntries.length, this.chatEditingService.editingSessionFileLimit);
Expand Down Expand Up @@ -1282,7 +1284,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
}));
dom.append(addFilesElement, button.element);

// REALTED files (after Add Files...)
// RELATED files (after Add Files...)
for (const [uri, metadata] of chatEditingSession.workingSet) {
if (metadata.state !== WorkingSetEntryState.Suggested) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ class BuiltinDynamicCompletions extends Disposable {

// RELATED FILES
if (widget.location === ChatAgentLocation.EditingSession && widget.viewModel && this._chatEditingService.currentEditingSessionObs.get()?.chatSessionId === widget.viewModel?.sessionId) {
const relatedFiles = (await raceTimeout(this._chatEditingService.getRelatedFiles(widget.viewModel.sessionId, widget.getInput(), token), 1000)) ?? [];
const relatedFiles = (await raceTimeout(this._chatEditingService.getRelatedFiles(widget.viewModel.sessionId, widget.getInput(), token), 200)) ?? [];
for (const relatedFileGroup of relatedFiles) {
for (const relatedFile of relatedFileGroup.files) {
if (seen.has(relatedFile.uri)) {
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/chat/browser/media/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ have to be updated for changes to the rules above, or to support more deeply nes
}

.interactive-session .chat-editing-session .chat-editing-session-toolbar-actions .monaco-button.secondary:first-child {
margin: 3px 0px 3px 3px;
flex-shrink: 0;
}

Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/debug/node/debugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ export abstract class NetworkDebugAdapter extends StreamDebugAdapter {
});

this.socket.on('error', error => {
// On ipv6 posix this can be an AggregateError which lacks a message. Use the first.
if (error instanceof AggregateError) {
error = error.errors[0];
}

if (connected) {
this._onError.fire(error);
} else {
Expand Down
16 changes: 9 additions & 7 deletions src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1157,12 +1157,14 @@ class AdditionalDetailsWidget extends Disposable {
$('div.more-info-entry-name', undefined, localize('id', "Identifier")),
$('code', undefined, extension.identifier.id)
));
append(installInfo,
$('.more-info-entry', undefined,
$('div.more-info-entry-name', undefined, localize('Version', "Version")),
$('code', undefined, extension.manifest.version)
)
);
if (extension.type !== ExtensionType.System) {
append(installInfo,
$('.more-info-entry', undefined,
$('div.more-info-entry-name', undefined, localize('Version', "Version")),
$('code', undefined, extension.manifest.version)
)
);
}
if (extension.installedTimestamp) {
append(installInfo,
$('.more-info-entry', undefined,
Expand All @@ -1171,7 +1173,7 @@ class AdditionalDetailsWidget extends Disposable {
)
);
}
if (extension.source !== 'gallery') {
if (!extension.isBuiltin && extension.source !== 'gallery') {
const element = $('div', undefined, extension.source === 'vsix' ? localize('vsix', "VSIX") : localize('other', "Local"));
append(installInfo,
$('.more-info-entry', undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ export class SearchEditor extends AbstractTextCodeEditor<SearchEditorViewState>
if (!matchRanges) { return; }

const matchRange = (reverse ? findPrevRange : findNextRange)(matchRanges, currentPosition);
if (!matchRange) { return; }

this.searchResultEditor.setSelection(matchRange);
this.searchResultEditor.revealLineInCenterIfOutsideViewport(matchRange.startLineNumber);
Expand Down
2 changes: 0 additions & 2 deletions src/vs/workbench/contrib/testing/browser/media/testing.css
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@
.monaco-workbench .test-error-content-widget .inner {
margin-left: 20px;
color: var(--vscode-testing-message-error-badgeForeground) !important;
background: var(--vscode-testing-message-error-badgeBackground);
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
padding-right: 3px;
Expand Down Expand Up @@ -452,7 +451,6 @@
top: -1px;
width: 15px;
left: -10px;
fill: var(--vscode-testing-message-error-badgeBackground);
z-index: -1;
stroke-width: 0.71px; /* 1 / sqrt(2) */
stroke: var(--vscode-testing-message-error-badgeBorder);
Expand Down
22 changes: 17 additions & 5 deletions src/vs/workbench/contrib/testing/browser/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ export const testStatesToRetiredIconColors: { [K in TestResultState]?: string }
registerThemingParticipant((theme, collector) => {

const editorBg = theme.getColor(editorBackground);
const missBadgeBackground = editorBg && theme.getColor(testingUncoveredBackground)?.transparent(2).makeOpaque(editorBg);

collector.addRule(`
.coverage-deco-inline.coverage-deco-hit.coverage-deco-hovered {
Expand All @@ -194,9 +193,22 @@ registerThemingParticipant((theme, collector) => {
background: ${theme.getColor(testingUncoveredBackground)?.transparent(1.3)};
outline-color: ${theme.getColor(testingUncoveredBorder)?.transparent(2)};
}
.coverage-deco-branch-miss-indicator::before {
border-color: ${missBadgeBackground?.transparent(1.3)};
background-color: ${missBadgeBackground};
`);

if (editorBg) {
const missBadgeBackground = theme.getColor(testingUncoveredBackground)?.transparent(2).makeOpaque(editorBg);
const errorBadgeBackground = theme.getColor(messageBadgeBackground)?.makeOpaque(editorBg);
collector.addRule(`
.coverage-deco-branch-miss-indicator::before {
border-color: ${missBadgeBackground?.transparent(1.3)};
background-color: ${missBadgeBackground};
}
.monaco-workbench .test-error-content-widget .inner{
background: ${errorBadgeBackground};
}
.monaco-workbench .test-error-content-widget .inner .arrow svg {
fill: ${errorBadgeBackground};
}
`);
}
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { Emitter } from '../../../../base/common/event.js';
import { Iterable } from '../../../../base/common/iterator.js';
import { LinkedList } from '../../../../base/common/linkedList.js';
import { ResourceMap } from '../../../../base/common/map.js';
import { URI } from '../../../../base/common/uri.js';
import { IMainThreadTestCollection } from './testService.js';
Expand Down Expand Up @@ -184,8 +185,10 @@ export class MainThreadTestCollection extends AbstractIncrementalTestCollection<
}

private *getIterator() {
const queue = [this.rootIds];
while (queue.length) {
const queue = new LinkedList<Iterable<string>>();
queue.push(this.rootIds);

while (queue.size > 0) {
for (const id of queue.pop()!) {
const node = this.getNodeById(id)!;
yield node;
Expand Down
45 changes: 33 additions & 12 deletions src/vs/workbench/contrib/testing/common/testService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CancellationToken } from '../../../../base/common/cancellation.js';
import { Event } from '../../../../base/common/event.js';
import { Iterable } from '../../../../base/common/iterator.js';
import { IDisposable } from '../../../../base/common/lifecycle.js';
import { LinkedList } from '../../../../base/common/linkedList.js';
import { MarshalledId } from '../../../../base/common/marshallingIds.js';
import { IObservable } from '../../../../base/common/observable.js';
import { IPrefixTreeNode, WellDefinedPrefixTree } from '../../../../base/common/prefixTree.js';
Expand Down Expand Up @@ -172,24 +173,44 @@ const waitForTestToBeIdle = (testService: ITestService, test: IncrementalTestCol
* in strictly descending order.
*/
export const testsInFile = async function* (testService: ITestService, ident: IUriIdentityService, uri: URI, waitForIdle = true): AsyncIterable<IncrementalTestCollectionItem> {
for (const test of testService.collection.all) {
if (!test.item.uri) {
continue;
}
const queue = new LinkedList<Iterable<string>>();

if (ident.extUri.isEqual(uri, test.item.uri)) {
yield test;
}
const existing = [...testService.collection.getNodeByUrl(uri)];
queue.push(existing.length ? existing.map(e => e.item.extId) : testService.collection.rootIds);

if (ident.extUri.isEqualOrParent(uri, test.item.uri)) {
if (test.expand === TestItemExpandState.Expandable) {
await testService.collection.expand(test.item.extId, 1);
let n = 0;
while (queue.size > 0) {
for (const id of queue.pop()!) {
n++;
const test = testService.collection.getNodeById(id);
if (!test) {
continue; // possible because we expand async and things could delete
}

if (!test.item.uri) {
queue.push(test.children);
continue;
}

if (ident.extUri.isEqual(uri, test.item.uri)) {
yield test;
}
if (waitForIdle) {
await waitForTestToBeIdle(testService, test);

if (ident.extUri.isEqualOrParent(uri, test.item.uri)) {
if (test.expand === TestItemExpandState.Expandable) {
await testService.collection.expand(test.item.extId, 1);
}
if (waitForIdle) {
await waitForTestToBeIdle(testService, test);
}

if (test.children.size) {
queue.push(test.children);
}
}
}
}
console.log('iterated', n, 'times');
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
child-src 'self' data: blob:;
script-src 'self' 'unsafe-eval' 'sha256-xM2KVDKIoeb8vVxk4ezEUsxdTZh5wFnKO3YmFhy9tkk=' https: http://localhost:* blob:;
script-src 'self' 'unsafe-eval' 'sha256-cl8ijlOzEe+0GRCQNJQu2k6nUQ0fAYNYIuuKEm72JDs=' https: http://localhost:* blob:;
connect-src 'self' https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/>
</head>
<body>
<script>
(function () {
const searchParams = new URL(document.location.href).searchParams;
const vscodeWebWorkerExtHostId = searchParams.get('vscodeWebWorkerExtHostId') || '';
// DO NOT CHANGE the name of the worker without also updating js-debug, as that
// is used to filter targets to attach to (e.g. #232544)
const name = searchParams.get('debugged') ? 'DebugExtensionHostWorker' : 'ExtensionHostWorker';
const parentOrigin = searchParams.get('parentOrigin') || window.origin;
const salt = searchParams.get('salt');
Expand Down
Loading

0 comments on commit 2c27e8c

Please sign in to comment.