A VS Code extension that provides language server features for Tableau calculation expressions.
-
Syntax Highlighting: Highlights Tableau calculation syntax including functions, keywords, operators, and field references.
-
Hover Information: Shows detailed, context-aware information when hovering over Tableau functions, fields, and keywords.
- Includes calculation header context (auto-detected from
// NAME – descriptionlines) and unified undefined-field messages.
- Includes calculation header context (auto-detected from
-
Code Completion: Suggests functions, fields, and keywords as you type.
-
Signature Help: Displays function signatures and parameter information when typing function calls.
-
Document Symbols: Lists all functions and expressions in the current document.
-
Validation: Validates Tableau expressions for syntax errors and provides diagnostics.
-
Calculation Extraction: Extract and analyze calculations, datasources, and fields from Tableau workbooks (.twb/.twbx files) with advanced processing including XML cleaning, name resolution, normalization, and deduplication.
-
Workbook Field Context: Opening or selecting a
.twb/.twbxindexes its datasource fields into one authoritative schema shared by the extension host and language server, giving datasource-aware IntelliSense: completion, hover, diagnostics, references, field swapping, and go-to-definition understand[Datasource].[Field]. -
Shared workspace library: Put a
tableau/folder at a workspace root and it is picked up automatically —*.d.twblfiles become field declarations for IntelliSense (merged, so you can keep one per datasource), and every other*.twblis auto-registered in the Calc Bank. Nothing to configure and no file picker; a root-levelfields.d.twblstill works too.copilot/ <- workspace root tableau/ fields.d.twbl field declarations superstore.d.twbl more declarations (merged; later files win) common.twbl reusable calculations -> Calc Bank agent.md project instructions -> @tableau promptagent.md(orinstructions.md, or any*.agent.md) is sent with every@tableaurequest — your naming rules, which datasource is canonical, house style, what's always wrong in this project. It outranks the built-in guidance, but cannot override the safety rules. Run Tableau: Create Agent Instructions for @tableau to scaffold one.Search folders are configurable with
tableau-language-support.fieldDefinitions.folders. A live workbook always overrides these declarations — they are the fallback for calculation-only projects. -
@tableau Chat Participant: Ask Copilot Chat about the active workbook (
@tableau what borders are set?) with/new,/borders,/calcs, and/fieldscommands, grounded in a parsed workbook digest.@tableaucan also write to the workbook: ask it to add or fix a calculation (@tableau add a profit ratio calc) and it looks up the datasource's complete field list, then writes the calculated field into the live.twbafter showing you a confirmation card with the formula. Every write takes a timestamped backup and rolls back if the resulting workbook fails validation. -
Workbook tools for agent mode: The same two capabilities are contributed as language model tools, so Copilot's agent mode can use them directly —
#tableauFieldsfor the full field inventory and#tableauAddCalculationto add a calculated field.
The Tableau Tools activity-bar view bundles workbook inspection and formatting tooling:
- Workbook inspector: Browse the active workbook's datasources, calculated fields, fields, worksheets, and custom palettes, and extract calculations with one click.
- Add Calculated Field: Insert a calculated field into a
.twbdatasource with transactional backups, persisted-XML verification, and rollback, plus a nested Common Calculations library of reusable templates. - Palette Library: Read and edit color palettes in Tableau's
Preferences.tps— create, import, archive, and delete palettes (categorical, sequential, diverging) and apply one to the active workbook. - Advanced Gradient Generator: Build a sequential ramp from a base color with a configurable step count and easing curve.
- Multi-Stop Gradient: Blend between start and end colors in LAB, RGB, or HSL with easing, then apply the result to the palette editor.
- Theme Vault: Save, load, and delete named multi-palette themes.
- Workbook Formatting: Inspect and edit worksheet formatting, apply an imported theme (override or preserve existing), and export the workbook's current theme as JSON.
- Format Stripper: Strip borders, bold, font sizes, and font colors from the active workbook, with live scan counts per option.
- Calculation Bank & Portfolio: Load reusable calculations from
_calc_bank.twbland insert stock calculation examples at the cursor.
The document model has been significantly improved to:
- Parse Multi-line Expressions: Properly handles complex expressions that span multiple lines.
- Support Different Expression Types: Recognizes and processes IF, CASE, LOD, function calls, and field references.
- Extract Symbol Context: Understands the context in which symbols are used for better hover information and validation.
- Manage Document Lifecycle: Efficiently caches and updates document models as needed.
The hover provider now offers rich, context-aware information:
- Function Hover: Shows function signature, parameter details, return type, description, and examples.
- Field Hover: Shows field type and description.
- Keyword Hover: Shows usage context and description based on the expression type (IF, CASE, LOD).
- Operator Hover: Shows operator type and description.
- Performance Optimized: Implements caching for faster hover responses.
The validation system has been enhanced to:
- Validate Multi-line Expressions: Checks syntax across complex multi-line expressions.
- Apply Expression-Specific Rules: Uses different validation rules based on expression type.
- Check Parameter Counts: Validates function calls with the correct number of parameters.
- Provide Detailed Diagnostics: Gives specific error messages for different types of issues.
A comprehensive testing framework has been added:
- Hover Testing: Tests hover functionality for different symbol types.
- Document Model Testing: Tests parsing and symbol extraction.
- Validation Testing: Tests validation rules for different expression types.
- Performance Testing: Measures and compares performance metrics.
- Open a
.twblfile in VS Code. - Write Tableau calculation expressions.
- Hover over functions, fields, or keywords to see detailed information.
- Use code completion to get suggestions as you type.
- View validation errors and warnings in the Problems panel.
- Open a
.twbor.twbxfile in VS Code. - Open the Command Palette (
Cmd+Shift+Pon Mac,Ctrl+Shift+Pon Windows/Linux). - Type "Extract Calculations" and select "Tableau: Extract Calculations".
- The extracted data (datasources, fields, and calculations) will be saved to
Extracted_Calculations.twblin your workspace root and opened automatically.
The output file includes three sections:
- Datasources: Lists all datasources in the workbook
- Fields: Lists all fields with their datatype and role
- Calculations: Shows normalized calculation formulas with uppercased keywords
For detailed information about the extraction feature, see the Extraction Guide.
Use a tableau code block to get syntax highlighting in Markdown:
// !My Calc – Description
IF [Sales] > 1000 THEN "High" ELSE "Low" END
The extension discovers installed Tableau Desktop versions, standard local or OneDrive-backed My Tableau Repository folders, and recent Tableau artifacts. Use the Command Palette for:
- Tableau: Connect Local Workbook to LSP and Chat — attaches a
.twbor.twbxoutside the current workspace to the same datasource/field model used by IntelliSense, diagnostics, navigation, and@tableauchat. - Tableau: Open Workbook in Local Tableau Desktop — launches the active or selected workbook with the newest discovered Desktop installation.
- Tableau: Show Local Connector Status — reports installed versions, running state, repositories, workbooks, datasources,
.tacoconnector packages, Hyper extracts, and logs. - Tableau: Open Local Tableau Repository — reveals the detected repository in the operating system.
The connector uses Tableau's documented local file surfaces (.twb, .twbx, .tds, .tdsx, .hyper, and the repository layout). It does not depend on an unsupported private automation socket in Tableau Desktop. Repository and executable paths can be overridden in settings.
Use Tableau: Add Calculation to Workbook or the Calculated Fields form in the sidebar to write a calculation into a datasource in a plain .twb workbook. A .twbl editor selection can supply the formula to the command, but .twbl remains the calculation-authoring/definitions format; Tableau Desktop reads the generated native <column><calculation ... /></column> entry from the .twb XML.
Every workbook mutation is transactional: the extension validates the source XML, creates a timestamped copy in .tableau-lsp-backups, writes through an open editor when needed, rereads and validates the exact persisted result, and restores the original if writing or verification fails. Duplicate calculated-field names require explicit replacement, while collisions with physical fields are rejected. Packaged .twbx mutation is intentionally not supported yet.
The collapsed Add Calculated Field section contains a nested Common Calculations library. It starts with a Profit Ratio example and can store up to ten reusable field-name, formula, and datatype combinations. Use Saved fills the workbook insertion form; Save Current adds or updates the template. The library is synchronized through VS Code Settings Sync when available.
The formatting sidebar and standalone formatting panel use the same transaction layer for border edits, bulk changes, theme imports, and formatting removal. Enable Open in Tableau after a verified write to launch the saved workbook after verification. This opens the edited file with the configured or newest discovered Tableau Desktop installation; it does not terminate an already-running Tableau process.
Tableau: Format Tableau Expression now formats the current selection when one exists, otherwise the complete .twbl document. Tableau: Select Calculation Formatting Profile provides three styles:
readable— conventional IF/CASE blocks and balanced wrapping.compact— fewer line breaks for short calculations.expanded— one function argument per line and earlier condition wrapping.
Keyword case, maximum line length, logical operator position, function argument wrapping, indentation, and final-newline behavior can be configured independently.
- Visual Studio Code 1.95.0 or higher (required by the Chat/Language Model APIs)
This extension contributes the following settings:
tableau-language-support.enableFormatting: Enable/disable formatting for Tableau expressions.tableau-language-support.enableSignatureHelp: Enable/disable signature help for Tableau functions.tableau-language-support.formatting.*: Select a profile and customize wrapping, casing, and line layout.tableau-language-support.local.*: Override local repository discovery, Tableau Desktop executable selection, and artifact limits.
- Complex nested expressions may not be fully validated.
- Some advanced Tableau features may not be fully supported.
See CHANGELOG.md for the full version history, or the GitHub releases page for packaged builds.
The extension ships with a Toolbox-style compile/reload loop. See docs/AUTO_RELOAD_DEBUGGER.md for the full breakdown, but the highlights are:
- Use the
Tableau LSP: Compile and Reloadcommand to run thenpm: compiletask and restart/launch theRun Extension (VS Code)debugger (which opens theTableau-LSP.code-workspacein the Extension Host window). Tasks: Run Taskexposes bothnpm: compileand aCompile and Reload Debuggerhelper, if you prefer sticking with VS Code tasks.npm run watchkeeps builds flowing automatically; pair it withCtrl+Shift+F5or the command above for ultra-fast iteration.- CLI helpers
auto-reload.shandauto-reload.cmdgive you a terminal-friendly entry point that mirrors the VS Code task.
Grab the latest .vsix from Releases, save it to your Downloads folder, then install it from the command line.
CMD:
code --install-extension "%USERPROFILE%\Downloads\tableau-language-support-1.7.3.vsix" --forcePowerShell:
code --install-extension "$env:USERPROFILE\Downloads\tableau-language-support-1.7.3.vsix" --forceThen reload VS Code. If an older version is already installed, add --force.
From the repository root, run:
.\Update-FromGitHub.ps1This fetches origin, switches to main, and performs a fast-forward-only pull. It refuses to continue when tracked files have local changes and leaves untracked workbook fixtures untouched. Another branch or remote can be selected explicitly:
.\Update-FromGitHub.ps1 -Remote origin -Branch main