Skip to content

Add contextual schema lookup from query editor#163

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/schema-lookup
Apr 5, 2026
Merged

Add contextual schema lookup from query editor#163
erikdarlingdata merged 1 commit intodevfrom
feature/schema-lookup

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

  • Right-click a table, procedure, or function name in the query editor to view indexes, table definitions, or object definitions from the connected server
  • Uses Microsoft.SqlServer.TransactSql.ScriptDom to parse SQL and resolve the object under the cursor
  • Outputs proper CREATE TABLE/CREATE INDEX DDL with partition schemes, non-default index options, columnstore support, identity, computed columns, and PK constraints
  • Right-click moves caret to click position for intuitive context menus
  • Copy/Copy All/Select All context menu on schema result tabs

Addresses issue #1 (query editor half).

Test plan

  • Right-click table name in editor → Show Indexes, Show Table Definition appear
  • Right-click keyword (SELECT, FROM) → schema items hidden
  • Right-click with no connection → schema items hidden
  • Show Indexes produces correct CREATE INDEX DDL with usage stats
  • Show Table Definition produces correct CREATE TABLE DDL
  • Partitioned tables include ON partition_scheme(column)
  • Non-default index options (fill factor, compression, lock settings) emitted
  • Clustered columnstore indexes scripted correctly (no empty parens, no inherent options)
  • PK constraint in CREATE TABLE includes WITH options when non-default
  • Schema result tabs have Copy/Copy All/Select All context menu
  • 11 unit tests pass for SqlObjectResolver

🤖 Generated with Claude Code

Right-click a table, procedure, or function name in the query editor to
view indexes, table definitions, or object definitions from the connected
server. Uses Microsoft.SqlServer.TransactSql.ScriptDom to parse SQL and
resolve the object under the cursor.

- SqlObjectResolver: AST-based object resolution at cursor position
- SchemaQueryService: DMV queries for indexes, columns, object definitions
- CREATE TABLE output with PK constraints, identity, computed columns,
  partition schemes, and non-default index options
- CREATE INDEX output with fill factor, compression, lock settings,
  partition schemes, and proper columnstore syntax
- Right-click moves caret to click position for intuitive context menus
- Copy/Copy All/Select All context menu on schema result tabs
- 11 unit tests for SqlObjectResolver

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit af3f903 into dev Apr 5, 2026
2 checks passed
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