Parcourir la source

Adds VFW to context menus

main
Eric Amodio il y a 1 an
Parent
révision
f7941b4f4b
3 fichiers modifiés avec 42 ajouts et 8 suppressions
  1. +30
    -5
      package.json
  2. +8
    -3
      src/plus/webviews/timeline/timelineWebview.ts
  3. +4
    -0
      src/views/nodes/viewNode.ts

+ 30
- 5
package.json Voir le fichier

@ -4661,7 +4661,7 @@
},
{
"command": "gitlens.showTimelinePage",
"title": "Open Visual File History of Active File",
"title": "Open Visual File History",
"category": "GitLens+",
"icon": "$(gitlens-history)"
},
@ -9463,11 +9463,16 @@
"group": "2_gitlens_1@1"
},
{
"command": "gitlens.quickOpenFileHistory",
"command": "gitlens.showTimelinePage",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editor.history && resourceScheme != output",
"group": "2_gitlens_1@2"
},
{
"command": "gitlens.quickOpenFileHistory",
"when": "gitlens:activeFileStatus =~ /tracked/ && config.gitlens.menus.editor.history && resourceScheme != output",
"group": "2_gitlens_1@3"
},
{
"submenu": "gitlens/editor/annotations",
"when": "editorTextFocus && gitlens:activeFileStatus =~ /blameable/ && config.gitlens.menus.editor.blame && resourceScheme != output",
"group": "2_gitlens_2@1"
@ -9707,9 +9712,14 @@
"group": "2_gitlens_1@1"
},
{
"command": "gitlens.quickOpenFileHistory",
"command": "gitlens.showTimelinePage",
"when": "gitlens:enabled && config.gitlens.menus.editorTab.history && isFileSystemResource",
"group": "2_gitlens_1@2"
},
{
"command": "gitlens.quickOpenFileHistory",
"when": "gitlens:enabled && config.gitlens.menus.editorTab.history && isFileSystemResource",
"group": "2_gitlens_1@3"
}
],
"explorer/context": [
@ -9741,11 +9751,16 @@
"group": "4_timeline@2"
},
{
"command": "gitlens.quickOpenFileHistory",
"command": "gitlens.showTimelinePage",
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled && config.gitlens.menus.explorer.history",
"group": "4_timeline@3"
},
{
"command": "gitlens.quickOpenFileHistory",
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled && config.gitlens.menus.explorer.history",
"group": "4_timeline@4"
},
{
"command": "gitlens.copyRemoteFileUrlWithoutRange",
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled && gitlens:hasRemotes && config.gitlens.menus.explorer.clipboard",
"group": "6_copypath@100"
@ -9887,9 +9902,14 @@
"group": "4_timeline@2"
},
{
"command": "gitlens.quickOpenFileHistory",
"command": "gitlens.showTimelinePage",
"when": "gitlens:enabled && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.history",
"group": "4_timeline@3"
},
{
"command": "gitlens.quickOpenFileHistory",
"when": "gitlens:enabled && scmProvider == git && scmResourceGroup =~ /^(workingTree|index|merge)$/ && config.gitlens.menus.scmItem.history",
"group": "4_timeline@4"
}
],
"timeline/item/context": [
@ -11118,6 +11138,11 @@
"group": "2_gitlens_quickopen@6"
},
{
"command": "gitlens.showTimelinePage",
"when": "viewItem =~ /gitlens:file\\b/",
"group": "2_gitlens_quickopen@7"
},
{
"submenu": "gitlens/commit/file/commit",
"when": "view =~ /^gitlens\\.views\\.(fileHistory|lineHistory)/ && viewItem =~ /gitlens:file\\b(?=.*?\\b\\+committed\\b)/",
"group": "3_gitlens_explore@1"

+ 8
- 3
src/plus/webviews/timeline/timelineWebview.ts Voir le fichier

@ -17,6 +17,7 @@ import type { Deferrable } from '../../../system/function';
import { debounce } from '../../../system/function';
import { filter } from '../../../system/iterable';
import { hasVisibleTextEditor, isTextEditor } from '../../../system/utils';
import { isViewFileNode } from '../../../views/nodes/viewNode';
import type { IpcMessage } from '../../../webviews/protocol';
import { onIpc } from '../../../webviews/protocol';
import type { WebviewController, WebviewProvider } from '../../../webviews/webviewController';
@ -81,9 +82,13 @@ export class TimelineWebviewProvider implements WebviewProvider {
_options: { column?: ViewColumn; preserveFocus?: boolean },
...args: unknown[]
): boolean {
const [uri] = args;
if (uri != null && uri instanceof Uri) {
this.updatePendingUri(uri);
const [uriOrNode] = args;
if (uriOrNode != null) {
if (uriOrNode instanceof Uri) {
this.updatePendingUri(uriOrNode);
} else if (isViewFileNode(uriOrNode)) {
this.updatePendingUri(uriOrNode.uri);
}
} else {
this.updatePendingEditor(window.activeTextEditor);
}

+ 4
- 0
src/views/nodes/viewNode.ts Voir le fichier

@ -165,6 +165,10 @@ export function isViewNode(node: any): node is ViewNode {
return node instanceof ViewNode;
}
export function isViewFileNode(node: any): node is ViewFileNode {
return node instanceof ViewFileNode;
}
type StateKey<T> = keyof T;
type StateValue<T, P extends StateKey<T>> = P extends keyof T ? T[P] : never;

Chargement…
Annuler
Enregistrer