Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCM - improve SourceControlResourceState comparison #198161

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/vs/workbench/api/common/extHostSCM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,24 @@ import { MarkdownString } from 'vs/workbench/api/common/extHostTypeConverters';
import { checkProposedApiEnabled, isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import { Schemas } from 'vs/base/common/network';
import { isLinux } from 'vs/base/common/platform';

type ProviderHandle = number;
type GroupHandle = number;
type ResourceStateHandle = number;

function isUri(thing: any): thing is vscode.Uri {
return thing instanceof URI;
}

function uriEquals(a: vscode.Uri, b: vscode.Uri): boolean {
if (a.scheme === Schemas.file && b.scheme === Schemas.file && isLinux) {
return a.toString() === b.toString();
}

return a.toString().toLowerCase() === b.toString().toLowerCase();
}

function getIconResource(decorations?: vscode.SourceControlResourceThemableDecorations): UriComponents | ThemeIcon | undefined {
if (!decorations) {
return undefined;
Expand Down Expand Up @@ -166,6 +179,10 @@ function compareCommands(a: vscode.Command, b: vscode.Command): number {
continue;
}

if (isUri(aArg) && isUri(bArg) && uriEquals(aArg, bArg)) {
continue;
}

return aArg < bArg ? -1 : 1;
}

Expand Down