From a5430b9acfcd251b30e43b8b41a8a9491bb61b69 Mon Sep 17 00:00:00 2001 From: Juha Ristolainen Date: Mon, 6 Jan 2020 14:42:11 +0000 Subject: [PATCH] Added code-runner-output and arduino-output to filtered out outputs --- CHANGELOG.md | 7 +++++++ README.md | 5 +++++ src/xp-counter.ts | 13 +++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0a4048..ce079f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to the "code-stats-vscode" extension will be documented in this file. +## [1.0.16] - 2020-01-06 + +### Changed + +Updated dependencies. +Filtered out certain output types like code runner output, etc. + ## [1.0.15] - 2019-04-04 ### Changed diff --git a/README.md b/README.md index 6bca24b..75a5286 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,11 @@ This extension contributes the following settings: ## Release Notes +### 1.0.16 + +Updated dependencies. +Added filtering out of some output languages like code runner, etc. + ### 1.0.15 Added Q# to languages. diff --git a/src/xp-counter.ts b/src/xp-counter.ts index 6b96ad7..f67c6dd 100644 --- a/src/xp-counter.ts +++ b/src/xp-counter.ts @@ -27,6 +27,12 @@ export class XpCounter { // wait 10s after each change in the document before sending an update private UPDATE_DELAY = 10000; + // List of detected output languages to filter out and not send to the backend. + private filterOutLanguages: string[] = [ + "arduino-output", + "code-runner-output" + ] + constructor(context: ExtensionContext) { this.pulse = new Pulse(); this.initAPI(); @@ -127,8 +133,11 @@ export class XpCounter { } private isSupportedLanguage(language: string): boolean { - // todo: check supported languages - // only update xp if one of supported languages + // Check if detected language is something we don't want to send to backend like the code runner output + if (this.filterOutLanguages.includes(language)) { + console.log("Filtering out " + language); + return false; + } return true; }