File tree 3 files changed +9
-7
lines changed
3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 53
53
"main" : " ./out/extension.js" ,
54
54
"contributes" : {
55
55
"menus" : {
56
- "view/title " : [
56
+ "explorer/context " : [
57
57
{
58
58
"command" : " CodeViz.show" ,
59
- "when" : " true"
59
+ "when" : " explorerResourceIsFolder" ,
60
+ "group" : " 2_workspace"
60
61
}
61
62
]
62
63
},
Original file line number Diff line number Diff line change @@ -6,15 +6,14 @@ export class VSCCDataSource {
6
6
public date : String = '' ;
7
7
private _dataFolderUri : Uri ;
8
8
9
- public constructor ( wsUri : Uri ) {
9
+ public constructor ( wsUri : Uri , targetDir : Uri ) {
10
10
this . _dataFolderUri = Uri . joinPath ( wsUri , '.VSCodeCounter' ) ; ;
11
11
this . _selectDataSourceFolder ( wsUri ) ;
12
12
this . _readDataSource ( ) ;
13
13
}
14
14
15
15
private _selectDataSourceFolder ( wsUri : Uri ) {
16
16
let result : { date : String , path : String } [ ] = [ ] ;
17
- let vsccFolder = Uri . joinPath ( wsUri , '.VSCodeCounter' ) ;
18
17
const fs = require ( 'fs' ) ;
19
18
const dirPath = fs . readdirSync ( this . _dataFolderUri . fsPath ) ;
20
19
dirPath . map ( ( item : String ) => {
Original file line number Diff line number Diff line change @@ -33,17 +33,19 @@ export function activate(context: ExtensionContext) {
33
33
CCVizzuPanel . export ( folderPath ) ;
34
34
}
35
35
} ) ;
36
- const showCommand = commands . registerCommand ( "CodeViz.show" , ( ) => {
36
+ const showCommand = commands . registerCommand ( "CodeViz.show" , ( targetDir : Uri | undefined ) => {
37
37
let wsPath : Uri ;
38
38
workspace . workspaceFolders ?. map ( ( folder ) => {
39
39
if ( wsPath == undefined )
40
40
wsPath = folder . uri ;
41
41
} ) ;
42
- commands . executeCommand ( 'extension.vscode-counter.countInWorkspace' ) . then ( ( ) => {
42
+ commands . executeCommand ( 'extension.vscode-counter.countInDirectory' , targetDir ) . then ( ( ) => {
43
43
setTimeout ( ( ) => {
44
44
CCVizzuPanel . render ( context . extensionUri ) . then ( ( ) => {
45
45
let source : VSCCDataSource ;
46
- source = new VSCCDataSource ( wsPath ) ;
46
+ if ( targetDir == undefined )
47
+ targetDir = wsPath ;
48
+ source = new VSCCDataSource ( wsPath , targetDir ) ;
47
49
if ( source . data != undefined ) {
48
50
let data = new VSCCDataPrep ( ) ;
49
51
data . makeDataTable ( source . data ) ;
You can’t perform that action at this time.
0 commit comments