@optique/core 1.0.15-dev.2809 → 1.0.15-dev.2812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1279,23 +1279,11 @@ Register-ArgumentCompleter -Native -CommandName ${programName} -ScriptBlock {
1279
1279
  \$arguments = @()
1280
1280
  \$commandElements = \$commandAst.CommandElements
1281
1281
 
1282
- # Determine the range of elements to extract
1283
- # Exclude the last element if it matches wordToComplete (partial input case)
1284
- \$maxIndex = \$commandElements.Count - 1
1285
- if (\$commandElements.Count -gt 1) {
1286
- \$lastElement = \$commandElements[\$commandElements.Count - 1]
1287
- \$lastText = if (\$lastElement -is [System.Management.Automation.Language.StringConstantExpressionAst]) {
1288
- \$lastElement.Value
1289
- } else {
1290
- \$lastElement.Extent.Text
1291
- }
1292
- if (\$lastText -eq \$wordToComplete) {
1293
- \$maxIndex = \$commandElements.Count - 2
1294
- }
1295
- }
1296
-
1297
- for (\$i = 1; \$i -le \$maxIndex; \$i++) {
1282
+ # Keep only complete arguments before the cursor. The current word
1283
+ # (including a token ending exactly at the cursor) is appended below.
1284
+ for (\$i = 1; \$i -lt \$commandElements.Count; \$i++) {
1298
1285
  \$element = \$commandElements[\$i]
1286
+ if (\$element.Extent.EndOffset -ge \$cursorPosition) { break }
1299
1287
 
1300
1288
  if (\$element -is [System.Management.Automation.Language.StringConstantExpressionAst]) {
1301
1289
  \$arguments += \$element.Value
@@ -1279,23 +1279,11 @@ Register-ArgumentCompleter -Native -CommandName ${programName} -ScriptBlock {
1279
1279
  \$arguments = @()
1280
1280
  \$commandElements = \$commandAst.CommandElements
1281
1281
 
1282
- # Determine the range of elements to extract
1283
- # Exclude the last element if it matches wordToComplete (partial input case)
1284
- \$maxIndex = \$commandElements.Count - 1
1285
- if (\$commandElements.Count -gt 1) {
1286
- \$lastElement = \$commandElements[\$commandElements.Count - 1]
1287
- \$lastText = if (\$lastElement -is [System.Management.Automation.Language.StringConstantExpressionAst]) {
1288
- \$lastElement.Value
1289
- } else {
1290
- \$lastElement.Extent.Text
1291
- }
1292
- if (\$lastText -eq \$wordToComplete) {
1293
- \$maxIndex = \$commandElements.Count - 2
1294
- }
1295
- }
1296
-
1297
- for (\$i = 1; \$i -le \$maxIndex; \$i++) {
1282
+ # Keep only complete arguments before the cursor. The current word
1283
+ # (including a token ending exactly at the cursor) is appended below.
1284
+ for (\$i = 1; \$i -lt \$commandElements.Count; \$i++) {
1298
1285
  \$element = \$commandElements[\$i]
1286
+ if (\$element.Extent.EndOffset -ge \$cursorPosition) { break }
1299
1287
 
1300
1288
  if (\$element -is [System.Management.Automation.Language.StringConstantExpressionAst]) {
1301
1289
  \$arguments += \$element.Value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.15-dev.2809",
3
+ "version": "1.0.15-dev.2812",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",