Skip to content

feat(soql-completions): implement SOQL completion context, keywords, and suggestions - #1907

Open
paustint wants to merge 1 commit into
mainfrom
feat/soql-code-completion
Open

feat(soql-completions): implement SOQL completion context, keywords, and suggestions#1907
paustint wants to merge 1 commit into
mainfrom
feat/soql-code-completion

Conversation

@paustint

@paustint paustint commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
  • Added soql-completion-context.ts to handle cursor-context detection for SOQL editors, allowing for dynamic completion suggestions based on the current query context.
  • Introduced soql-completion-keywords.ts to define static SOQL vocabulary, including keywords, date literals, aggregate functions, and more, for use in completion suggestions.
  • Created soql-completions.ts to register and manage SOQL completion items, integrating with the Monaco editor and providing context-aware suggestions based on the user's input.
  • Implemented useSoqlCompletions.ts hook to facilitate the registration of SOQL completions in a React component, ensuring that completions are scoped to the specific editor instance.

…and suggestions

- Added `soql-completion-context.ts` to handle cursor-context detection for SOQL editors, allowing for dynamic completion suggestions based on the current query context.
- Introduced `soql-completion-keywords.ts` to define static SOQL vocabulary, including keywords, date literals, aggregate functions, and more, for use in completion suggestions.
- Created `soql-completions.ts` to register and manage SOQL completion items, integrating with the Monaco editor and providing context-aware suggestions based on the user's input.
- Implemented `useSoqlCompletions.ts` hook to facilitate the registration of SOQL completions in a React component, ensuring that completions are scoped to the specific editor instance.
Copilot AI review requested due to automatic review settings August 3, 2026 15:58
function parseAtCursor(queryWithCursor: string) {
const cursorOffset = queryWithCursor.indexOf('|');
expect(cursorOffset, 'test case must include a | cursor marker').toBeGreaterThan(-1);
return parseSoqlContext(queryWithCursor.replace('|', ''), cursorOffset);

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

Picklist value suggestions currently insert unescaped SOQL string content, which can generate invalid queries when values contain characters like apostrophes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds context-aware SOQL autocomplete to Jetstream’s Monaco-based editors, using org metadata (global + per-sObject describes) plus a curated SOQL vocabulary to provide relevant suggestions as the user types.

Changes:

  • Introduced a tolerant cursor-context parser to determine the active SOQL clause, scope object, relationship path, and comparison-value position.
  • Added a Monaco completion provider that merges keyword suggestions with org-aware sObject/field/relationship/value suggestions.
  • Wired the completions into the Query editors via a useSoqlCompletions hook and Monaco editor option tweaks to favor metadata-driven suggestions.
File summaries
File Description
libs/shared/ui-core/src/query/soql-completions/useSoqlCompletions.ts Hook to register/dispose a completion provider scoped to a single editor model.
libs/shared/ui-core/src/query/soql-completions/soql-completions.ts Monaco completion provider implementation: context parsing + metadata lookups + suggestion building.
libs/shared/ui-core/src/query/soql-completions/soql-completion-keywords.ts Static SOQL keyword/function/date literal suggestion data (snippet-capable).
libs/shared/ui-core/src/query/soql-completions/soql-completion-context.ts Cursor-context detection that tolerates incomplete queries while typing.
libs/shared/ui-core/src/query/soql-completions/tests/soql-completion-context.spec.ts Vitest coverage for context masking/parsing behaviors.
libs/shared/ui-core/src/index.ts Exposes the new SOQL completion utilities from @jetstream/ui-core.
libs/features/query/src/QueryResults/QueryResultsSoqlPanel.tsx Registers SOQL completions on the results-panel editor; adjusts Monaco suggestion behavior.
libs/features/query/src/QueryOptions/ManualSoql.tsx Registers SOQL completions on the manual editor; pulls current org from app state; adjusts Monaco suggestion behavior.
Review details
  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

return [];
}

const quote = (value: string) => (isInsideStringLiteral ? value : `'${value}'`);
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.

3 participants