chore: more clear warning messages
mellbacon committed
Jul 14, 2023 at 14:55 UTC
57e2ae50f461327172e7d76cfd7f9c49797ff9dd
1 file changed
+4
-4
src/lib/Tab/Tab.ts
+4
-4
@@ -8,6 +8,7 @@ export class Tab {
8
activeid = this.id;
9
tablist = [];
10
Tab; // Tab class
11
+ activeTab = null;
12
hidden = writable(true);
13
isfile = writable(false);
14
tabs = writable([]);
@@ -27,6 +28,7 @@ export class Tab {
28
else {
29
this.isfile.set(false);
30
}
31
+ this.activeTab = tab;
32
}
33
else {
34
tab.active = false;
@@ -72,8 +74,7 @@ export class Tab {
74
try {
75
fileContent = await fs.readTextFile(path); //TODO: Fix performance issues/loading times on large files
76
} catch (error) {
75
- console.error(error);
76
- console.warn("Can't read file content. Setting to empty string.");
77
+ console.warn("Can't read file content. Setting to empty string. Error: ", error);
78
}
79
let content = new Editor({target: document.getElementById("tabview"), props: {content: fileContent}});
80
let tab = new this.Tab(this.id, label, content, path);
@@ -84,10 +85,9 @@ export class Tab {
85
try {
86
fileType = await p.extname(tab.path);
87
} catch (error) {
87
- console.warn("Cannot find file extension. Setting to empty string.")
88
+ console.warn("Cannot find file extension.")
89
fileType = "";
90
}
90
-
91
content.updateFileInfo({
92
"filename": tab.label,
93
"path": tab.path,