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: add support for strikeThrough #11999

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/git/src/browser/git-scm-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ export class GitScmProvider implements ScmProvider {
decorations: {
letter: GitFileStatus.toAbbreviation(change.status, change.staged),
color: GitFileStatus.getColor(change.status, change.staged),
tooltip: GitFileStatus.toString(change.status)
tooltip: GitFileStatus.toString(change.status),
strikeThrough: GitFileStatus.toStrikethrough(change.status)
},
open: async () => this.open(change, { mode: 'reveal' })
});
Expand Down
4 changes: 4 additions & 0 deletions packages/git/src/common/git-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ export namespace GitFileStatus {
}
}

export function toStrikethrough(status: GitFileStatus): boolean {
return status === GitFileStatus.Deleted;
}

}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/scm/src/browser/scm-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface ScmResourceDecorations {
source?: string;
letter?: string;
color?: string;
strikeThrough?: boolean;
}

export interface ScmCommand {
Expand Down
5 changes: 3 additions & 2 deletions packages/scm/src/browser/scm-tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ export class ScmResourceComponent extends ScmElement<ScmResourceComponent.Props>
const color = decoration && decoration.colorId ? `var(${colors.toCssVariableName(decoration.colorId)})` : '';
const letter = decoration && decoration.letter || '';
const tooltip = decoration && decoration.tooltip || '';
const textDecoration = treeNode.decorations?.strikeThrough === true ? 'line-through' : 'normal';
const relativePath = parentPath.relative(resourceUri.parent);
const path = relativePath ? relativePath.fsPath() : labelProvider.getLongName(resourceUri.parent);
const title = tooltip.length !== 0
Expand All @@ -554,8 +555,8 @@ export class ScmResourceComponent extends ScmElement<ScmResourceComponent.Props>
<span className={icon + ' file-icon'} />
{this.props.renderExpansionToggle()}
<div className={`noWrapInfo ${TREE_NODE_SEGMENT_GROW_CLASS}`} >
<span className='name'>{caption}</span>
<span className='path'>{path}</span>
<span className='name' style={{ textDecoration }}>{caption}</span>
<span className='path' style={{ textDecoration }}>{path}</span>
</div>
<ScmInlineActions {...{
hover,
Expand Down