@pulsar-edit/types 1.128.1

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.
Files changed (87) hide show
  1. package/.github/workflows/publish.yml +33 -0
  2. package/LICENSE.md +8 -0
  3. package/README.md +187 -0
  4. package/atom-i18n/config.d.ts +9 -0
  5. package/atom-i18n/index.d.ts +4 -0
  6. package/autocomplete-plus/config.d.ts +140 -0
  7. package/autocomplete-plus/index.d.ts +200 -0
  8. package/dependencies/event-kit/index.d.ts +143 -0
  9. package/dependencies/first-mate/index.d.ts +1 -0
  10. package/dependencies/first-mate/src/first-mate.d.ts +1 -0
  11. package/dependencies/first-mate/src/grammar.d.ts +119 -0
  12. package/dependencies/pathwatcher/index.d.ts +1 -0
  13. package/dependencies/pathwatcher/src/directory.d.ts +98 -0
  14. package/dependencies/pathwatcher/src/file.d.ts +115 -0
  15. package/dependencies/pathwatcher/src/main.d.ts +2 -0
  16. package/dependencies/service-hub/index.d.ts +3 -0
  17. package/dependencies/service-hub/src/consumer.d.ts +8 -0
  18. package/dependencies/service-hub/src/provider.d.ts +14 -0
  19. package/dependencies/service-hub/src/service-hub.d.ts +46 -0
  20. package/dependencies/service-hub/src/util.d.ts +1 -0
  21. package/dependencies/text-buffer/index.d.ts +1 -0
  22. package/dependencies/text-buffer/src/display-marker-layer.d.ts +182 -0
  23. package/dependencies/text-buffer/src/display-marker.d.ts +232 -0
  24. package/dependencies/text-buffer/src/helpers.d.ts +11 -0
  25. package/dependencies/text-buffer/src/marker-layer.d.ts +117 -0
  26. package/dependencies/text-buffer/src/marker.d.ts +207 -0
  27. package/dependencies/text-buffer/src/point.d.ts +102 -0
  28. package/dependencies/text-buffer/src/range.d.ts +141 -0
  29. package/dependencies/text-buffer/src/text-buffer.d.ts +759 -0
  30. package/index.d.ts +72 -0
  31. package/linter/config.d.ts +26 -0
  32. package/linter/index.d.ts +108 -0
  33. package/package.json +61 -0
  34. package/src/atom-environment.d.ts +361 -0
  35. package/src/branding.d.ts +19 -0
  36. package/src/buffered-node-process.d.ts +10 -0
  37. package/src/buffered-process.d.ts +88 -0
  38. package/src/clipboard.d.ts +14 -0
  39. package/src/color.d.ts +11 -0
  40. package/src/command-registry.d.ts +118 -0
  41. package/src/config-schema.d.ts +271 -0
  42. package/src/config.d.ts +168 -0
  43. package/src/context-menu-manager.d.ts +65 -0
  44. package/src/cursor.d.ts +252 -0
  45. package/src/decoration.d.ts +156 -0
  46. package/src/deserializer-manager.d.ts +15 -0
  47. package/src/dock.d.ts +121 -0
  48. package/src/get-window-load-settings.d.ts +26 -0
  49. package/src/git-repository.d.ts +174 -0
  50. package/src/grammar-registry.d.ts +241 -0
  51. package/src/gutter.d.ts +118 -0
  52. package/src/history-manager.d.ts +28 -0
  53. package/src/keymap-extensions.d.ts +190 -0
  54. package/src/language-mode.d.ts +314 -0
  55. package/src/layer-decoration.d.ts +31 -0
  56. package/src/menu-manager.d.ts +24 -0
  57. package/src/notification-manager.d.ts +37 -0
  58. package/src/notification.d.ts +79 -0
  59. package/src/other-types.d.ts +283 -0
  60. package/src/package-manager.d.ts +103 -0
  61. package/src/package.d.ts +33 -0
  62. package/src/pane.d.ts +604 -0
  63. package/src/panel.d.ts +38 -0
  64. package/src/path-watcher.d.ts +35 -0
  65. package/src/project.d.ts +110 -0
  66. package/src/scope-descriptor.d.ts +8 -0
  67. package/src/selection.d.ts +341 -0
  68. package/src/style-manager.d.ts +68 -0
  69. package/src/task.d.ts +38 -0
  70. package/src/text-editor-component.d.ts +15 -0
  71. package/src/text-editor-element.d.ts +48 -0
  72. package/src/text-editor-registry.d.ts +48 -0
  73. package/src/text-editor.d.ts +1416 -0
  74. package/src/theme-manager.d.ts +29 -0
  75. package/src/tooltip-manager.d.ts +42 -0
  76. package/src/tooltip.d.ts +63 -0
  77. package/src/ui.d.ts +101 -0
  78. package/src/view-registry.d.ts +34 -0
  79. package/src/wasm-tree-sitter-grammar.d.ts +305 -0
  80. package/src/wasm-tree-sitter-language-mode.d.ts +294 -0
  81. package/src/workspace-center.d.ts +117 -0
  82. package/src/workspace.d.ts +485 -0
  83. package/status-bar/config.d.ts +23 -0
  84. package/status-bar/index.d.ts +51 -0
  85. package/tool-bar/config.d.ts +20 -0
  86. package/tool-bar/index.d.ts +235 -0
  87. package/tsconfig.json +8 -0
