Commit 441db22
Restore concrete
#2306 widened the parameters of `FileContext.GetText` and `GetTextLines`
from the concrete `FileRange` class to the `IFileRange` interface so that
`$Context.CurrentFile.GetText($Context.SelectedRange)` would resolve (since
`SelectedRange` is typed as `IFileRange`). That fixed the script-side call,
but it dropped the old concrete-typed method slots from the assembly.
Downstream modules that compile against PSES, most notably
SeeminglyScience/EditorServicesCommandSuite, bind to the published metadata
at build time. A precompiled caller of the old `GetText(FileRange)` signature
would throw `MissingMethodException` at runtime even though it recompiles
cleanly, so this was a binary-breaking change.
Restore `GetText(FileRange)` and `GetTextLines(FileRange)` alongside the
`IFileRange` overloads. Each casts to `IFileRange` and delegates to the
widened implementation, so old binaries keep resolving and behavior is
unchanged. The added tests declare their argument as the concrete `FileRange`
so overload resolution actually exercises the compatibility shims.
Drafted by Copilot (Claude Opus 4.8).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>FileRange overloads on FileContext
1 parent 4835b11 commit 441db22
2 files changed
Lines changed: 55 additions & 0 deletions
File tree
- src/PowerShellEditorServices/Extensions
- test/PowerShellEditorServices.Test/Extensions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
| |||
125 | 137 | | |
126 | 138 | | |
127 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
128 | 152 | | |
129 | 153 | | |
130 | 154 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
67 | 98 | | |
68 | 99 | | |
0 commit comments