cdeops 10.5.1-alpha.23 → 10.6.2-alpha.0
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.
- package/client.d.ts +100 -1
- package/package.json +2 -2
package/client.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ declare module 'cdeops/client' {
|
|
|
15
15
|
ConfigurationTarget,
|
|
16
16
|
OrganizationConfiguration,
|
|
17
17
|
configuration,
|
|
18
|
-
organization
|
|
18
|
+
organization,
|
|
19
|
+
commands,
|
|
19
20
|
} from 'cdeops';
|
|
20
21
|
|
|
21
22
|
export {
|
|
@@ -31,6 +32,7 @@ declare module 'cdeops/client' {
|
|
|
31
32
|
OrganizationConfiguration,
|
|
32
33
|
configuration,
|
|
33
34
|
organization,
|
|
35
|
+
commands,
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export interface DocumentFilter {
|
|
@@ -318,4 +320,101 @@ declare module 'cdeops/client' {
|
|
|
318
320
|
add: (unsubscribe: Unsubscribable | (() => void)) => void;
|
|
319
321
|
}
|
|
320
322
|
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Namespace for dealing with commands. In short, a command is a function with a
|
|
326
|
+
* unique identifier. The function is sometimes also called _command handler_.
|
|
327
|
+
*
|
|
328
|
+
* Commands can be added to the editor using the [registerCommand](#commands.registerCommand)
|
|
329
|
+
* and [registerTextEditorCommand](#commands.registerTextEditorCommand) functions. Commands
|
|
330
|
+
* can be executed [manually](#commands.executeCommand) or from a UI gesture. Those are:
|
|
331
|
+
*
|
|
332
|
+
* * palette - Use the `commands`-section in `package.json` to make a command show in
|
|
333
|
+
* the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
|
|
334
|
+
* * keybinding - Use the `keybindings`-section in `package.json` to enable
|
|
335
|
+
* [keybindings](https://code.visualstudio.com/docs/getstarted/keybindings#_customizing-shortcuts)
|
|
336
|
+
* for your extension.
|
|
337
|
+
*
|
|
338
|
+
* Commands from other extensions and from the editor itself are accessible to an extension. However,
|
|
339
|
+
* when invoking an editor command not all argument types are supported.
|
|
340
|
+
*
|
|
341
|
+
* This is a sample that registers a command handler and adds an entry for that command to the palette. First
|
|
342
|
+
* register a command handler with the identifier `extension.sayHello`.
|
|
343
|
+
* ```javascript
|
|
344
|
+
* commands.registerCommand('extension.sayHello', () => {
|
|
345
|
+
* window.showInformationMessage('Hello World!');
|
|
346
|
+
* });
|
|
347
|
+
* ```
|
|
348
|
+
* Second, bind the command identifier to a title under which it will show in the palette (`package.json`).
|
|
349
|
+
* ```json
|
|
350
|
+
* {
|
|
351
|
+
* "contributes": {
|
|
352
|
+
* "commands": [{
|
|
353
|
+
* "command": "extension.sayHello",
|
|
354
|
+
* "title": "Hello World"
|
|
355
|
+
* }]
|
|
356
|
+
* }
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
export namespace commands {
|
|
361
|
+
/**
|
|
362
|
+
* Registers a command that can be invoked via a keyboard shortcut,
|
|
363
|
+
* a menu item, an action, or directly.
|
|
364
|
+
*
|
|
365
|
+
* Registering a command with an existing command identifier twice
|
|
366
|
+
* will cause an error.
|
|
367
|
+
*
|
|
368
|
+
* @param command A unique identifier for the command.
|
|
369
|
+
* @param callback A command handler function.
|
|
370
|
+
* @param thisArg The `this` context used when invoking the handler function.
|
|
371
|
+
* @return Disposable which unregisters this command on disposal.
|
|
372
|
+
*/
|
|
373
|
+
export function registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Registers a text editor command that can be invoked via a keyboard shortcut,
|
|
377
|
+
* a menu item, an action, or directly.
|
|
378
|
+
*
|
|
379
|
+
* Text editor commands are different from ordinary [commands](#commands.registerCommand) as
|
|
380
|
+
* they only execute when there is an active editor when the command is called. Also, the
|
|
381
|
+
* command handler of an editor command has access to the active editor and to an
|
|
382
|
+
* [edit](#TextEditorEdit)-builder.
|
|
383
|
+
*
|
|
384
|
+
* @param command A unique identifier for the command.
|
|
385
|
+
* @param callback A command handler function with access to an [editor](#TextEditor) and an [edit](#TextEditorEdit).
|
|
386
|
+
* @param thisArg The `this` context used when invoking the handler function.
|
|
387
|
+
* @return Disposable which unregisters this command on disposal.
|
|
388
|
+
*/
|
|
389
|
+
export function registerTextEditorCommand(
|
|
390
|
+
command: string,
|
|
391
|
+
callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void,
|
|
392
|
+
thisArg?: any,
|
|
393
|
+
): Disposable;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Executes the command denoted by the given command identifier.
|
|
397
|
+
*
|
|
398
|
+
* * *Note 1:* When executing an editor command not all types are allowed to
|
|
399
|
+
* be passed as arguments. Allowed are the primitive types `string`, `boolean`,
|
|
400
|
+
* `number`, `undefined`, and `null`, as well as [`Position`](#Position), [`Range`](#Range), [`Uri`](#Uri) and [`Location`](#Location).
|
|
401
|
+
* * *Note 2:* There are no restrictions when executing commands that have been contributed
|
|
402
|
+
* by extensions.
|
|
403
|
+
*
|
|
404
|
+
* @param command Identifier of the command to execute.
|
|
405
|
+
* @param rest Parameters passed to the command function.
|
|
406
|
+
* @return A promise that resolves to the returned value of the given command. `undefined` when
|
|
407
|
+
* the command handler function doesn't return anything.
|
|
408
|
+
*/
|
|
409
|
+
export function executeCommand<T>(command: string, ...rest: any[]): Promise<T | undefined>;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Retrieve the list of all available commands. Commands starting an underscore are
|
|
413
|
+
* treated as internal commands.
|
|
414
|
+
*
|
|
415
|
+
* @param filterInternal Set `true` to not see internal commands (starting with an underscore)
|
|
416
|
+
* @return Promise that resolves to a list of command ids.
|
|
417
|
+
*/
|
|
418
|
+
export function getCommands(filterInternal?: boolean): Promise<string[]>;
|
|
419
|
+
}
|
|
321
420
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cdeops",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.2-alpha.0",
|
|
4
4
|
"description": "Cdecode - Extension API: build extensions that enhance coding experience in your cdeops editor",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "6b8b156d4ee37b3402efc73e78c1bb6ca605eb92"
|
|
33
33
|
}
|