Skip to content

Commit b89f592

Browse files
committed
refactor: inverse prerelease completion flag
1 parent 3a72862 commit b89f592

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232

3333
<!-- configs -->
3434

35-
| Key | Description | Type | Default |
36-
| -------------------------------- | ---------------------------------------------------------------------------- | --------- | ------------------- |
37-
| `npmx.hover.enabled` | Enable hover information for packages | `boolean` | `true` |
38-
| `npmx.completion.version` | Version completion behavior | `string` | `"provenance-only"` |
39-
| `npmx.completion.showPrerelease` | Show prerelease versions (alpha, beta, rc, canary) in completion suggestions | `boolean` | `false` |
40-
| `npmx.diagnostics.deprecation` | Show warnings for deprecated packages | `boolean` | `true` |
41-
| `npmx.diagnostics.replacement` | Show suggestions for package replacements | `boolean` | `true` |
42-
| `npmx.diagnostics.vulnerability` | Show warnings for packages with known vulnerabilities | `boolean` | `true` |
35+
| Key | Description | Type | Default |
36+
| ----------------------------------- | --------------------------------------------------------------------------------- | --------- | ------------------- |
37+
| `npmx.hover.enabled` | Enable hover information for packages | `boolean` | `true` |
38+
| `npmx.completion.version` | Version completion behavior | `string` | `"provenance-only"` |
39+
| `npmx.completion.excludePrerelease` | Exclude prerelease versions (alpha, beta, rc, canary) from completion suggestions | `boolean` | `true` |
40+
| `npmx.diagnostics.deprecation` | Show warnings for deprecated packages | `boolean` | `true` |
41+
| `npmx.diagnostics.replacement` | Show suggestions for package replacements | `boolean` | `true` |
42+
| `npmx.diagnostics.vulnerability` | Show warnings for packages with known vulnerabilities | `boolean` | `true` |
4343

4444
<!-- configs -->
4545

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@
5151
},
5252
"npmx.completion.version": {
5353
"type": "string",
54-
"enum": ["all", "provenance-only", "off"],
54+
"enum": [
55+
"all",
56+
"provenance-only",
57+
"off"
58+
],
5559
"enumDescriptions": [
5660
"Show all versions",
5761
"Show only versions with provenance",
@@ -60,10 +64,10 @@
6064
"default": "provenance-only",
6165
"description": "Version completion behavior"
6266
},
63-
"npmx.completion.showPrerelease": {
67+
"npmx.completion.excludePrerelease": {
6468
"type": "boolean",
65-
"default": false,
66-
"description": "Show prerelease versions (alpha, beta, rc, canary) in completion suggestions"
69+
"default": true,
70+
"description": "Exclude prerelease versions (alpha, beta, rc, canary) from completion suggestions"
6771
},
6872
"npmx.diagnostics.deprecation": {
6973
"type": "boolean",

src/providers/completion-item/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class VersionCompletionItemProvider<T extends Extractor> implements Compl
4545
if (meta.deprecated != null)
4646
continue
4747

48-
if (!config.completion.showPrerelease && PRERELEASE_PATTERN.test(version))
48+
if (config.completion.excludePrerelease && PRERELEASE_PATTERN.test(version))
4949
continue
5050

5151
if (config.completion.version === 'provenance-only' && !meta.provenance)

0 commit comments

Comments
 (0)