Skip to content

Allow toolbar buttons visibility to be configured via settings#1598

Closed
matthieucan wants to merge 6 commits intoAltimateAI:masterfrom
matthieucan:matthieucan/toolbar-control-settings
Closed

Allow toolbar buttons visibility to be configured via settings#1598
matthieucan wants to merge 6 commits intoAltimateAI:masterfrom
matthieucan:matthieucan/toolbar-control-settings

Conversation

@matthieucan
Copy link
Copy Markdown

@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

    • Added seven user-configurable toggles to control visibility of dbt-related action buttons in SQL files (build, execute, run, test, preview, quick-pick, convert).
    • Menu actions now appear only for SQL/Jinja-SQL files and when the corresponding toggle is enabled.
  • Documentation

    • Updated configuration docs with a new UI/Display Settings section describing the seven toggles and their effects.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 9, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds seven new dbt.* boolean configuration flags (all default true) that gate visibility/enablement of dbt-related editor title commands. Updates editor when expressions so those commands are shown only when the language is sql/jinja-sql and the corresponding config.dbt.* flag is enabled.

Changes

Cohort / File(s) Summary
Package + menus
package.json
Added seven new dbt boolean config properties (enableBuildModel, enableExecuteSql, enableSqlQuickPick, enableRunModel, enableTestModel, enableSqlPreview, enableConvertToModel, all default true) and updated menus.editor/title / menus.editor/title/run when expressions to include `language == sql
Documentation
documentation/docs/setup/configuration.md
Documented the seven new configuration options and their purpose for controlling UI/action visibility in SQL files. No other docs changed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Editor
    participant Config as Config Checker
    participant Cmd as Command Executor

    User->>Editor: Open SQL file / click editor title action
    Editor->>Config: Query `config.dbt.<feature>` and language (sql/jinja-sql)
    Config-->>Editor: Return true/false
    alt config true and language matches
        Editor->>Cmd: Invoke command (e.g., execute/run/test/convert)
        Cmd-->>User: Command executes / feedback shown
    else config false or language mismatch
        Editor-->>User: Action hidden / not available
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • mdesmet
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: making toolbar button visibility configurable via settings.
Description check ✅ Passed The description comprehensively covers the problem, solution, and includes a screenshot/demo. It provides clear testing steps and documents the settings changes, though README.md was not updated as noted in the checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Comment thread package.json
{
"command": "dbtPowerUser.runCurrentModel",
"when": "resourceLangId =~ /^sql$|^jinja-sql$/",
"when": "resourceLangId =~ /^sql$|^jinja-sql$/ && config.dbt.enableBuildModel",
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@matthieucan
Copy link
Copy Markdown
Author

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

Apologies for the (long) delay in getting back to you. I have now updated the documentation, thanks for the pointer!

@mdesmet mdesmet removed their request for review October 20, 2025 23:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
package.json (1)

250-284: LGTM — new visibility settings are consistent and safe by default.

The seven new boolean flags follow the existing dbt.* config namespace, all default to true (preserving prior behavior), and their descriptions clearly map to the corresponding toolbar buttons. Naming is uniform (enable<Feature>) and each setting is referenced by exactly one when clause in the menu definitions below.

One minor consideration (optional): the keybindings for dbtPowerUser.executeSQL (Lines 906-909) and dbtPowerUser.sqlPreview (Lines 911-915), as well as command-palette invocations, are not gated by these flags. That is consistent with the PR's stated scope ("toolbar button visibility"), but users who disable a button may still trigger the command via shortcut/palette. Worth a brief note in the documentation to set expectations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 250 - 284, The keybinding entries for
dbtPowerUser.executeSQL and dbtPowerUser.sqlPreview are not gated by the new
visibility settings, so add the corresponding when-clauses (e.g.,
"config.dbt.enableExecuteSql" and "config.dbt.enableSqlPreview") to those
keybinding/menu definitions to match the toolbar visibility flags (or
alternatively add a short docs note stating that disabling the button does not
disable the keybinding/command); update the keybinding objects that reference
the commands dbtPowerUser.executeSQL and dbtPowerUser.sqlPreview to include the
matching "when" expressions so behavior is consistent with the menu buttons.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@package.json`:
- Around line 250-284: The keybinding entries for dbtPowerUser.executeSQL and
dbtPowerUser.sqlPreview are not gated by the new visibility settings, so add the
corresponding when-clauses (e.g., "config.dbt.enableExecuteSql" and
"config.dbt.enableSqlPreview") to those keybinding/menu definitions to match the
toolbar visibility flags (or alternatively add a short docs note stating that
disabling the button does not disable the keybinding/command); update the
keybinding objects that reference the commands dbtPowerUser.executeSQL and
dbtPowerUser.sqlPreview to include the matching "when" expressions so behavior
is consistent with the menu buttons.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 622175d6-8ad0-4114-ae4a-8f8e04c6b44d

📥 Commits

Reviewing files that changed from the base of the PR and between bf15394 and 0d82697.

📒 Files selected for processing (1)
  • package.json

@dev-punia-altimate
Copy link
Copy Markdown

✅ Tests — All Passed

cc @matthieucan

@mdesmet mdesmet closed this Apr 28, 2026
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.

5 participants