-
Notifications
You must be signed in to change notification settings - Fork 0
/
symbollist.js
55 lines (44 loc) · 1.27 KB
/
symbollist.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const vscode = require('vscode');
(function(){
let VSymbolList = {};
VSymbolList.knownSymbols = {};
let panel;
let refreshing = false;
let webPreamble = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Symbol List</title>
</head>
<body>`;
let updateTimeout = 40;
VSymbolList.startWebView = function(){
panel = vscode.window.createWebviewPanel('myob1','My Observables1',vscode.ViewColumn.Two,{});
// Set initial content
VSymbolList.updateWebview();
}
VSymbolList.updateWebview = function(){
panel.webview.html = VSymbolList.getWebviewContent();
}
VSymbolList.updateSymbolViewer = function (name,value){
VSymbolList.knownSymbols[name] = value;
if(refreshing)
return;
refreshing = true;
setTimeout(function(){
console.log("Refreshing value");
panel.webview.html = VSymbolList.getWebviewContent();
refreshing = false;
},updateTimeout);
}
VSymbolList.getWebviewContent = function(){
let output = webPreamble;
for(s in VSymbolList.knownSymbols){
output += `<p><b>${s}</b>: ${VSymbolList.knownSymbols[s]}</p>`;
}
output += "</body></html>";
return output;
}
module.exports = {VSymbolList}
})();