Skip to content

feat: Add Monaco autocompletion for CosmosDB NoSQL query language#2968

Merged
bk201- merged 22 commits intomainfrom
dev/dshilov/schema-analyzer
Apr 12, 2026
Merged

feat: Add Monaco autocompletion for CosmosDB NoSQL query language#2968
bk201- merged 22 commits intomainfrom
dev/dshilov/schema-analyzer

Conversation

@bk201-
Copy link
Copy Markdown
Contributor

@bk201- bk201- commented Mar 27, 2026

  • Register custom nosql Monaco language with Monarch tokenizer for CosmosDB NoSQL-specific syntax highlighting (keywords, built-in functions, operators, comments, strings, quoted identifiers)

  • Implement context-aware CompletionItemProvider with: SQL keyword completions, 80+ built-in function completions with signatures, schema-driven property suggestions after dot notation, nested property resolution, bracket notation for special property names, and lightweight FROM-clause alias tracking

  • Pipe container schema from extension host to webview: add containerSchema field to QueryEditorState, send schema on ready/generation/merge/wipe, listen for schemaUpdated event in QueryEditorContextProvider

  • Enable fixedOverflowWidgets so autocomplete popup floats above Allotment split panes

bk201- added 4 commits March 27, 2026 12:08
- Refactor bulkInsertDocuments: always use executeBulkOperations first, fall back to one-by-one insert for any failures (removes emulator-specific code path)
- Extract executeBulkChunk and executeBulkChunkWithRetries helpers for readability
- Add cancellation support to document import via CancellationToken
- Add 'Wipe current schema' menu item in Schema button
- Add wipeCurrentSchema command in QueryEditorTab and context provider
- Refactor bulkInsertDocuments: always use executeBulkOperations first, fall back to one-by-one insert for any failures (removes emulator-specific code path)
- Extract executeBulkChunk and executeBulkChunkWithRetries helpers for readability
- Add cancellation support to document import via CancellationToken
- Add 'Wipe current schema' menu item in Schema button
- Add wipeCurrentSchema command in QueryEditorTab and context provider
- Register custom nosql Monaco language with Monarch tokenizer for CosmosDB NoSQL-specific syntax highlighting (keywords, built-in functions, operators, comments, strings, quoted identifiers)

- Implement context-aware CompletionItemProvider with: SQL keyword completions, 80+ built-in function completions with signatures, schema-driven property suggestions after dot notation, nested property resolution, bracket notation for special property names, and lightweight FROM-clause alias tracking

- Pipe container schema from extension host to webview: add containerSchema field to QueryEditorState, send schema on ready/generation/merge/wipe, listen for schemaUpdated event in QueryEditorContextProvider

- Enable fixedOverflowWidgets so autocomplete popup floats above Allotment split panes
- Register custom nosql Monaco language with Monarch tokenizer for CosmosDB NoSQL-specific syntax highlighting (keywords, built-in functions, operators, comments, strings, quoted identifiers)

- Implement context-aware CompletionItemProvider with: SQL keyword completions, 80+ built-in function completions with signatures, schema-driven property suggestions after dot notation, nested property resolution, bracket notation for special property names, and lightweight FROM-clause alias tracking

- Pipe container schema from extension host to webview: add containerSchema field to QueryEditorState, send schema on ready/generation/merge/wipe, listen for schemaUpdated event in QueryEditorContextProvider

- Enable fixedOverflowWidgets so autocomplete popup floats above Allotment split panes
@bk201- bk201- requested a review from a team as a code owner March 27, 2026 13:14
bk201- added 5 commits March 27, 2026 14:16
- Register custom nosql Monaco language with Monarch tokenizer for CosmosDB NoSQL-specific syntax highlighting (keywords, built-in functions, operators, comments, strings, quoted identifiers)

- Implement context-aware CompletionItemProvider with: SQL keyword completions, 80+ built-in function completions with signatures, schema-driven property suggestions after dot notation, nested property resolution, bracket notation for special property names, and lightweight FROM-clause alias tracking

- Pipe container schema from extension host to webview: add containerSchema field to QueryEditorState, send schema on ready/generation/merge/wipe, listen for schemaUpdated event in QueryEditorContextProvider

- Enable fixedOverflowWidgets so autocomplete popup floats above Allotment split panes
- Revert importDocuments.ts as not related with task
…ed definitions

- Extract shared language definitions into src/cosmosdb/language/nosqlLanguageDefinitions.ts (keywords, functions, schema helpers) with no vscode/monaco imports

- Add TextMate grammar (syntaxes/nosql.tmLanguage.json) for VS Code editor syntax highlighting

- Add language-configuration.json for comment toggling, bracket matching, auto-closing pairs

- Add VS Code CompletionItemProvider for keyword and function completions in .nosql files

- Register completion provider at extension activation, add onLanguage:nosql activation event

- Add file icon (CosmosDBAccount.svg) for .nosql files

- Refactor webview Monarch tokenizer and Monaco completion provider to import from shared module

- Add webpack copy rules for syntaxes/ and language-configuration.json

- Replace plan document with docs/nosql-language-support.md describing architecture and file roles
- Revert importDocuments.ts as not related with task
@bk201- bk201- marked this pull request as draft March 31, 2026 07:16
bk201- added 6 commits March 31, 2026 09:41
# Conflicts:
#	l10n/bundle.l10n.json
#	package.json
#	src/panels/QueryEditorTab.ts
#	src/utils/json/nosql/SchemaAnalyzer.ts
#	src/webviews/cosmosdb/QueryEditor/QueryPanel/QueryToolbarOverflow.tsx
#	src/webviews/cosmosdb/QueryEditor/state/QueryEditorContextProvider.tsx
#	src/webviews/cosmosdb/QueryEditor/state/QueryEditorState.tsx
@bk201- bk201- marked this pull request as ready for review March 31, 2026 15:26
Copy link
Copy Markdown
Member

@sevoku sevoku left a comment

Choose a reason for hiding this comment

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

First Pass: looks great!

Couple of thoughts:

  • "Delete current schema" should maybe have a confirmation? Or maybe let's call it "Remove current schema" which sounds less dangerous?
    • Do we need this feature at all? Why would one want to remove it at this point anyways?
  • "Generate schema based on queries" opens Settings, can't we turn it into a Checkmark/box? We could keep the setting to be the default value for freshly opened query editors.

@bk201- bk201- merged commit d4f780a into main Apr 12, 2026
5 checks passed
@bk201- bk201- deleted the dev/dshilov/schema-analyzer branch April 12, 2026 17:38
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.

2 participants