Skip to content

Commit ddf09c0

Browse files
committed
Restore .vscode/
1 parent 8c2ef91 commit ddf09c0

File tree

7 files changed

+112
-19
lines changed

7 files changed

+112
-19
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.vscode/
21
node_modules/
32
out/
43
.eslintrc.json

.vscode/extensions.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint",
6+
"eamodio.tsl-problem-matcher"
7+
]
8+
}

.vscode/launch.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/dist/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
19+
},
20+
{
21+
"name": "Extension Tests",
22+
"type": "extensionHost",
23+
"request": "launch",
24+
"args": [
25+
"--extensionDevelopmentPath=${workspaceFolder}",
26+
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27+
],
28+
"outFiles": [
29+
"${workspaceFolder}/out/test/**/*.js"
30+
],
31+
"preLaunchTask": "npm: test-watch"
32+
}
33+
]
34+
}

.vscode/settings.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6+
},
7+
"search.exclude": {
8+
"out": true, // set this to false to include "out" folder in search results
9+
"dist": true // set this to false to include "dist" folder in search results
10+
},
11+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12+
"typescript.tsc.autoDetect": "off"
13+
}

.vscode/tasks.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": [
10+
"$ts-webpack-watch",
11+
"$tslint-webpack-watch"
12+
],
13+
"isBackground": true,
14+
"presentation": {
15+
"reveal": "never"
16+
},
17+
"group": {
18+
"kind": "build",
19+
"isDefault": true
20+
}
21+
},
22+
{
23+
"type": "npm",
24+
"script": "test-watch",
25+
"problemMatcher": "$tsc-watch",
26+
"isBackground": true,
27+
"presentation": {
28+
"reveal": "never"
29+
},
30+
"group": "build"
31+
}
32+
]
33+
}

src/extension.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,12 @@ export function activate(context: vscode.ExtensionContext) {
247247
});
248248
}
249249

