Skip to content

Commit a5c7a7d

Browse files
some optimizations
1 parent 9d5133e commit a5c7a7d

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"displayName": "pocketpy",
44
"icon": "icon.png",
55
"description": "pocketpy development tools for VSCode",
6-
"version": "0.0.5",
6+
"version": "0.0.6",
77
"publisher": "pocketpy",
88
"repository": {
99
"type": "git",
1010
"url": "https://github.com/pocketpy/pocketpy-vscode-extension"
1111
},
1212
"engines": {
13-
"vscode": "^1.97.0"
13+
"vscode": "^1.80.0"
1414
},
1515
"categories": [
1616
"Programming Languages",

samples/.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
{
2-
"files.readonlyInclude": {}
32
}

src/extension.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function activate(context: vscode.ExtensionContext) {
5555

5656
// Step 4: Create a decorator to render per-line metrics at line start
5757
if (currentLineProfiler) {
58-
try { currentLineProfiler.dispose(); currentLineProfiler.clearReadOnlyConfig() } catch { /* ignore */ }
58+
try { currentLineProfiler.dispose(); LineProfilerDecorator.clearReadOnlyConfig() } catch { /* ignore */ }
5959
}
6060

6161

@@ -79,12 +79,12 @@ export function activate(context: vscode.ExtensionContext) {
7979
}
8080
await vscode.commands.executeCommand('setContext', 'pocketpy.isInProfilerReportMode', false);
8181
currentLineProfiler.dispose();
82-
currentLineProfiler.clearReadOnlyConfig();
82+
LineProfilerDecorator.clearReadOnlyConfig();
8383
currentLineProfiler = undefined;
8484
});
8585
context.subscriptions.push(quitProfilerReportMode);
8686

87-
vscode.workspace.getConfiguration("files").update("readonlyInclude", {}, vscode.ConfigurationTarget.Workspace);
87+
LineProfilerDecorator.clearReadOnlyConfig();
8888

8989
}
9090

@@ -241,9 +241,9 @@ class LineProfilerDecorator implements vscode.Disposable {
241241

242242
private getBlockColors(): string[] {
243243
return [
244-
"#9C27B0",
245244
"#2196F3",
246245
"#4CAF50",
246+
"#9C27B0",
247247
"#FF9800",
248248
"#F44336",
249249
];
@@ -288,7 +288,7 @@ class LineProfilerDecorator implements vscode.Disposable {
288288
}
289289

290290
private generateBackgroundColor(ratio: number): string {
291-
const alpha = +(ratio * 0.8).toFixed(2);
291+
const alpha = +(ratio * 0.5).toFixed(2);
292292
const hue = 210;
293293
const saturation = 60;
294294
const lightness = 65;
@@ -425,12 +425,8 @@ class LineProfilerDecorator implements vscode.Disposable {
425425
}
426426
}
427427

428-
public async clearReadOnlyConfig(): Promise<void> {
429-
const currentInclude: { [key: string]: boolean } = vscode.workspace.getConfiguration("files").get("readonlyInclude", {});
430-
for (const path of this.analysisFilesSet) {
431-
currentInclude[path] = false;
432-
}
433-
await vscode.workspace.getConfiguration("files").update("readonlyInclude", currentInclude, vscode.ConfigurationTarget.Workspace);
428+
public static clearReadOnlyConfig(): void {
429+
vscode.workspace.getConfiguration("files").update("readonlyInclude", undefined, vscode.ConfigurationTarget.Workspace);
434430
}
435431

436432
private formatDuration(clockTicks: number): string {

0 commit comments

Comments
 (0)