@@ -986,49 +986,73 @@ export async function InstallSkyBridge(): Promise<void> {
986986 return {
987987 resource : MakeFileUri ( OsPath ) ,
988988 results : PerLineMatches . map ( ( M ) => {
989- // VS Code's `ISearchRange`: 1-based for line, 0-based
990- // for column. Mountain's columns array is already
991- // 0-based UTF-8 char offsets within the preview line.
989+ // VS Code's current `ITextSearchMatch` shape (≥1.92):
990+ // {
991+ // uri?: URI,
992+ // rangeLocations: { source: ISearchRange,
993+ // preview: ISearchRange }[],
994+ // previewText: string,
995+ // }
996+ // The OLD `{preview: {text, matches}, ranges}` shape
997+ // was renamed: `preview.text` → `previewText`, and
998+ // `preview.matches` + `ranges` collapsed into a single
999+ // pair-array `rangeLocations[]`. Stock vscode passes
1000+ // our matches through `searchResult.add()` which
1001+ // reads `previewText` + `rangeLocations` and silently
1002+ // rejects (count-of-zero) entries with the old shape -
1003+ // which is why the search panel showed 0 results
1004+ // despite Mountain returning 2560 line-matches.
1005+ //
1006+ // `source`: 1-based line, 1-based column - the
1007+ // position in the original file that matched.
1008+ // `preview`: 1-based line=1, 1-based column - the
1009+ // position WITHIN `previewText` for highlight
1010+ // underlining.
1011+ //
9921012 // When Mountain didn't supply columns (older ripgrep
993- // path or zero-width match), highlight the whole
994- // line so the user still sees the row but without
995- // a sub-line underline.
996- const Ranges =
1013+ // path or zero-width match), produce a single full-
1014+ // line range so the row still renders.
1015+ const RangeLocations =
9971016 M . columns . length > 0
9981017 ? M . columns . map ( ( C ) => ( {
999- startLineNumber : M . lineNumber ,
1000- startColumn : C . start + 1 ,
1001- endLineNumber : M . lineNumber ,
1002- endColumn : C . end + 1 ,
1018+ source : {
1019+ startLineNumber : M . lineNumber ,
1020+ startColumn : C . start + 1 ,
1021+ endLineNumber : M . lineNumber ,
1022+ endColumn : C . end + 1 ,
1023+ } ,
1024+ preview : {
1025+ startLineNumber : 1 ,
1026+ startColumn : C . start + 1 ,
1027+ endLineNumber : 1 ,
1028+ endColumn : C . end + 1 ,
1029+ } ,
10031030 } ) )
10041031 : [
10051032 {
1006- startLineNumber : M . lineNumber ,
1007- startColumn : 1 ,
1008- endLineNumber : M . lineNumber ,
1009- endColumn : Math . max (
1010- 1 ,
1011- M . preview . length + 1 ,
1012- ) ,
1033+ source : {
1034+ startLineNumber : M . lineNumber ,
1035+ startColumn : 1 ,
1036+ endLineNumber : M . lineNumber ,
1037+ endColumn : Math . max (
1038+ 1 ,
1039+ M . preview . length + 1 ,
1040+ ) ,
1041+ } ,
1042+ preview : {
1043+ startLineNumber : 1 ,
1044+ startColumn : 1 ,
1045+ endLineNumber : 1 ,
1046+ endColumn : Math . max (
1047+ 1 ,
1048+ M . preview . length + 1 ,
1049+ ) ,
1050+ } ,
10131051 } ,
10141052 ] ;
1015- // `preview.matches` is the SAME range list but
1016- // translated into preview-local coordinates (line 1,
1017- // column relative to preview start). Without this the
1018- // renderer shows the row but no matched-substring
1019- // highlight inside the line.
1020- const PreviewMatches =
1021- M . columns . length > 0
1022- ? M . columns . map ( ( C ) => ( {
1023- startLineNumber : 1 ,
1024- startColumn : C . start + 1 ,
1025- endLineNumber : 1 ,
1026- endColumn : C . end + 1 ,
1027- } ) )
1028- : [ ] ;
10291053 return {
1030- preview : { text : M . preview , matches : PreviewMatches } ,
1031- ranges : Ranges ,
1054+ previewText : M . preview ,
1055+ rangeLocations : RangeLocations ,
10321056 } ;
10331057 } ) ,
10341058 } ;
@@ -1980,7 +2004,9 @@ export async function InstallSkyBridge(): Promise<void> {
19802004 for ( const Entry of Changed ) {
19812005 try {
19822006 const Uri = Entry ?. uri ;
1983- const Markers_ = Array . isArray ( Entry ?. markers ) ? Entry . markers : [ ] ;
2007+ const Markers_ = Array . isArray ( Entry ?. markers )
2008+ ? Entry . markers
2009+ : [ ] ;
19842010 if ( ! Uri ) continue ;
19852011 const RealUri =
19862012 typeof Uri === "string"
@@ -2727,11 +2753,7 @@ export async function InstallSkyBridge(): Promise<void> {
27272753 } catch ( Error ) {
27282754 try {
27292755 const W = globalThis as any ;
2730- if (
2731- W ?. process ?. env ?. Trace ?. includes ?.(
2732- "cel-customeditor" ,
2733- )
2734- ) {
2756+ if ( W ?. process ?. env ?. Trace ?. includes ?.( "cel-customeditor" ) ) {
27352757 ( W . console || console ) . warn (
27362758 `[Sky:CEL-CustomEditor] registerCapability failed: ${
27372759 ( Error as { message ?: string } ) ?. message ??
0 commit comments