coc-code-runner 0.0.2 → 0.0.4

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 (3) hide show
  1. package/README.md +2 -0
  2. package/lib/index.js +41 -11
  3. package/package.json +5 -1
package/README.md CHANGED
@@ -17,10 +17,12 @@ Code Runner for coc.nvim
17
17
  ## Code Actions
18
18
 
19
19
  - code runner: `coc-code-runner.run`
20
+ - stop code runner: `coc-code-runner.stop`
20
21
 
21
22
  ## Commands
22
23
 
23
24
  - `coc-code-runner.run`: Run Code
25
+ - `coc-code-runner.stop`: Stop Run Code
24
26
 
25
27
  ---
26
28
 
package/lib/index.js CHANGED
@@ -6330,6 +6330,7 @@ var require_main3 = __commonJS({
6330
6330
  // src/index.ts
6331
6331
  var src_exports = {};
6332
6332
  __export(src_exports, {
6333
+ _process: () => _process,
6333
6334
  activate: () => activate
6334
6335
  });
6335
6336
  module.exports = __toCommonJS(src_exports);
@@ -6405,17 +6406,31 @@ var RunCodeActionProvider = class {
6405
6406
  }
6406
6407
  provideCodeActions() {
6407
6408
  const actions = [];
6408
- actions.push(
6409
- import_vscode_languageserver_protocol.CodeAction.create(
6410
- "code runner",
6411
- {
6412
- title: "code runner",
6413
- command: "coc-code-runner.run",
6414
- arguments: []
6415
- },
6416
- import_coc3.CodeActionKind.Empty
6417
- )
6418
- );
6409
+ if (_process) {
6410
+ actions.push(
6411
+ import_vscode_languageserver_protocol.CodeAction.create(
6412
+ "stop code runner",
6413
+ {
6414
+ title: "stop code runner",
6415
+ command: "coc-code-runner.stop",
6416
+ arguments: []
6417
+ },
6418
+ import_coc3.CodeActionKind.Empty
6419
+ )
6420
+ );
6421
+ } else {
6422
+ actions.push(
6423
+ import_vscode_languageserver_protocol.CodeAction.create(
6424
+ "code runner",
6425
+ {
6426
+ title: "code runner",
6427
+ command: "coc-code-runner.run",
6428
+ arguments: []
6429
+ },
6430
+ import_coc3.CodeActionKind.Empty
6431
+ )
6432
+ );
6433
+ }
6419
6434
  return actions;
6420
6435
  }
6421
6436
  };
@@ -6438,12 +6453,25 @@ async function activate(context) {
6438
6453
  new RunCodeActionProvider(),
6439
6454
  "code-runner"
6440
6455
  ),
6456
+ import_coc4.commands.registerCommand("coc-code-runner.stop", async () => {
6457
+ if (_channel) {
6458
+ _channel.appendLine("[Stopped] Process has been stopped by user.");
6459
+ _channel.hide();
6460
+ _channel.dispose();
6461
+ }
6462
+ if (_process) {
6463
+ _process.kill();
6464
+ _process = null;
6465
+ }
6466
+ import_coc4.window.showInformationMessage("Code execution stopped.");
6467
+ }),
6441
6468
  import_coc4.commands.registerCommand("coc-code-runner.run", async () => {
6442
6469
  if (_channel) {
6443
6470
  _channel.dispose();
6444
6471
  }
6445
6472
  if (_process) {
6446
6473
  _process.kill();
6474
+ _process = null;
6447
6475
  }
6448
6476
  _channel = import_coc4.window.createOutputChannel("coc-code-runner");
6449
6477
  let command;
@@ -6481,6 +6509,7 @@ async function activate(context) {
6481
6509
  }
6482
6510
  if (_process) {
6483
6511
  _process.kill();
6512
+ _process = null;
6484
6513
  }
6485
6514
  });
6486
6515
  _channel.show(true);
@@ -6490,5 +6519,6 @@ async function activate(context) {
6490
6519
  }
6491
6520
  // Annotate the CommonJS export names for ESM import in node:
6492
6521
  0 && (module.exports = {
6522
+ _process,
6493
6523
  activate
6494
6524
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-code-runner",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Code Runner for coc.nvim",
5
5
  "author": "cyl <a1008611abcd@126.com>",
6
6
  "license": "MIT",
@@ -105,6 +105,10 @@
105
105
  {
106
106
  "command": "coc-code-runner.run",
107
107
  "title": "Run Code"
108
+ },
109
+ {
110
+ "command": "coc-code-runner.stop",
111
+ "title": "Stop Run Code"
108
112
  }
109
113
  ]
110
114
  },