-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSCode: add status bar #6497
base: main
Are you sure you want to change the base?
VSCode: add status bar #6497
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Arcticae, @Draggu, @marcuspang, @mkaput, @orizi, and @piotmag769)
a discussion (no related file):
🤩
vscode-cairo/package.json
line 144 at r2 (raw file):
"description": "Show Cairo Language Server information", "scope": "window" }
I did a quick search in popular extensions and these name & description pattern seem to be a convergent style used by most of them.
Suggestion:
"cairo1.showInStatusBar": {
"type": "boolean",
"default": true,
"description": "Show CairoLS information in the status bar.",
"scope": "window"
}
vscode-cairo/src/context.ts
line 12 at r2 (raw file):
}), ); const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100);
Consider encapsulating all the logic and state in a StatusBar
class, that is:
- Move
statusBarItem
instance inside it, and keepStatusBar
instance as a field in thisContext
. You should be able to use definite assignment assertion to resolve cyclic dependency. - Make
setupStatusBar
etc. plain methods there.
vscode-cairo/src/extension.ts
line 24 at r2 (raw file):
ctx.log.warn("status bar is disabled"); ctx.log.warn("note: set `cairo1.enableStatusBar` to `true` to enable it"); }
imo no need to pollute logs about this
Suggestion:
if (ctx.config.get("enableStatusBar")) {
await setupStatusBar(ctx, client);
}
vscode-cairo/src/statusBar.ts
line 40 at r2 (raw file):
try { const scarb = await Scarb.find(vscode.workspace.workspaceFolders?.[0], ctx);
We will probably want to query CairoLS (via custom request type) because it might have more context than the extension. But this is definitely a topic for separate PR, though. I'll make a separate issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Arcticae, @Draggu, @marcuspang, @orizi, and @piotmag769)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 6 files reviewed, 4 unresolved discussions (waiting on @Arcticae, @Draggu, @mkaput, @orizi, and @piotmag769)
vscode-cairo/package.json
line 144 at r2 (raw file):
Previously, mkaput (Marek Kaput) wrote…
I did a quick search in popular extensions and these name & description pattern seem to be a convergent style used by most of them.
Done.
vscode-cairo/src/context.ts
line 12 at r2 (raw file):
Previously, mkaput (Marek Kaput) wrote…
Consider encapsulating all the logic and state in a
StatusBar
class, that is:
- Move
statusBarItem
instance inside it, and keepStatusBar
instance as a field in thisContext
. You should be able to use definite assignment assertion to resolve cyclic dependency.- Make
setupStatusBar
etc. plain methods there.
Done.
vscode-cairo/src/extension.ts
line 24 at r2 (raw file):
Previously, mkaput (Marek Kaput) wrote…
imo no need to pollute logs about this
Done.
vscode-cairo/src/statusBar.ts
line 40 at r2 (raw file):
Previously, mkaput (Marek Kaput) wrote…
We will probably want to query CairoLS (via custom request type) because it might have more context than the extension. But this is definitely a topic for separate PR, though. I'll make a separate issue for this.
Gotcha Ill copy over the TODO in cairols.ts
Fixes: #6474
Changes
enableStatusBar
config item in vscode settingsLet me know if more info should be added to the UI.
Screenshots
Hovering over the extension shows the following info:
Enabling/disabling the setting works:
Screen.Recording.2024-10-17.at.14.47.26.mov