This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from Microsoft/users/jpricket/0202
Viewlet shows list of files
- Loading branch information
Showing
31 changed files
with
935 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"engines": { | ||
"vscode": "^1.7.0" | ||
}, | ||
"enableProposedApi": false, | ||
"activationEvents": [ | ||
"*" | ||
], | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
"use strict"; | ||
|
||
import { SCMResourceDecorations, Uri } from "vscode"; | ||
import { ConflictType, Status } from "./status"; | ||
import * as path from "path"; | ||
|
||
export class DecorationProvider { | ||
private static iconsRootPath: string = path.join(path.dirname(__dirname), "..", "..", "resources", "icons"); | ||
|
||
public static getDecorations(status: Status, conflictType?: ConflictType): SCMResourceDecorations { | ||
const light = { iconPath: DecorationProvider.getIconPath(status, "light") }; | ||
const dark = { iconPath: DecorationProvider.getIconPath(status, "dark") }; | ||
|
||
return { strikeThrough: DecorationProvider.useStrikeThrough(status, conflictType), light, dark }; | ||
} | ||
|
||
private static getIconUri(iconName: string, theme: string): Uri { | ||
return Uri.file(path.join(DecorationProvider.iconsRootPath, theme, `${iconName}.svg`)); | ||
} | ||
|
||
private static getIconPath(status: Status, theme: string): Uri | undefined { | ||
switch (status) { | ||
case Status.ADD: return DecorationProvider.getIconUri("status-add", theme); | ||
case Status.BRANCH: return DecorationProvider.getIconUri("status-branch", theme); | ||
case Status.DELETE: return DecorationProvider.getIconUri("status-delete", theme); | ||
case Status.EDIT: return DecorationProvider.getIconUri("status-edit", theme); | ||
case Status.LOCK: return DecorationProvider.getIconUri("status-lock", theme); | ||
case Status.MERGE: return DecorationProvider.getIconUri("status-merge", theme); | ||
case Status.RENAME: return DecorationProvider.getIconUri("status-rename", theme); | ||
case Status.UNDELETE: return DecorationProvider.getIconUri("status-undelete", theme); | ||
default: return void 0; | ||
} | ||
} | ||
|
||
private static useStrikeThrough(status: Status, conflictType: ConflictType): boolean { | ||
return (status === Status.DELETE) || | ||
(status === Status.MERGE && | ||
(conflictType === ConflictType.DELETE || conflictType === ConflictType.DELETE_TARGET)); | ||
} | ||
} |
Oops, something went wrong.