Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

marcuspang
Copy link

@marcuspang marcuspang commented Oct 17, 2024

Fixes: #6474

Changes

  • add status bar component
  • add enableStatusBar config item in vscode settings
  • made status bar component clickable to LSP logs

Let me know if more info should be added to the UI.

Screenshots

Hovering over the extension shows the following info:

Screenshot 2024-10-17 at 14 47 08

Enabling/disabling the setting works:

Screen.Recording.2024-10-17.at.14.47.26.mov

@lotem-starkware
Copy link

This change is Reviewable

@marcuspang marcuspang changed the title feat: add config change + version check VSCODE: add config change + version check Oct 17, 2024
@marcuspang marcuspang changed the title VSCODE: add config change + version check VSCode: add config change + version check Oct 17, 2024
@marcuspang marcuspang changed the title VSCode: add config change + version check VSCode: add status bar Oct 17, 2024
@marcuspang marcuspang marked this pull request as ready for review October 17, 2024 06:50
Copy link
Contributor

@mkaput mkaput left a 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:

  1. Move statusBarItem instance inside it, and keep StatusBar instance as a field in this Context. You should be able to use definite assignment assertion to resolve cyclic dependency.
  2. 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.

Copy link
Contributor

@mkaput mkaput left a 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)

Copy link
Author

@marcuspang marcuspang left a 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:

  1. Move statusBarItem instance inside it, and keep StatusBar instance as a field in this Context. You should be able to use definite assignment assertion to resolve cyclic dependency.
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VSCode statusbar widget
3 participants