250+
/**
251+
* Send a datapoint to the Webview.
252+
* @param key The type of data to send.
253+
* @param time Timestamp for the data value.
254+
* @param value Value of data.
255+
*/
250256
function postData(key: "memdata" | "cpudata", time: number, value: number) {
251257
try {
252258
// Make sure to catch promise rejections (when the webview has been closed but a message is still posted) with .then()
@@ -306,7 +312,7 @@ function getWin(pid: number) {
306312
parseInt(cpuitems[0]) * 60 * 60 +
307313
parseInt(cpuitems[1]) * 60 +
308314
parseInt(cpuitems[2]);
309-
let windowname = items[8];
315+
// let windowname = items[8];
310316
// Send data to webview
311317
postData("memdata", time, memkb * 1024);
312318
postData("cpudata", time, cputime / 1000);

webview/panel.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ const cpuCanvas = document.getElementById("cpu");
66
/** @type {CSSStyleDeclaration} */
77
const style = getComputedStyle(document.body);
88

9-
/** @type {String} */
9+
/** @type {string} */
1010
const themeWhite = style.getPropertyValue("--vscode-terminal-ansiWhite");
11-
/** @type {String} */
11+
/** @type {string} */
1212
const themeGrey = style.getPropertyValue("--vscode-terminal-ansiBrightBlack");
13-
/** @type {String} */
13+
/** @type {string} */
1414
const themeGreen = style.getPropertyValue("--vscode-terminal-ansiGreen");
1515

16-
/** @type {Map<Number, Number>} */
16+
/** @type {Map<number, number>} */
1717
var memory = new Map();
18-
/** @type {Map<Number, Number>} */
18+
/** @type {Map<number, number>} */
1919
var cpu = new Map();
2020

2121
/** Length in milliseconds to keep in logs. */
@@ -24,7 +24,7 @@ var length = 0;
2424
/**
2525
* Creates a string representation of time units.
2626
* @param {number} millis Time in milliseconds.
27-
* @returns {String} A string representing time and its unit with 1 decimal place.
27+
* @returns {string} A string representing time and its unit with 1 decimal place.
2828
*/
2929
function timeUnits(millis) {
3030
millis = Math.floor(millis);
@@ -42,7 +42,7 @@ function timeUnits(millis) {
4242
/**
4343
* Creates a string representation of memory units.
4444
* @param {number} bytes Number of bytes.
45-
* @returns {String} A string representing memory and its unit with 0 decimal places.
45+
* @returns {string} A string representing memory and its unit with 0 decimal places.
4646
*/
4747
function memUnits(bytes) {
4848
if (bytes >= 1024 ** 3) {
@@ -59,7 +59,7 @@ function memUnits(bytes) {
5959
/**
6060
* Creates a string representation of CPU utilization.
6161
* @param {number} cputime Percentage CPU utilization.
62-
* @returns {String} A string representing CPU utilization percentage with 2 decimal places.
62+
* @returns {string} A string representing CPU utilization percentage with 2 decimal places.
6363
*/
6464
function cpuUnits(cputime) {
6565
return Math.ceil(cputime * 100) / 100 + "%";
@@ -94,7 +94,7 @@ function updateGraph(
9494
let rangeX = maxX - minX;
9595

9696
// Decide on tick marks (this may eventually be scalable/zoomable)
97-
// Y - memory/cpu time
97+
// Y - memory usage/cpu time
9898
let intervalY = rangeY / ticksY;
9999
// X - time
100100
let intervalX = rangeX / ticksX;
@@ -105,19 +105,19 @@ function updateGraph(
105105
const marginBottom = 20;
106106

107107
// Calculate some values beforehand for readability
108-
/** Y location where the bottom of the graph should be on the canvas, in pixels. */
108+
/** Y location where the bottom of the graph should be on the {@link canvas}, in pixels. */
109109
let graphBottom = canvas.height - marginBottom;
110-
/** Distance between where the top and bottom of the graph should be on the canvas, in pixels. */
110+
/** Distance between where the top and bottom of the graph should be on the {@link canvas}, in pixels. */
111111
let graphHeight = canvas.height - marginBottom - marginTop;
112-
/** X location where the right edge of the graph should be on the canvas, in pixels. */
112+
/** X location where the right edge of the graph should be on the {@link canvas}, in pixels. */
113113
let graphRight = canvas.width - marginR;
114-
/** Distance between where the left and right edges of the graph should be on the canvas, in pixels. */
114+
/** Distance between where the left and right edges of the graph should be on the {@link canvas}, in pixels. */
115115
let graphWidth = canvas.width - marginR - marginL;
116116

117117
// Some functions to consistently get canvas location from graph values
118118
/**
119119
* @param {number} graphX An X data value from the graph.
120-
* @returns {number} The X location on the canvas where the data cooresponds to.
120+
* @returns {number} The X location on the {@link canvas} that the data corresponds to.
121121
*/
122122
function canvasX(graphX) {
123123
return Math.min(
@@ -130,7 +130,7 @@ function updateGraph(
130130
}
131131
/**
132132
* @param {number} graphY An Y data value from the graph.
133-
* @returns {number} The Y location on the canvas where the data cooresponds to.
133+
* @returns {number} The Y location on the {@link canvas} that the data corresponds to.
134134
*/
135135
function canvasY(graphY) {
136136
return Math.min(
@@ -194,7 +194,7 @@ function updateGraph(
194194
}
195195

196196
/**
197-
* Updates the memory graph based on the data in `memory` map.
197+
* Updates the memory graph based on the data in the {@link memory} map.
198198
*/
199199
function updateMem() {
200200
// Get bounds of graph
@@ -242,7 +242,7 @@ function updateMem() {
242242
}
243243

244244
/**
245-
* Updates the CPU graph based on the data in `cpu` map.
245+
* Updates the CPU graph based on the data in the {@link cpu} map.
246246
*/
247247
function updateCpu() {
248248
let maxCpu = 0;

0 commit comments

Comments
 (0)