coc-code-runner 0.0.2 → 0.0.3

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 +42 -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,32 @@ 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
+ import_coc3.window.showInformationMessage("ss");
6411
+ actions.push(
6412
+ import_vscode_languageserver_protocol.CodeAction.create(
6413
+ "stop code runner",
6414
+ {
6415
+ title: "stop code runner",
6416
+ command: "coc-code-runner.stop",
6417
+ arguments: []
6418
+ },
6419
+ import_coc3.CodeActionKind.Empty
6420
+ )
6421
+ );
6422
+ } else {
6423
+ actions.push(
6424
+ import_vscode_languageserver_protocol.CodeAction.create(
6425
+ "code runner",
6426
+ {
6427
+ title: "code runner",
6428
+ command: "coc-code-runner.run",
6429
+ arguments: []
6430
+ },
6431
+ import_coc3.CodeActionKind.Empty
6432
+ )
6433
+ );
6434
+ }
6419
6435
  return actions;
6420
6436
  }
6421
6437
  };
@@ -6438,12 +6454,25 @@ async function activate(context) {
6438
6454
  new RunCodeActionProvider(),
6439
6455
  "code-runner"
6440
6456
  ),
6457
+ import_coc4.commands.registerCommand("coc-code-runner.stop", async () => {
6458
+ if (_channel) {
6459
+ _channel.appendLine("[Stopped] Process has been stopped by user.");
6460
+ _channel.hide();
6461
+ _channel.dispose();
6462
+ }
6463
+ if (_process) {
6464
+ _process.kill();
6465
+ _process = null;
6466
+ }
6467
+ import_coc4.window.showInformationMessage("Code execution stopped.");
6468
+ }),
6441
6469
  import_coc4.commands.registerCommand("coc-code-runner.run", async () => {
6442
6470
  if (_channel) {
6443
6471
  _channel.dispose();
6444
6472
  }
6445
6473
  if (_process) {
6446
6474
  _process.kill();
6475
+ _process = null;
6447
6476
  }
6448
6477
  _channel = import_coc4.window.createOutputChannel("coc-code-runner");
6449
6478
  let command;
@@ -6481,6 +6510,7 @@ async function activate(context) {
6481
6510
  }
6482
6511
  if (_process) {
6483
6512
  _process.kill();
6513
+ _process = null;
6484
6514
  }
6485
6515
  });
6486
6516
  _channel.show(true);
@@ -6490,5 +6520,6 @@ async function activate(context) {
6490
6520
  }
6491
6521
  // Annotate the CommonJS export names for ESM import in node:
6492
6522
  0 && (module.exports = {
6523
+ _process,
6493
6524
  activate
6494
6525
  });
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.3",
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
  },