Skip to content

VS Code Extension

Directix provides a VS Code extension that enhances your development experience with intelligent code completion, hover documentation, diagnostics, performance tracking, and snippets.

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Press Cmd+Shift+X (Mac) or Ctrl+Shift+X (Windows/Linux) to open the Extensions panel
  3. Search for "Directix"
  4. Click "Install"

From VSIX File

bash
cd packages/vscode-extension
pnpm build
code --install-extension directix-vscode-1.0.0.vsix

Features

Directive Auto-Completion

When you type v- in Vue templates, Directix directives appear in the auto-completion list.

Trigger conditions:

  • Typing v- in a tag attribute position
  • Typing v- after a space following an existing attribute

Hover Documentation

Hover over any Directix directive to see detailed documentation including:

  • Directive description
  • Usage examples
  • Available options
  • Default values

Code Snippets

Type directive prefixes to quickly insert code snippets:

PrefixGenerated Code
vcopyv-copy="'text to copy'"
vdebouncev-debounce="{ handler: handleInput, wait: 300 }"
vthrottlev-throttle="{ handler: handleClick, limit: 300 }"
vclickoutsidev-click-outside="handleClickOutside"
vlongpressv-long-press="{ handler: handleLongPress, duration: 500 }"
vhoverv-hover="{ onEnter: handleEnter, onLeave: handleLeave }"
vfocusv-focus
vlazyv-lazy="imageUrl"
vloadingv-loading="isLoading"
vripplev-ripple
vintersectv-intersect="handleIntersect"
vresizev-resize="handleResize"
vscrollv-scroll="handleScroll"
vwatermarkv-watermark="'Confidential'"
vtooltipv-tooltip="'Tooltip text'"
vpermissionv-permission="'admin'"
vhotkeyv-hotkey="{ 'ctrl+s': handleSave }"
vmaskv-mask="'###-##-####'"
vmoneyv-money
vnumberv-number
vinfinitescrollv-infinite-scroll="loadMore"
vdraggablev-draggable
vvisiblev-visible="isVisible"
vsanitizev-sanitize
vskeletonv-skeleton="isLoading"
vellipsisv-ellipsis="1"
vtruncatev-truncate="50"

Command Palette

Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux) to open the command palette:

CommandDescription
Directix: Open DocumentationOpen the official documentation website
Directix: Open Config EditorOpen visual configuration editor
Directix: Show Performance ReportShow performance metrics for directives
Directix: Show BottlenecksDetect and show performance bottleneck warnings
Directix: Clear Performance DataClear collected performance metrics
Directix: Inspect StateQuick pick to inspect directive state
Directix: Open Directive DocsOpen docs for directive at cursor position
Directix: Search DocsSearch documentation for directives
Directix: Insert DirectiveQuick pick to insert a directive

Performance Bottleneck Detection

The extension can detect performance issues in your directives:

Bottleneck Types:

TypeThresholdDescription
Slow mount> 50msDirective mount takes too long
Slow update> 16msDirective update exceeds frame budget
Excessive updates> 100Too many updates in short period
Memory leak pattern-Potential memory cleanup issues

When bottlenecks are detected, a QuickPick UI shows warnings with optimization suggestions.

Diagnostics

Real-time diagnostics for your Vue templates:

DiagnosticDescription
Missing parametersRequired directive parameters not provided
SSR compatibilityWarns about directives incompatible with SSR
Deprecated patternsWarns about deprecated usage patterns
Duplicate directivesMultiple same directives on one element
Conflicting directivesConflicting directive pairs (e.g., v-debounce + v-throttle)
Modifier combinationsInvalid modifier combinations
Memory leak patternsPatterns that may cause memory leaks
SSR hydration issuesPotential SSR hydration mismatches
Accessibility concernsMissing ARIA attributes or accessibility issues

Configuration

Configure the extension in VS Code settings:

OptionTypeDefaultDescription
directix.enableIntelliSensebooleantrueEnable IntelliSense (completion & hover)
directix.showDocumentationbooleantrueShow documentation in hover tooltips
directix.enableDiagnosticsbooleantrueEnable real-time diagnostics
directix.enablePerformanceTrackingbooleanfalseEnable performance tracking
directix.diagnostics.debounceMsnumber500Diagnostics debounce delay
directix.diagnostics.checkDuplicatesbooleantrueWarn about duplicate directives
directix.diagnostics.checkConflictsbooleantrueWarn about conflicting directive pairs
directix.diagnostics.checkSSRCompatibilitybooleantrueWarn about SSR incompatibility

Via Settings UI

  1. Open VS Code settings (Cmd+, or Ctrl+,)
  2. Search for "Directix"
  3. Toggle the desired options

Via settings.json

json
{
  "directix.enableIntelliSense": true,
  "directix.showDocumentation": true,
  "directix.enableDiagnostics": true,
  "directix.enablePerformanceTracking": false,
  "directix.diagnostics.debounceMs": 500,
  "directix.diagnostics.checkDuplicates": true,
  "directix.diagnostics.checkConflicts": true,
  "directix.diagnostics.checkSSRCompatibility": true
}

Supported File Types

  • .vue files
  • .html files

Troubleshooting

Auto-completion not working?

  1. Ensure the file type is .vue or .html
  2. Verify directix.enableIntelliSense is set to true
  3. Restart VS Code

Diagnostics not showing?

  1. Check that directix.enableDiagnostics is true
  2. Open a Vue file and wait for the debounce delay
  3. Check the Problems panel for warnings

Performance tracking empty?

  1. Enable directix.enablePerformanceTracking
  2. Interact with your app in the browser
  3. Run "Directix: Show Performance Report" command

Released under the MIT License.