Skip to content

Allow toolbar buttons visibility to be configured via settings #1598

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

matthieucan
Copy link

@matthieucan matthieucan commented Mar 9, 2025

Overview

Problem

Hi! Thanks for the great extension.

I would like the toolbar buttons to be configurable so they can be hidden. I find the long list (7 buttons) prone to misclicks, and there are some that I don't use as they are not relevant for my projects.

Solution

Make every button conditionally appear, via an associated setting. By default, they are all present, so this does not alter the current behavior.

Screenshot/Demo

A simplified toolbar with only the "Run" and "Test" buttons enabled:
Screenshot 2025-03-09 at 21 56 14

How to test

  • Run this branch
  • Go to Settings, and uncheck the options "Enable the 'xxx' button in SQL files"
  • Open an SQL file, look at the toolbar

Checklist

  • I have run this code and it appears to resolve the stated issue
  • README.md updated and added information about my change

Important

Toolbar buttons in SQL files are now configurable via new boolean settings in package.json, allowing users to hide unused buttons.

  • Behavior:
    • Toolbar buttons in SQL files can now be conditionally hidden via new boolean settings in package.json.
    • Default behavior remains unchanged; all buttons are visible unless settings are modified.
  • Settings:
    • Added settings: dbt.enableBuildModel, dbt.enableExecuteSql, dbt.enableSqlQuickPick, dbt.enableRunModel, dbt.enableTestModel, dbt.enableSqlPreview, dbt.enableConvertToModel.
  • Commands:
    • Updated editor/title and editor/title/run commands to check new settings before displaying buttons.

This description was created by Ellipsis for 253ae83. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • New Features
    • Introduced new user-configurable options to control SQL file functionalities.
    • Added the ability to enable or disable several interactive buttons for building, executing, running, testing, previewing, and converting models.
    • Enhanced control settings ensure these features are activated only when desired, providing a more customizable user experience.

Copy link
Contributor

coderabbitai bot commented Mar 9, 2025

Walkthrough

This update modifies the package.json file by adding several new configuration properties under the dbt namespace. These boolean properties, all defaulting to true, allow users to enable or disable specific SQL file functionalities such as building, executing, testing, running, previewing, and converting dbt models. Additionally, the conditions for enabling related commands in the editor title sections were updated to incorporate these configuration properties.

Changes

File Summary
package.json Added new boolean configuration properties under dbt (enableBuildModel, enableExecuteSql, enableSqlQuickPick, enableRunModel, enableTestModel, enableSqlPreview, enableConvertToModel) with defaults set to true, and updated command conditions in editor title sections to respect these flags.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant E as Editor
    participant C as Config Checker
    participant X as Command Executor

    U->>E: Attempt to trigger SQL action (e.g., Execute SQL)
    E->>C: Check corresponding dbt configuration (e.g., dbt.enableExecuteSql)
    C-->>E: Return true/false
    alt Configuration enabled
        E->>X: Execute corresponding SQL command
        X-->>U: Command executed
    else Configuration disabled
        E-->>U: Command not available
    end
Loading

Suggested reviewers

  • mdesmet

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3481bf2 and 511198e.

📒 Files selected for processing (1)
  • package.json (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 253ae83 in 2 minutes and 44 seconds

More details
  • Looked at 124 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. package.json:229
  • Draft comment:
    New configuration settings for toolbar button visibility are added correctly. Consider updating the README or documentation to describe these new options, so users know how to customize the toolbar.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative and suggests updating documentation, which is against the rules. It doesn't provide a specific code suggestion or highlight a potential issue with the code itself.
2. package.json:868
  • Draft comment:
    When conditions in the menu contributions now include configuration checks. To reduce repetitive code, consider extracting the common language regex (resourceLangId =~ /^sql$|^jinja-sql$/) into a reusable constant or variable.
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. package.json:958
  • Draft comment:
    Updated 'editor/title/run' menu commands include config checks for build model actions. Ensure that the selected configuration key (e.g., config.dbt.enableBuildModel) is used consistently with your intended behavior, especially since there are separate settings for running a model vs building a model.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the author to ensure that a configuration key is used consistently with the intended behavior. This is a request for confirmation of intention, which violates the rules. The comment does not provide a specific code suggestion or ask for a specific test to be written. Therefore, it should be removed.
4. package.json:232
  • Draft comment:
    New configuration properties for toggling toolbar buttons are added here. Please update the README/documentation to describe these new settings so users know how to control toolbar visibility.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is asking the PR author to update the documentation, which is not allowed according to the rules. The comment is purely informative and does not provide a specific code suggestion or ask for a test to be written.
5. package.json:869
  • Draft comment:
    Toolbar command entries now consistently append configuration checks (e.g., '&& config.dbt.enableExecuteSql'). Verify that using 'dbt.enableBuildModel' for both model and project build commands is the intended behavior.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
6. package.json:262
  • Draft comment:
    Minor typographical inconsistency: in the description for 'dbt.enableConvertToModel', 'model' is written in lowercase ('Convert to dbt model') while similar settings use 'Model' (e.g., 'Run dbt Model', 'Test dbt Model'). Consider capitalizing it ('Convert to dbt Model') for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
    Looking at the rules, UI and styling changes should be ignored. While this is technically about consistency in labels, it falls under UI styling which we're told to assume the author handled correctly. Additionally, this is a very minor issue that doesn't affect functionality.
    Could inconsistent capitalization in UI elements cause confusion for users? Could this be considered a documentation issue rather than just UI styling?
    While consistency is good, this is fundamentally about UI presentation and button labels, which the rules explicitly tell us to ignore. The meaning is clear regardless of capitalization.
    Delete the comment as it relates to UI styling choices which we're instructed to ignore.

Workflow ID: wflow_QaPh12cvgq7qVStH


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@mdesmet
Copy link
Contributor

mdesmet commented Mar 10, 2025

This is OOTB supported by vscode. I don't have big objection but these things are sometimes easy to overlook when maintaining the extension. So I prefer to not support any features that are already supported by vscode.

image

@matthieucan
Copy link
Author

This is OOTB supported by vscode. I don't have big objection but these things are sometimes easy to overlook when maintaining the extension. So I prefer to not support any features that are already supported by vscode.

You're right! However, I think this can't be configured through .vscode/settings.json in a given project?

"group": "inline"
},
{
"command": "dbtPowerUser.runCurrentModel",
"when": "resourceLangId =~ /^sql$|^jinja-sql$/",
"when": "resourceLangId =~ /^sql$|^jinja-sql$/ && config.dbt.enableBuildModel",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be enableRunModel? @matthieucan

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one is trickier than the others: all the actions within the single button "Build project" are behind a single flag.
This allows to display/hide the entire group (the button with the down arrow), rather than sub-items in this group. Only hiding a subset of the sub-items within this button would not hide the button itself, therefore it would be less useful IMO.

Does that make sense?

@anandgupta42
Copy link
Contributor

@mdesmet @saravmajestic We will have to update the docs also - https://docs.myaltimate.com/setup/configuration/

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.

4 participants