Skip to content

Commit a2b4a79

Browse files
committed
Fix open files
1 parent 57588fc commit a2b4a79

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sharedlock",
33
"displayName": "SharedLock",
44
"description": "Sharing file locks in workspace files via network",
5-
"version": "0.3.7",
5+
"version": "0.3.8",
66
"publisher": "code4bones",
77
"icon": "resources/icons/logo.png",
88
"repository": {

src/commands.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as path from "path";
66
import * as fs from "fs";
77
import {glob} from "glob";
88
import mm from "micromatch";
9+
import { logger } from "./logger";
910

1011
export function registerCommands(ctx:vscode.ExtensionContext) {
1112
const ctrl = new Controller(ctx);
@@ -33,15 +34,19 @@ export function registerCommands(ctx:vscode.ExtensionContext) {
3334

3435
function ctxOpen(msg:LockMessage) {
3536
vscode.workspace.workspaceFolders?.forEach((ws)=>{
36-
const [ns,fileName] = msg.file.split(":");
37-
const mask = path.join(ws.uri.path,'**',ns,"**",fileName);
37+
const [,fileName] = msg.file.split(":");
38+
// const mask = path.join(ws.uri.path,'**',ns,"**",fileName);
39+
const mask = path.join(ws.uri.path,"**",fileName);
3840
glob(mask)
3941
.then((files)=>{
42+
console.log("FILES",files);
4043
if ( files?.length ) {
4144
const [file] = files;
4245
vscode.window.showTextDocument(vscode.Uri.parse(file));
4346
} else {
44-
vscode.window.showErrorMessage(`Cannot open document,using ${mask}`);
47+
const err = `Cannot file any files by ${mask}`;
48+
logger.error(err);
49+
vscode.window.showErrorMessage(err);
4550
}
4651
});
4752
});

src/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class Storage {
6161
this.sub = new Redis(connectOpts);
6262
this.pub = new Redis(connectOpts);
6363
this.sub.on("connect",()=>{
64-
let txt = `[redis]: Connection made to ${host}:${port} with auth ${username}/${password}`;
64+
let txt = `[redis]: Connection made to ${host}:${port}/${db} with auth ${username || '-'}/${password ||'-'}`;
6565
console.log(txt);
6666
logger.info(txt);
6767
this.sub.subscribe(channelID,(err,count) => {
@@ -448,7 +448,7 @@ export class Storage {
448448
*/
449449

450450
public dispose() {
451-
console.log("Killing connection");
451+
console.log("Extension stopped.");
452452
this.pub.disconnect(false);
453453
this.sub.disconnect(false);
454454
}

0 commit comments

Comments
 (0)