@@ -220,6 +220,60 @@ interface UntoggleShowProblemsMsg {
220220 t : "untoggleShowProblems" ;
221221}
222222
223+ export const enum SourceArchiveRelationship {
224+ /** The file is in the source archive of the database the query was run on. */
225+ CorrectArchive = "correct-archive" ,
226+ /** The file is in a source archive, but for a different database. */
227+ WrongArchive = "wrong-archive" ,
228+ /** The file is not in any source archive. */
229+ NotInArchive = "not-in-archive" ,
230+ }
231+
232+ /**
233+ * Information about the current editor selection, sent to the results view
234+ * so it can filter results to only those overlapping the selection.
235+ */
236+ export interface EditorSelection {
237+ /** The file URI in result-compatible format, or undefined if no editor is active. */
238+ fileUri : string | undefined ;
239+ startLine : number ;
240+ endLine : number ;
241+ startColumn : number ;
242+ endColumn : number ;
243+ /** True if the selection is empty (just a cursor), in which case we match the whole file. */
244+ isEmpty : boolean ;
245+ /** Describes the relationship between the current file and the query's database source archive. */
246+ sourceArchiveRelationship : SourceArchiveRelationship ;
247+ }
248+
249+ interface SetEditorSelectionMsg {
250+ t : "setEditorSelection" ;
251+ selection : EditorSelection | undefined ;
252+ wasFromUserInteraction ?: boolean ;
253+ }
254+
255+ /**
256+ * Results pre-filtered by file URI, sent from the extension when the
257+ * selection filter is active and the editor's file changes.
258+ * This bypasses pagination so the webview can apply line-range filtering
259+ * on the complete set of results for the file.
260+ */
261+ export interface FileFilteredResults {
262+ /** The file URI these results were filtered for. */
263+ fileUri : string ;
264+ /** The result set table these results were filtered for. */
265+ selectedTable : string ;
266+ /** Raw result rows from the current result set that reference this file. */
267+ rawRows ?: Row [ ] ;
268+ /** SARIF results that reference this file. */
269+ sarifResults ?: Result [ ] ;
270+ }
271+
272+ interface SetFileFilteredResultsMsg {
273+ t : "setFileFilteredResults" ;
274+ results : FileFilteredResults | undefined ;
275+ }
276+
223277/**
224278 * A message sent into the results view.
225279 */
@@ -229,7 +283,9 @@ export type IntoResultsViewMsg =
229283 | SetUserSettingsMsg
230284 | ShowInterpretedPageMsg
231285 | NavigateMsg
232- | UntoggleShowProblemsMsg ;
286+ | UntoggleShowProblemsMsg
287+ | SetEditorSelectionMsg
288+ | SetFileFilteredResultsMsg ;
233289
234290/**
235291 * A message sent from the results view.
@@ -241,7 +297,31 @@ export type FromResultsViewMsg =
241297 | ChangeRawResultsSortMsg
242298 | ChangeInterpretedResultsSortMsg
243299 | ChangePage
244- | OpenFileMsg ;
300+ | OpenFileMsg
301+ | RequestSelectionUpdateMsg
302+ | RequestFileFilteredResultsMsg ;
303+
304+ /**
305+ * Message from the results view to request the extension to re-send
306+ * the current editor selection and file-filtered results. Sent when
307+ * the selection filter is toggled on to ensure the filter state
308+ * reflects the actual current editor, not a stale cached value.
309+ */
310+ interface RequestSelectionUpdateMsg {
311+ t : "requestSelectionUpdate" ;
312+ }
313+
314+ /**
315+ * Message from the results view to request pre-filtered results for
316+ * a specific (file, table) pair. The extension loads all results from
317+ * the given table that reference the given file and sends them back
318+ * via setFileFilteredResults.
319+ */
320+ interface RequestFileFilteredResultsMsg {
321+ t : "requestFileFilteredResults" ;
322+ fileUri : string ;
323+ selectedTable : string ;
324+ }
245325
246326/**
247327 * Message from the results view to open a source
0 commit comments