mirror of
https://gitlab.com/aviortheking/code-stats-vscode.git
synced 2025-04-22 10:52:13 +00:00
Added manual mapping to language names
This commit is contained in:
parent
e4d94c5878
commit
8695493a02
@ -6,6 +6,10 @@ All notable changes to the "code-stats-vscode" extension will be documented in t
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
## [1.0.4] - 2017-03-18
|
||||||
|
### Added
|
||||||
|
Added a manual mapping to natural language language names.
|
||||||
|
|
||||||
## [1.0.3] - 2017-03-18
|
## [1.0.3] - 2017-03-18
|
||||||
### Added
|
### Added
|
||||||
Added license for the logo from Nicd.
|
Added license for the logo from Nicd.
|
||||||
|
@ -18,6 +18,10 @@ This extension contributes the following settings:
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
### 1.0.4
|
||||||
|
|
||||||
|
Added a manual mapping to natural language language names.
|
||||||
|
|
||||||
### 1.0.3
|
### 1.0.3
|
||||||
|
|
||||||
Fixed an accumulation of XP bug.
|
Fixed an accumulation of XP bug.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "code-stats-vscode",
|
"name": "code-stats-vscode",
|
||||||
"displayName": "Code::Stats",
|
"displayName": "Code::Stats",
|
||||||
"description": "Code::Stats package for Visual Studio Code",
|
"description": "Code::Stats package for Visual Studio Code",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"publisher": "juha-ristolainen",
|
"publisher": "juha-ristolainen",
|
||||||
"icon": "logo.png",
|
"icon": "logo.png",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { Pulse } from "./pulse";
|
import { Pulse } from "./pulse";
|
||||||
import { getISOTimestamp } from "./utils";
|
import { getISOTimestamp, getLanguageName } from "./utils";
|
||||||
import * as axios from "axios";
|
import * as axios from "axios";
|
||||||
|
|
||||||
export class CodeStatsAPI {
|
export class CodeStatsAPI {
|
||||||
@ -30,8 +30,9 @@ export class CodeStatsAPI {
|
|||||||
const data = new ApiJSON(new Date());
|
const data = new ApiJSON(new Date());
|
||||||
|
|
||||||
for (let lang of pulse.xps.keys()) {
|
for (let lang of pulse.xps.keys()) {
|
||||||
|
let languageName: string = getLanguageName(lang);
|
||||||
let xp: number = pulse.getXP(lang);
|
let xp: number = pulse.getXP(lang);
|
||||||
data.xps.push(new ApiXP(lang, xp));
|
data.xps.push(new ApiXP(languageName, xp));
|
||||||
}
|
}
|
||||||
|
|
||||||
let json: string = JSON.stringify(data);
|
let json: string = JSON.stringify(data);
|
||||||
|
65
src/utils.ts
65
src/utils.ts
@ -18,3 +18,68 @@ export function getISOTimestamp(date: Date): string {
|
|||||||
prefix + pad(offset / 60) +
|
prefix + pad(offset / 60) +
|
||||||
pad(offset % 60);
|
pad(offset % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getLanguageName(langId: string): string {
|
||||||
|
// currently supported language ids in vscode as of 2017-03-18
|
||||||
|
let languageNames: { [key:string]: string; } = {
|
||||||
|
"plaintext": "Plain text",
|
||||||
|
"Log": "Log",
|
||||||
|
"bat": "bat",
|
||||||
|
"clojure": "Clojure",
|
||||||
|
"coffeescript": "CoffeeScript",
|
||||||
|
"c": "C",
|
||||||
|
"cpp": "C++",
|
||||||
|
"csharp": "C#",
|
||||||
|
"css": "CSS",
|
||||||
|
"diff": "Diff",
|
||||||
|
"dockerfile": "Docker",
|
||||||
|
"fsharpcss": "F#",
|
||||||
|
"git-commit": "Git",
|
||||||
|
"git-rebase": "Git",
|
||||||
|
"go": "Go",
|
||||||
|
"groovy": "Groovy",
|
||||||
|
"handlebars": "Handlebars",
|
||||||
|
"hlsl": "HLSL",
|
||||||
|
"html": "HTML",
|
||||||
|
"ini": ".ini",
|
||||||
|
"properties": ".properties",
|
||||||
|
"java": "Java",
|
||||||
|
"javascriptreact": "JavaScript (React)",
|
||||||
|
"javascript": "JavaScript",
|
||||||
|
"jsx-tags": "JavaScript (JSX)",
|
||||||
|
"json": "JSON",
|
||||||
|
"less": "CSS (LESS)",
|
||||||
|
"lua": "Lua",
|
||||||
|
"makefile": "Makefile",
|
||||||
|
"markdown": "Markdown",
|
||||||
|
"objective-c": "Objective-C",
|
||||||
|
"perl": "Perl",
|
||||||
|
"perl6": "Perl 6",
|
||||||
|
"php": "PHP",
|
||||||
|
"powershell": "PowerShell",
|
||||||
|
"jade": "Jade",
|
||||||
|
"python": "Python",
|
||||||
|
"r": "R",
|
||||||
|
"razor": "Razor",
|
||||||
|
"ruby": "Ruby",
|
||||||
|
"rust": "Rust",
|
||||||
|
"scss": "CSS (SCSS)",
|
||||||
|
"shaderlab": "Shaderlab",
|
||||||
|
"shellscript": "Shell script",
|
||||||
|
"sql": "SQL",
|
||||||
|
"swift": "Swift",
|
||||||
|
"typescript": "TypeScript",
|
||||||
|
"typescriptreact": "TypeScript (React)",
|
||||||
|
"vb": "Visual Basic",
|
||||||
|
"xml": "XML",
|
||||||
|
"xsl": "XSL",
|
||||||
|
"yaml": "YAML"
|
||||||
|
};
|
||||||
|
|
||||||
|
let languageName: string = languageNames[langId];
|
||||||
|
|
||||||
|
if (languageName === null || languageName === undefined) {
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
return languageName;
|
||||||
|
}
|
||||||
|
@ -18,6 +18,14 @@ export class XpCounter {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.pulse = new Pulse();
|
this.pulse = new Pulse();
|
||||||
|
|
||||||
|
/*
|
||||||
|
let allLanguages = languages.getLanguages().then(
|
||||||
|
(result => {
|
||||||
|
console.log(JSON.stringify(result));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
let config: WorkspaceConfiguration = workspace.getConfiguration("codestats");
|
let config: WorkspaceConfiguration = workspace.getConfiguration("codestats");
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user