Skip to content

Commit 8d0daaf

Browse files
committed
DEV
1 parent 3825e8d commit 8d0daaf

1 file changed

Lines changed: 51 additions & 7 deletions

File tree

extension.js

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const DT = function () { return new Date().toISOString().substr(0, 19).replace('
1717
//
1818

1919
activate = function (context) {
20+
2021
//Object.keys(process.env).forEach(z => { console.log(z + '=' + process.env[z]); });
2122

2223
let devkingpath = 'W:\\DEV\\CODE\\DEVKING-VSCODE';
@@ -34,6 +35,8 @@ activate = function (context) {
3435

3536
LOG = DEVKINGLOG;
3637

38+
LOG('DEVKING.Activate');
39+
3740
//require('http').createServer((req, res) => { res.writeHead(200); res.end('DEVKING-VSCODE' + "\n" + req.url); console.log(req.url); }).listen(31337, '0.0.0.0');
3841

3942
//
@@ -86,10 +89,10 @@ activate = function (context) {
8689

8790
const GetWorkspaceFolder = function () {
8891
let path = false;
89-
try { path = vscode.workspace.workspaceFolders[0].uri.path; } catch (ex) { LOG(ex.message); }
92+
try { path = vscode.workspace.workspaceFolders[0].uri.path; } catch (ex) { } // LOG(ex.message); }
9093
if (path && path.substr(0, 1) == '/') { path = path.substr(1); }
9194
//vscode.window.showInformationMessage('WorkspaceFolder: ' + path);
92-
LOG('WorkspaceFolder: ' + path);
95+
//LOG('WorkspaceFolder: ' + path);
9396
return path;
9497
}
9598

@@ -249,7 +252,7 @@ activate = function (context) {
249252
command: { command: 'DEVKING.ITEMCLICK', title: 'CMD_TREEITEM', arguments: [q] },
250253
};
251254
return treeitem;
252-
};
255+
}
253256

254257
TREEDATA_LINKVIEW.getChildren = function (q) {
255258
return Object.keys(LINKS);
@@ -270,7 +273,7 @@ activate = function (context) {
270273
edit.set(document.uri, res)
271274
vscode.workspace.applyEdit(edit);
272275
*/
273-
});
276+
})
274277

275278
context.subscriptions.push(vscode.workspace.onWillSaveTextDocument(e => {
276279
let doc = e.document;
@@ -282,12 +285,53 @@ activate = function (context) {
282285

283286
let info = 'SAVE:' + doc.uri.scheme + ':' + eoltxt + ':' + doc.lineCount + ':' + doc.languageId;
284287
info = info.toUpperCase() + ': ' + doc.fileName;
285-
LOG(info);
286-
}));
288+
//LOG(info);
289+
}))
287290

288291
//
289292

290-
LOG('DEVKING.Activate');
293+
//LOG(context);
294+
//if (vscode.workspace.workspaceFolders) { LOG(vscode.workspace.workspaceFolders[0].uri.path); }
295+
296+
//
297+
298+
// vscode.workspace.onDidOpenTextDocument((z) => { });
299+
300+
SeenDocs = {};
301+
302+
// vscode.workspace.onDidChangeWorkspaceFolders((z) => { LOG(z) });
303+
304+
vscode.workspace.onDidCloseTextDocument((z) => {
305+
if (z.uri.scheme != 'file') { return; }
306+
//LOG('OnDidCloseTextDocument: ' + z.uri);
307+
LOG('Close: ' + z.uri);
308+
delete SeenDocs[z.uri];
309+
});
310+
311+
vscode.workspace.onDidSaveTextDocument((z) => {
312+
//LOG('OnDidSaveTextDocument: ' + z.uri);
313+
LOG('Save: ' + z.uri);
314+
});
315+
316+
vscode.workspace.onDidOpenTextDocument((z) => {
317+
if (z.uri.scheme != 'file') { return; }
318+
//LOG('OnDidOpenTextDocument: ' + z.uri);
319+
})
320+
321+
vscode.window.onDidChangeActiveTextEditor((z) => {
322+
if (z.document.uri.scheme != 'file') { return; }
323+
if (!SeenDocs[z.document.uri]) {
324+
//LOG('OnDidChangeActiveTextEditor: ' + z.document.uri);
325+
LOG('Open: ' + z.document.uri);
326+
SeenDocs[z.document.uri] = z;
327+
}
328+
})
329+
330+
//
331+
332+
LOG('DEVKING.ActivateDone');
333+
334+
LOG('Workspace: ' + GetWorkspaceFolder());
291335
}
292336

293337
deactivate = function () { }

0 commit comments

Comments
 (0)