Skip to content

Commit

Permalink
Fix: Issue : CSV could be more strictly formed
Browse files Browse the repository at this point in the history
  • Loading branch information
uctakeoff committed Apr 12, 2020
1 parent 5ea7f84 commit afa9d94
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
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
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/**
.vscode-test/**
.VSCodeCounter/**
out/test/**
src/**
.gitignore
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion 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.4",
"version": "1.3.5",
"publisher": "uctakeoff",
"author": {
"name": "Ushiyama Kentaro"
Expand Down
11 changes: 11 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
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

0 comments on commit afa9d94

Please sign in to comment.