Skip to content

Conversation

yossi55
Copy link

@yossi55 yossi55 commented Jul 30, 2025

Summary

This PR adds comprehensive autocomplete and IntelliSense support to the SQLTools BigQuery driver, significantly improving the developer experience when writing BigQuery SQL queries.

✨ New Features

🎯 Static Completions

  • BigQuery SQL Keywords: All major SQL keywords with proper prioritization
  • 100+ BigQuery Functions: Comprehensive function library including:
    • Aggregate functions (ARRAY_AGG, COUNT, SUM, etc.)
    • Date/Time functions (DATE_ADD, PARSE_TIMESTAMP, etc.)
    • String functions (REGEXP_EXTRACT, CONCAT, etc.)
    • Math functions (ROUND, SQRT, etc.)
    • JSON functions (JSON_EXTRACT, JSON_VALUE, etc.)
    • Geography functions (ST_DISTANCE, ST_GEOGPOINT, etc.)
  • Common Column Names: Frequently used column names for better WHERE clause support

🔍 Dynamic Completions

  • Real-time BigQuery Metadata: Fetches actual projects, datasets, tables, and columns
  • Intelligent Caching: 5-minute TTL for performance
  • Fully Qualified Names: Support for project.dataset.table.column format
  • Context-Aware Suggestions: Shows relevant metadata based on current context

🚀 Enhanced Search

  • Comprehensive searchItems: Support for all BigQuery object types:
    • Databases (projects)
    • Schemas (datasets)
    • Tables and Views
    • Columns with data type information
    • Functions and Procedures
  • Improved Column Search:
    • Better filtering by project/dataset
    • Data type icons for visual recognition
    • Support for partial and fully qualified names
    • Enhanced ordering to prioritize exact matches

🛠 Technical Improvements

  • Enhanced getStaticCompletions method with prioritized suggestions
  • New search queries for databases, schemas, views, and functions
  • Improved searchItems method with better context handling
  • Dynamic completion caching for performance optimization
  • Better error handling for graceful degradation

📈 User Experience

Before

  • Limited autocomplete support
  • No function suggestions
  • No metadata-based completions

After

  • Ctrl+Space shows relevant suggestions in all contexts
  • Intelligent prioritization (columns → keywords → functions)
  • Rich documentation for all functions
  • Real-time database metadata integration

🧪 Testing

Tested with:

  • SELECT clause completions ✅
  • Table and column suggestions ✅
  • Function autocomplete with documentation ✅
  • Project/dataset navigation ✅
  • Performance with large schemas ✅

📝 Note

WHERE clause autocomplete has some limitations due to SQLTools core architecture (see related issues #110 and #371). This is a known limitation affecting all SQLTools drivers.

🎯 Impact

This significantly improves the BigQuery development experience in VSCode, making it much easier to:

  • Discover available functions and their usage
  • Navigate complex BigQuery schemas
  • Write queries with confidence
  • Reduce syntax errors and typos

Closes any existing issues related to autocomplete/IntelliSense functionality.

yossi55 added 4 commits July 30, 2025 21:52
- Implement getStaticCompletions with BigQuery SQL keywords and 100+ functions
- Add dynamic completions for projects, datasets, tables, and columns
- Enhance searchItems to support all BigQuery object types
- Add search queries for databases, schemas, views, and functions
- Improve column search with data type icons and fully qualified names
- Cache dynamic completions with 5-minute TTL for performance
- Fix JSONClient import issue by using type alias
- Fix table property access to use 'label' instead of 'table'
- Ensure successful compilation
- Add popular columns to dynamic completions cache
- Make searchColumns more aggressive in returning results
- Add common column names to static completions
- Fix TypeScript error with tables parameter
- Lower priority for SQL keywords and functions so columns appear first
- Add actual column names from database to static completions
- Enhance dynamic completions with higher priority for columns
- Note: WHERE clause autocomplete limitation is a known SQLTools core issue
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.

1 participant