Skip to content

Commit

Permalink
Merge pull request #27 from uctakeoff/develop
Browse files Browse the repository at this point in the history
ver.1.3.5
  • Loading branch information
uctakeoff authored Apr 12, 2020
2 parents d574690 + afa9d94 commit 13629d0
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
out
node_modules
.vscode-test/
.VSCodeCounter/
*.vsix
4 changes: 3 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/**
.vscode-test/**
.VSCodeCounter/**
out/test/**
src/**
.gitignore
Expand All @@ -8,4 +9,5 @@ vsc-extension-quickstart.md
**/tslint.json
**/*.map
**/*.ts
work/**
work/**
images/**
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

* workspace counter in status bar.

## [1.3.5]

### Fixed

- Issue : `CSV could be more strictly formed`.

## [1.3.4]

### Fixed

- Issue : `Handling symlinks`.

## [1.3.3]

### Added
Expand Down
File renamed without changes
7 changes: 1 addition & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-counter",
"displayName": "VS Code Counter",
"description": "Count lines of code in many programming languages.",
"version": "1.3.3",
"version": "1.3.5",
"publisher": "uctakeoff",
"author": {
"name": "Ushiyama Kentaro"
Expand All @@ -15,7 +15,7 @@
"theme": "dark"
},
"license": "SEE LICENSE IN LICENSE.txt",
"icon": "images/icon.png",
"icon": "icon.png",
"homepage": "https://github.com/uctakeoff/vscode-counter",
"repository": {
"type": "git",
Expand Down Expand Up @@ -45,25 +45,25 @@
"command": "extension.vscode-counter.countInFile",
"category": "VSCodeCounter",
"title": "%commands.countInFile.title%",
"icon": "images/icon.png"
"icon": "icon.png"
},
{
"command": "extension.vscode-counter.countInDirectory",
"category": "VSCodeCounter",
"title": "%commands.countInDirectory.title%",
"icon": "images/icon.png"
"icon": "icon.png"
},
{
"command": "extension.vscode-counter.countInWorkspace",
"category": "VSCodeCounter",
"title": "%commands.countInWorkspace.title%",
"icon": "images/icon.png"
"icon": "icon.png"
},
{
"command": "extension.vscode-counter.outputAvailableLanguages",
"category": "VSCodeCounter",
"title": "%commands.outputAvailableLanguages.title%",
"icon": "images/icon.png"
"icon": "icon.png"
}
],
"menus": {
Expand Down Expand Up @@ -263,7 +263,6 @@
"vscode-test": "^1.2.2"
},
"dependencies": {
"graceful-fs": "^4.2.3",
"jsonc-parser": "^2.2.0",
"minimatch": "^3.0.4"
}
Expand Down
19 changes: 16 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function activate(context: vscode.ExtensionContext) {
export function deactivate() {
}

const workspaceFolders = (): vscode.WorkspaceFolder[] => {
const workspaceFolders = (): readonly vscode.WorkspaceFolder[] => {
const folders = vscode.workspace.workspaceFolders;
return !folders ? [] : folders;
};
Expand Down Expand Up @@ -706,6 +706,7 @@ class ResultTable {
this.total.append(result);
});
}
/*
public toCSVLines() {
const languages = [...this.langResultTable.keys()];
return [
Expand All @@ -715,6 +716,16 @@ class ResultTable {
`Total, -, ${[...this.langResultTable.values()].map(r => r.code).join(', ')}, ${this.total.comment}, ${this.total.blank}, ${this.total.total}`
];
}
*/
public toCSVLines() {
const languages = [...this.langResultTable.keys()];
return [
`"filename", "language", "${languages.join('", "')}", "comment", "blank", "total"`,
...this.fileResults.sort((a,b) => a.filename < b.filename ? -1 : a.filename > b.filename ? 1 : 0)
.map(v => `"${v.filename}", "${v.language}", ${languages.map(l => l === v.language ? v.code : 0).join(', ')}, ${v.comment}, ${v.blank}, ${v.total}`),
`"Total", "-", ${[...this.langResultTable.values()].map(r => r.code).join(', ')}, ${this.total.comment}, ${this.total.blank}, ${this.total.total}`
];
}
public toTextLines() {
class TextTableFormatter {
private valueToString: (obj:any) => string;
Expand Down Expand Up @@ -889,18 +900,20 @@ function writeTextFile(outputFilename: string, text: string) {
}
*/
function makeDirectories_(dirpath: vscode.Uri, resolve: ()=> void, reject: (reason: string) => void) {
console.log(`makeDirectories ${dirpath}`);
// log(`makeDirectories ${dirpath}`);
vscode.workspace.fs.stat(dirpath).then((value) => {
if (value.type === vscode.FileType.Directory) {
if (value.type !== vscode.FileType.File) {
resolve();
} else {
reject(`${dirpath} is not directory.`);
}
}, (reason) => {
log(`vscode.workspace.fs.stat failed: ${reason}`);
const curPath = dirpath.path;
const parent = path.dirname(curPath);
if (parent !== curPath) {
makeDirectories_(dirpath.with({path: parent}), () => {
log(`vscode.workspace.fs.createDirectory ${dirpath}`);
vscode.workspace.fs.createDirectory(dirpath).then(resolve, reject);
}, reject);
} else {
Expand Down

0 comments on commit 13629d0

Please sign in to comment.