mirror of
https://gitlab.com/aviortheking/code-stats-vscode.git
synced 2025-04-22 10:52:13 +00:00
Merge branch 'thebird956/code-stats-vscode-update-to-webview'
This commit is contained in:
commit
a2ddfbea59
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
All notable changes to the "code-stats-vscode" extension will be documented in this file.
|
All notable changes to the "code-stats-vscode" extension will be documented in this file.
|
||||||
|
|
||||||
|
## [1.0.15] - 2019-04-04
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
Merged PR from thebird956:
|
||||||
|
Replaced deprecated 'vscode.previewHtml' command to the webview API.
|
||||||
|
|
||||||
## [1.0.14] - 2019-04-04
|
## [1.0.14] - 2019-04-04
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -24,6 +24,11 @@ This extension contributes the following settings:
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
### 1.0.15
|
||||||
|
|
||||||
|
Merged PR from thebird956:
|
||||||
|
Replaced deprecated 'vscode.previewHtml' command to the webview API.
|
||||||
|
|
||||||
### 1.0.14
|
### 1.0.14
|
||||||
|
|
||||||
Updated deps and moved to latest VS code engine.
|
Updated deps and moved to latest VS code engine.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<link rel="stylesheet" href="file:///${style}">
|
<link rel="stylesheet" href="${style}">
|
||||||
<div class="profile">
|
<div class="profile">
|
||||||
<h3> ${profile.user} <sup>${profile.level}</sup> ${profile.total_xp} xp
|
<h3> ${profile.user} <sup>${profile.level}</sup> ${profile.total_xp} xp
|
||||||
<% if( profile.new_xp > 0 ) { %>
|
<% if( profile.new_xp > 0 ) { %>
|
||||||
|
5358
package-lock.json
generated
5358
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,14 @@
|
|||||||
"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.14",
|
"version": "1.0.15",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publisher": "riussi",
|
"publisher": "riussi",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Valentin Ivanov (https://github.com/scout119)",
|
"Valentin Ivanov (https://github.com/scout119)",
|
||||||
"Paul Ryan (https://github.com/sharpred)",
|
"Paul Ryan (https://github.com/sharpred)",
|
||||||
"Mikko Ahlroth (https://github.com/Nicd)"
|
"Mikko Ahlroth (https://github.com/Nicd)",
|
||||||
|
"Julien Stébenne <julien.stebenne@gmail.com> (https://github.com/thebird956)"
|
||||||
],
|
],
|
||||||
"icon": "logo.png",
|
"icon": "logo.png",
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -70,4 +71,4 @@
|
|||||||
"axios": "0.18.0",
|
"axios": "0.18.0",
|
||||||
"lodash.template": "^4.4.0"
|
"lodash.template": "^4.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { CancellationToken, Event, ExtensionContext, TextDocumentContentProvider, Uri } from "vscode";
|
import { CancellationToken, Event, ExtensionContext, TextDocumentContentProvider, Uri } from "vscode";
|
||||||
import { CodeStatsAPI } from "./code-stats-api";
|
import { CodeStatsAPI } from "./code-stats-api";
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import template = require('lodash.template');
|
import template = require('lodash.template');
|
||||||
|
|
||||||
@ -88,7 +89,10 @@ export class ProfileProvider implements TextDocumentContentProvider {
|
|||||||
|
|
||||||
let html = template(htmlTemplate);
|
let html = template(htmlTemplate);
|
||||||
|
|
||||||
return html({profile: profile, languages: languages, machines: machines, style: this.context.asAbsolutePath("assets/profile.css")});
|
const stylePath = Uri.file(path.join(this.context.extensionPath, 'assets', 'profile.css'));
|
||||||
|
const styleSrc = stylePath.with({scheme: 'vscode-resource'});
|
||||||
|
|
||||||
|
return html({profile: profile, languages: languages, machines: machines, style: styleSrc});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// tslint:disable-next-line:max-line-length
|
|
||||||
import {
|
import {
|
||||||
Disposable,
|
Disposable,
|
||||||
workspace,
|
workspace,
|
||||||
@ -10,13 +9,13 @@ import {
|
|||||||
TextDocument,
|
TextDocument,
|
||||||
StatusBarAlignment,
|
StatusBarAlignment,
|
||||||
TextDocumentChangeEvent,
|
TextDocumentChangeEvent,
|
||||||
Range,
|
|
||||||
WorkspaceConfiguration,
|
WorkspaceConfiguration,
|
||||||
ExtensionContext
|
ExtensionContext
|
||||||
} from "vscode";
|
} from "vscode";
|
||||||
import { Pulse } from "./pulse";
|
import { Pulse } from "./pulse";
|
||||||
import { CodeStatsAPI } from "./code-stats-api";
|
import { CodeStatsAPI } from "./code-stats-api";
|
||||||
import { ProfileProvider } from "./profile-provider";
|
import { ProfileProvider } from "./profile-provider";
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
export class XpCounter {
|
export class XpCounter {
|
||||||
private combinedDisposable: Disposable;
|
private combinedDisposable: Disposable;
|
||||||
@ -25,23 +24,11 @@ export class XpCounter {
|
|||||||
private api: CodeStatsAPI;
|
private api: CodeStatsAPI;
|
||||||
private updateTimeout: any;
|
private updateTimeout: any;
|
||||||
|
|
||||||
// private languages: Array<string> = ["typescript", "javascript"];
|
|
||||||
|
|
||||||
// wait 10s after each change in the document before sending an update
|
// wait 10s after each change in the document before sending an update
|
||||||
private UPDATE_DELAY = 10000;
|
private UPDATE_DELAY = 10000;
|
||||||
|
|
||||||
|
|
||||||
constructor(context: ExtensionContext) {
|
constructor(context: ExtensionContext) {
|
||||||
this.pulse = new Pulse();
|
this.pulse = new Pulse();
|
||||||
|
|
||||||
/* // print out supported language names
|
|
||||||
let allLanguages = languages.getLanguages().then(
|
|
||||||
(result => {
|
|
||||||
console.log(JSON.stringify(result));
|
|
||||||
})
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
this.initAPI();
|
this.initAPI();
|
||||||
|
|
||||||
let subscriptions: Disposable[] = [];
|
let subscriptions: Disposable[] = [];
|
||||||
@ -68,8 +55,19 @@ export class XpCounter {
|
|||||||
window.showErrorMessage('codestats.username configuration setting is missing');
|
window.showErrorMessage('codestats.username configuration setting is missing');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const panel = window.createWebviewPanel(
|
||||||
|
'codeStatsPanel',
|
||||||
|
'Code::Stats Profile',
|
||||||
|
ViewColumn.Two,
|
||||||
|
{
|
||||||
|
localResourceRoots: [Uri.file(path.join(context.extensionPath, 'assets'))]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
commands.executeCommand('vscode.previewHtml', Uri.parse('code-stats://profile'), ViewColumn.Two, 'Code::Stats Profile');
|
workspace.openTextDocument(Uri.parse('code-stats://profile')).then((value) => {
|
||||||
|
panel.webview.html = value.getText();
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
workspace.onDidChangeTextDocument(
|
workspace.onDidChangeTextDocument(
|
||||||
@ -154,7 +152,7 @@ export class XpCounter {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
if( this.api != null )
|
if(this.api != null )
|
||||||
this.api.updateSettings(apiKey, apiURL, userName);
|
this.api.updateSettings(apiKey, apiURL, userName);
|
||||||
else
|
else
|
||||||
this.api = new CodeStatsAPI(apiKey,apiURL,userName);
|
this.api = new CodeStatsAPI(apiKey,apiURL,userName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user