@@ -0,0 +1,33 @@
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+ workflow_dispatch:
7
+
8
+ env:
9
+ NODE_VERSION: 20
10
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: ${{ env.NODE_VERSION }}
20
+ - run: npm ci
21
+ - run: npm test
22
+
23
+ publish:
24
+ needs: build
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-node@v4
29
+ with:
30
+ node-version: ${{ env.NODE_VERSION }}
31
+ registry-url: https://registry.npmjs.org/
32
+ - run: npm ci
33
+ - run: npm publish --access public
package/LICENSE.md ADDED
@@ -0,0 +1,8 @@
1
+ This project is licensed under the MIT license.
2
+ Copyrights are respective of each contributor listed at the beginning of each definition file — or failing that, to the Pulsar-Edit team.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,187 @@
1
+ # @pulsar-edit/types
2
+
3
+ Type definitions for the [Pulsar API](https://docs.pulsar-edit.dev/api/pulsar/latest/).
4
+
5
+ Also includes some type definitions from notable builtin and community packages:
6
+
7
+ * `autocomplete-plus`
8
+ * `status-bar`
9
+ * `tool-bar`
10
+ * `linter`
11
+ * `atom-i18n`
12
+
13
+ Migrated from [@types/atom](https://www.npmjs.com/package/@types/atom) and updated to reflect new and changed APIs in Pulsar.
14
+
15
+ Install these types under `devDependencies` if you’re writing a community package in TypeScript or JavaScript. Pair this package with [`pulsar-ide-typescript`](https://packages.pulsar-edit.dev/packages/pulsar-ide-typescript) for better autocompletion and inline method descriptions.
16
+
17
+ ## Usage
18
+
19
+ ### Quick (with some sorcery)
20
+
21
+ Install this package as a `devDependency` and tell it to **pretend** to be `@types/atom`:
22
+
23
+ ```shell
24
+ npm install -D @types/atom@npm:@pulsar-edit/types
25
+ ```
26
+
27
+ This will
28
+
29
+ * install this package at `./node_modules/@types/atom`, thus giving it all of the built-in privileges of `@types/` packages in the TypeScript environment;
30
+ * make this package’s declarations ambiently available — for instance, the `atom` global;
31
+ * make it so you can import from `atom` — or, for the ancillary types, from `atom/autocomplete-plus`, `atom/linter`, and so on.
32
+
33
+ If you need to opt into a specific version of `@pulsar-edit/types`, you may add it at the end:
34
+
35
+ ```shell
36
+ npm install -D @types/atom@npm:@pulsar-edit/types@1.130
37
+ ```
38
+
39
+ ### Special cases
40
+
41
+ #### Transitive dependencies
42
+
43
+ If you depend on something that’s still trying to import `@types/atom` directly, the packages’ ambient declarations will conflict. (`atom-ide-base` and `atom-jasmine3-test-runner` are notable examples.)
44
+
45
+ If you’re using `npm`, this can be fixed via [the `overrides` section in `package.json`](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides). You can specify that any references to `@types/atom`, no matter the depth, should be fulfilled by this package instead:
46
+
47
+ ```json
48
+ {
49
+ "overrides": {
50
+ "@types/atom": "@pulsar-edit/types"
51
+ }
52
+ }
53
+ ```
54
+
55
+ [Yarn](https://yarnpkg.com/) can do a similar thing with its [`resolutions` property](https://yarnpkg.com/configuration/manifest#resolutions). Ultimately, anything that puts this package at `./node_modules/@types/atom` within the project will suffice.
56
+
57
+ ### Less sorcery
58
+
59
+ If, for whatever reason, you don’t want to do what’s described above, you can achieve a similar effect solely via `tsconfig.json`.
60
+
61
+ #### Path remapping
62
+
63
+ ```json
64
+ {
65
+ "compilerOptions": {
66
+ "paths": {
67
+ "atom": ["./node_modules/@pulsar-edit/types"]
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ The [`paths` entry](https://www.typescriptlang.org/tsconfig/#paths) for `atom` tells TypeScript that all references to `atom` in import specifiers can be resolved at the given location on disk.
74
+
75
+ This is fine because we don’t ever install an `atom` package. During development, references to `atom` will be resolved using these type definitions; at runtime, references to `atom` will be magically resolved by Pulsar.
76
+
77
+ #### Visibility
78
+
79
+ One drawback with this approach is that you don’t get _automatic_ “visibility” of this package, meaning its ambient declarations aren’t necessarily present. (Whereas `@types/atom` is automatically visible using TypeScript’s default settings, since it’s a `@types/` package.)
80
+
81
+ For instance, suppose this is your entire source code:
82
+
83
+ ```ts
84
+ function activate() {
85
+ atom.beep();
86
+ //^^^^ Cannot find name 'atom'.
87
+ }
88
+ ```
89
+
90
+ This will fix itself once you import something…
91
+
92
+ ```ts
93
+ import { TextEditor } from 'atom';
94
+
95
+ function activate() {
96
+ atom.beep();
97
+ }
98
+ ```
99
+
100
+ …or if you toss in a triple-slash directive. (The directive doesn’t follow our remapped path, so you must use the unaliased name of the package.)
101
+
102
+ ```ts
103
+ /// <reference types="@pulsar-edit/types" />
104
+
105
+ function activate() {
106
+ atom.beep();
107
+ }
108
+ ```
109
+
110
+ You could also fix this via your `tsconfig.json`…
111
+
112
+ ```json
113
+ "compilerOptions": {
114
+ "types": ["@pulsar-edit/types"],
115
+ "paths": {
116
+ "atom": ["./node_modules/@pulsar-edit/types"]
117
+ }
118
+ }
119
+ ```
120
+
121
+ …but, in doing so, you opt out of the automatic visibility of `@types/` packages, thus obligating you to reference them all manually. See the `tsconfig.json` documentation for [`types`](https://www.typescriptlang.org/tsconfig/#types) and [`typeRoots`](https://www.typescriptlang.org/tsconfig/#typeRoots) for more information.
122
+
123
+
124
+ ##### Ancillary types
125
+
126
+ This `tsconfig.json`-only approach doesn’t give you the ancillary types from various packages…
127
+
128
+ ```ts
129
+ import type { AnySuggestion } from 'atom/autocomplete-plus';
130
+ // ^^^^^^^^^^^^^ Cannot find name `AnySuggestion`.
131
+ ```
132
+
133
+ …but that’s fine. In this example, `atom/autocomplete-plus` isn’t a valid import specifier at runtime, so you’d only ever use that syntax to import types. Hence you can instead just import directly from `@pulsar-edit/types`:
134
+
135
+ ```ts
136
+ import type { AnySuggestion } from '@pulsar-edit/types/autocomplete-plus';
137
+ ```
138
+
139
+ Still, if you _really_ wanted to make this example available at `atom/autocomplete-plus`, you could add that import specifier to your `tsconfig.json` as well:
140
+
141
+ ```json
142
+ {
143
+ "compilerOptions": {
144
+ "paths": {
145
+ "atom": ["./node_modules/@pulsar-edit/types"],
146
+ "atom/autocomplete-plus": [
147
+ "./node_modules/@pulsar-edit/types/autocomplete-plus"
148
+ ]
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ ## Versioning
155
+
156
+ ### Minor versions
157
+
158
+ We will try to update this package at least as often as we update Pulsar, even if there are no API changes from one minor version to another.
159
+
160
+ If, somehow, this doesn’t happen, it means that the next-lowest version number to exist is the version of `@pulsar-edit/types` that should be used for whichever version of Pulsar you’re targeting. Hence if you’re targeting `1.129.0`, but the latest release of this package is `1.128.0`, then `1.128.0` is the correct version to use.
161
+
162
+ ### Patch versions
163
+
164
+ Pulsar increments the minor version number with each regular release. If the last release was `1.129.0`, the next regular release will be `1.130.0`. If Pulsar needs to do a bugfix release in between — for instance, if there were an regression in the last regular release — then the patch version number will increment (e.g., `1.129.0` is followed by `1.129.1`).
165
+
166
+ The version numbers in this repository are designed to harmonize with Pulsar’s version numbers, but **only so far as the minor version**. That’s because this repository may need to update more often than Pulsar itself.
167
+
168
+ Suppose a version `1.131.1` exists of Pulsar and is the most recent release in the `1.131` range. To target this version of Pulsar, you should install this types package with
169
+
170
+ ```shell
171
+ npm install -D @types/atom@npm:@pulsar-edit/types@1.131
172
+ ```
173
+
174
+ to ensure you’re getting the most recent version of the types that correspond to the `1.131` release. You _should not_ assume that `@pulsar-edit/types` has a `1.131.1` release — or, if it does exist, that it is the “correct” version of this package to install for Pulsar `1.131.1`. The “correct” version to install is the most recent release that starts with `1.131.`.
175
+
176
+ Pulsar itself will not break API backward-compatibility in a patch release, so patch releases of this package will never be issued in a way that affects backward compatibility. They will always have the effect of describing the current types more accurately.
177
+
178
+
179
+ ## Questions
180
+
181
+ ### Why isn’t this at `@types/pulsar-edit` or something?
182
+
183
+ Because Pulsar isn’t delivered as an NPM package. I’m not sure how or why Atom’s API was ever available at `@types/atom`, considering that the NPM package called `atom` has nothing to do with the Atom editor.
184
+
185
+ ### Why not just update `@types/atom`?
186
+
187
+ We might eventually do that, but this is a suitable workaround for now and frees us from having to negotiate the politics of adopting an orphaned `DefinitelyTyped` package.
@@ -0,0 +1,9 @@
1
+ // NOTE: intentional; needed for config extensibility
2
+ // eslint-disable-next-line @definitelytyped/no-declare-current-package
3
+
4
+ declare module "atom" {
5
+ interface ConfigValues {
6
+ /** Language for internationalization. */
7
+ "atom-i18n.locale": string;
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ // atom-i18n
2
+ // https://web.pulsar-edit.dev/packages/atom-i18n
3
+
4
+ /// <reference path="./config.d.ts" />
@@ -0,0 +1,140 @@
1
+ import "../index";
2
+
3
+ // NOTE: intentional; needed for config extensibility
4
+ // eslint-disable-next-line @definitelytyped/no-declare-current-package
5
+ declare module "atom" {
6
+ interface ConfigValues {
7
+ /**
8
+ * Suggestions will show as you type if this preference is enabled.
9
+ *
10
+ * If it is disabled, you can still see suggestions by using the keymapping
11
+ * for 'autocomplete-plus:activate' (shown below).
12
+ */
13
+ "autocomplete-plus.enableAutoActivation": boolean;
14
+
15
+ /**
16
+ * If you are experiencing performance issues when typing, you should try
17
+ * increasing this value to a non-zero number (e.g. 100).
18
+ */
19
+ "autocomplete-plus.autoActivationDelay": number;
20
+
21
+ /** The suggestion list will only show this many suggestions. */
22
+ "autocomplete-plus.maxVisibleSuggestions": number;
23
+
24
+ /**
25
+ * You should use the key(s) indicated here to confirm a suggestion from
26
+ * the suggestion list and have it inserted into the file.
27
+ */
28
+ "autocomplete-plus.confirmCompletion":
29
+ | "tab"
30
+ | "enter"
31
+ | "tab and enter"
32
+ | "tab always, enter when suggestion explicitly selected";
33
+
34
+ /**
35
+ * Disable this if you want to bind your own keystrokes to move around the
36
+ * suggestion list. You will also need to add definitions to your keymap.
37
+ */
38
+ "autocomplete-plus.useCoreMovementCommands": boolean;
39
+
40
+ /**
41
+ * Suggestions will not be provided for files matching this list — e.g.,
42
+ * `*.md` for Markdown files.
43
+ *
44
+ * To blacklist more than one file extension, use a comma as a separator —
45
+ * e.g., `["*.md", "*.txt"]` (both Markdown and text files).
46
+ */
47
+ "autocomplete-plus.fileBlacklist": string[];
48
+
49
+ /** Suggestions will not be provided for scopes matching this list. */
50
+ "autocomplete-plus.scopeBlacklist": string[];
51
+
52
+ /**
53
+ * For grammars with no registered provider(s), the default provider will
54
+ * include completions from all buffers, instead of just the buffer you are
55
+ * currently editing.
56
+ */
57
+ "autocomplete-plus.includeCompletionsFromAllBuffers": boolean;
58
+
59
+ /**
60
+ * Fuzzy searching is performed if this is disabled; if it is enabled,
61
+ * suggestions must begin with the prefix from the current word.
62
+ */
63
+ "autocomplete-plus.strictMatching": boolean;
64
+
65
+ /**
66
+ * Only autocomplete when you've typed at least this many characters.
67
+ *
68
+ * Note: May not affect external providers.
69
+ */
70
+ "autocomplete-plus.minimumWordLength": number;
71
+
72
+ /**
73
+ * The package comes with a built-in provider that will provide suggestions
74
+ * using the words in your current buffer or all open buffers. You will get
75
+ * better suggestions by installing additional autocomplete+ providers. To
76
+ * stop using the built-in provider, disable this option.
77
+ */
78
+ "autocomplete-plus.enableBuiltinProvider": boolean;
79
+
80
+ /** Don't use the built-in provider for these selector(s). */
81
+ "autocomplete-plus.builtinProviderBlacklist": string;
82
+
83
+ /**
84
+ * If enabled, typing `backspace` will show the suggestion list if
85
+ * suggestions are available. If disabled, suggestions will not be shown
86
+ * while backspacing.
87
+ */
88
+ "autocomplete-plus.backspaceTriggersAutocomplete": boolean;
89
+
90
+ /**
91
+ * If enabled, automatically insert suggestion on manual activation with
92
+ * 'autocomplete-plus:activate' when there is only one match.
93
+ */
94
+ "autocomplete-plus.enableAutoConfirmSingleSuggestion": boolean;
95
+
96
+ /**
97
+ * With 'Cursor' the suggestion list appears at the cursor's position.
98
+ *
99
+ * With 'Word' it appears at the beginning of the word that's being
100
+ * completed.
101
+ */
102
+ "autocomplete-plus.suggestionListFollows": "Word" | "Cursor";
103
+
104
+ /**
105
+ * If you're having trouble with autocomplete, you may consider falling
106
+ * back to the Symbol provider and filing an issue.
107
+ */
108
+ "autocomplete-plus.defaultProvider": "Subsequence" | "Symbol";
109
+
110
+ /**
111
+ * Don't auto-activate when any of these classes are present in the editor.
112
+ */
113
+ "autocomplete-plus.suppressActivationForEditorClasses": string[];
114
+
115
+ /**
116
+ * Completing a suggestion consumes text following the cursor matching the
117
+ * suffix of the chosen suggestion.
118
+ */
119
+ "autocomplete-plus.consumeSuffix": boolean;
120
+
121
+ /**
122
+ * Prefers runs of consecutive characters, acronyms and start of words.
123
+ */
124
+ "autocomplete-plus.useAlternateScoring": boolean;
125
+
126
+ /**
127
+ * Gives words near the cursor position a higher score than those far away.
128
+ */
129
+ "autocomplete-plus.useLocalityBonus": boolean;
130
+
131
+ /** Identifies non-latin alphabet characters as letters. */
132
+ "autocomplete-plus.enableExtendedUnicodeSupport": boolean;
133
+
134
+ /**
135
+ * Should similar suggestions be removed from the list? If so how to
136
+ * determine they are similar.
137
+ */
138
+ "autocomplete-plus.similarSuggestionRemoval": "none" | "textOrSnippet";
139
+ }
140
+ }
@@ -0,0 +1,200 @@
1
+ // Autocomplete Plus 2.x
2
+ // https://web.pulsar-edit.dev/packages/autocomplete-plus
3
+
4
+ /// <reference path="./config.d.ts" />
5
+
6
+ import { Point, ScopeDescriptor, TextEditor } from "../index";
7
+
8
+ /** The parameters passed into getSuggestions by Autocomplete+. */
9
+ export interface SuggestionsRequestedEvent {
10
+ /** The current TextEditor. */
11
+ editor: TextEditor;
12
+
13
+ /** The position of the cursor. */
14
+ bufferPosition: Point;
15
+
16
+ /** The scope descriptor for the current cursor position. */
17
+ scopeDescriptor: ScopeDescriptor;
18
+
19
+ /**
20
+ * The prefix for the word immediately preceding the current cursor position.
21
+ */
22
+ prefix: string;
23
+
24
+ /** Whether the autocomplete request was initiated by the user. */
25
+ activatedManually: boolean;
26
+ }
27
+
28
+ /** The parameters passed into onDidInsertSuggestion by Autocomplete+. */
29
+ export interface SuggestionInsertedEvent {
30
+ editor: TextEditor;
31
+ triggerPosition: Point;
32
+ suggestion: TextSuggestion | SnippetSuggestion;
33
+ }
34
+
35
+ /**
36
+ * An autocompletion suggestion for the user.
37
+ *
38
+ * Primary data type for the Atom Autocomplete+ service.
39
+ */
40
+ export interface SuggestionBase {
41
+ /**
42
+ * A string that will show in the UI for this suggestion.
43
+ *
44
+ * When not set, `snippet || text` is displayed.
45
+ */
46
+ displayText?: string;
47
+
48
+ /**
49
+ * The text immediately preceding the cursor, which will be replaced by the
50
+ * text. If not provided, the prefix passed into getSuggestions will be used.
51
+ */
52
+ replacementPrefix?: string;
53
+
54
+ /**
55
+ * The suggestion type. It will be converted into an icon shown against the
56
+ * suggestion.
57
+ */
58
+ type?: string;
59
+
60
+ /** This is shown before the suggestion. Useful for return values. */
61
+ leftLabel?: string;
62
+
63
+ /**
64
+ * Use this instead of `leftLabel` if you want to use HTML for the left
65
+ * label.
66
+ */
67
+ leftLabelHTML?: string;
68
+
69
+ /**
70
+ * An indicator (e.g. function, variable) denoting the "kind" of suggestion
71
+ * this represents.
72
+ */
73
+ rightLabel?: string;
74
+
75
+ /**
76
+ * Use this instead of `rightLabel` if you want to use HTML for the right
77
+ * label.
78
+ */
79
+ rightLabelHTML?: string;
80
+
81
+ /**
82
+ * Class name for the suggestion in the suggestion list.
83
+ *
84
+ * Allows you to style your suggestion via CSS, if desired.
85
+ */
86
+ className?: string;
87
+
88
+ /**
89
+ * If you want complete control over the icon shown against the suggestion.
90
+ *
91
+ * e.g. `iconHTML: '<i class="icon-move-right"></i>'`
92
+ */
93
+ iconHTML?: string;
94
+
95
+ /**
96
+ * A doc-string summary or short description of the suggestion.
97
+ *
98
+ * When specified, it will be displayed at the bottom of the suggestions
99
+ * list.
100
+ */
101
+ description?: string;
102
+
103
+ /**
104
+ * A url to the documentation or more information about this suggestion.
105
+ *
106
+ * When specified, a "More.." link will be displayed in the description area.
107
+ */
108
+ descriptionMoreURL?: string;
109
+
110
+ /**
111
+ * Description with Markdown formatting.
112
+ *
113
+ * Takes precedence over plaintext description.
114
+ */
115
+ descriptionMarkdown?: string;
116
+ }
117
+
118
+ export interface TextSuggestion extends SuggestionBase {
119
+ /** The text which will be inserted into the editor, in place of the prefix. */
120
+ text: string;
121
+ }
122
+
123
+ export interface SnippetSuggestion extends SuggestionBase {
124
+ /**
125
+ * A snippet string. This will allow users to tab through function arguments
126
+ * or other options.
127
+ */
128
+ snippet: string;
129
+ }
130
+
131
+ export type AnySuggestion = TextSuggestion | SnippetSuggestion;
132
+ export type Suggestion = AnySuggestion;
133
+ export type Suggestions = AnySuggestion[];
134
+
135
+ /** The interface that all Autocomplete+ providers must implement. */
136
+ export interface AutocompleteProvider {
137
+ /**
138
+ * Defines the scope selector(s) (can be comma-separated) for which your
139
+ * provider should receive suggestion requests.
140
+ */
141
+ selector: string;
142
+
143
+ /**
144
+ * Defines the scope selector(s) (can be comma-separated) for which your
145
+ * provider should not be used.
146
+ */
147
+ disableForSelector?: string;
148
+
149
+ /**
150
+ * A number to indicate its priority to be included in a suggestions request.
151
+ *
152
+ * The default provider has an inclusion priority of 0. Higher priority
153
+ * providers can suppress lower priority providers with
154
+ * {@link excludeLowerPriority}.
155
+ */
156
+ inclusionPriority?: number;
157
+
158
+ /** Will not use lower priority providers when this provider is used. */
159
+ excludeLowerPriority?: boolean;
160
+
161
+ /**
162
+ * A number to determine the sort order of suggestions.
163
+ *
164
+ * The default provider has a suggestion priority of 1.
165
+ */
166
+ suggestionPriority?: number;
167
+
168
+ /**
169
+ * Whether to allow Autocomplete+ to filter and sort the suggestions you
170
+ * provide.
171
+ */
172
+ filterSuggestions?: boolean;
173
+
174
+ /**
175
+ * Called when a suggestion request has been dispatched by Autocomplete+ to
176
+ * your provider.
177
+ *
178
+ * Return an array of suggestions (if any) in the order you would like them
179
+ * displayed to the user. Returning a promise of an array of suggestions is
180
+ * also supported.
181
+ */
182
+ getSuggestions(params: SuggestionsRequestedEvent): Suggestions | Promise<Suggestions>;
183
+
184
+ /**
185
+ * Called when a suggestion is selected by the user for the purpose of
186
+ * loading more information about the suggestion.
187
+ *
188
+ * Return a promise of the new suggestion to replace it with or return `null`
189
+ * if no change is needed.
190
+ */
191
+ getSuggestionDetailsOnSelect?(suggestion: AnySuggestion): Promise<AnySuggestion | null> | AnySuggestion | null;
192
+
193
+ /**
194
+ * Called when a suggestion from your provider was inserted into the buffer.
195
+ */
196
+ onDidInsertSuggestion?(params: SuggestionInsertedEvent): void;
197
+
198
+ /** Called if your provider is being destroyed by Autocomplete+. */
199
+ dispose?(): void;
200
+ }