From ca577458d89ffb1ae70a7a1ab03f7cf2f48b2193 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Sat, 17 Jul 2021 16:11:05 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20Fix=20#14=20and=20#16=20and?= =?UTF-8?q?=20probably=20#15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/collector.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/data/collector.ts b/src/data/collector.ts index dff837d..195d45f 100644 --- a/src/data/collector.ts +++ b/src/data/collector.ts @@ -12,7 +12,7 @@ export class DataCollector { } getTotalFileCount() { - return Object.keys(this.metadataCache.resolvedLinks).length; + return this.vault.getMarkdownFiles().length; } async getTotalWordCount() { @@ -20,7 +20,9 @@ export class DataCollector { const files = this.vault.getFiles(); for (const i in files) { const file = files[i]; - words += getWordCount(await this.vault.cachedRead(file)); + if (file.extension === "md") { + words += getWordCount(await this.vault.cachedRead(file)); + } } return words; @@ -31,7 +33,9 @@ export class DataCollector { const files = this.vault.getFiles(); for (const i in files) { const file = files[i]; - characters += getCharacterCount(await this.vault.cachedRead(file)); + if (file.extension === "md") { + characters += getCharacterCount(await this.vault.cachedRead(file)); + } } return characters; @@ -42,7 +46,9 @@ export class DataCollector { const files = this.vault.getFiles(); for (const i in files) { const file = files[i]; - sentence += getSentenceCount(await this.vault.cachedRead(file)); + if (file.extension === "md") { + sentence += getSentenceCount(await this.vault.cachedRead(file)); + } } return sentence; From 7a78e9e3b7e4ed9343edc47c965a851b4b8d6711 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Sat, 17 Jul 2021 16:13:05 +0200 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=94=96=20bump=200.7.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 9f884e4..4a1d349 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "better-word-count", "name": "Better Word Count", - "version": "0.7.6", + "version": "0.7.7", "description": "Counts the words of selected text in the editor.", "author": "Luke Leppan", "authorUrl": "https://lukeleppan.com", diff --git a/package.json b/package.json index faecbf9..226df4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-word-count", - "version": "0.7.6", + "version": "0.7.7", "description": "Counts the words of selected text in the editor.", "main": "main.js", "scripts": { From 847c0d0bfddc86ad6cd16d9b0876b6fe34646824 Mon Sep 17 00:00:00 2001 From: Luke Leppan Date: Sat, 17 Jul 2021 16:17:36 +0200 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=93=9D=20Update=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cdca81c..1c8647e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Better Word Count +# Better Word Count ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lukeleppan/better-word-count/Build%20Release?logo=github&style=for-the-badge) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/lukeleppan/better-word-count?style=for-the-badge) ![GitHub All Releases](https://img.shields.io/github/downloads/lukeleppan/better-word-count/total?style=for-the-badge) @@ -6,7 +6,7 @@ This plugin is the same as the built-in **Word Count** plugin, except when you s ![Better Count Word](https://raw.githubusercontent.com/lukeleppan/better-word-count/master/assets/better-word-count.gif) -### Features +## Features - Allows you to store statistics about your vault. - Works with all languages. @@ -17,16 +17,18 @@ This plugin is the same as the built-in **Word Count** plugin, except when you s - Total Files in vault. - Highly Customizable status bar that can be adapted to your needs. -#### TODO: +### TODO - [ ] add statistic view - [ ] add more statistics (make suggestions) - [ ] add goals -### Contributors +## Contributors - @leoccyao - Added all word, char, sentence count when not viewing a markdown file. +- @lishid + - Helped solve the performace issue. ### Special Thanks