coc-pyright 1.1.252 → 1.1.260

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/README.md CHANGED
@@ -67,6 +67,7 @@ These configurations are used by `coc-pyright`, you need to set them in your `co
67
67
  | pyright.server | Custom `pyright-langserver` path | '' |
68
68
  | pyright.disableCompletion | Disables completion from Pyright, left other LSP features work | false |
69
69
  | pyright.disableDiagnostics | Disable diagnostics from Pyright | false |
70
+ | pyright.disableProgressNotifications | Disable the initialization and workdone progress notifications | false |
70
71
  | pyright.completion.importSupport | Enable `python-import` completion source support | true |
71
72
  | pyright.completion.snippetSupport | Enable completion snippets support | true |
72
73
  | pyright.organizeimports.provider | Organize imports provider, `pyright` or `isort` | pyright |
package/lib/index.js CHANGED
@@ -1,26 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
8
  var __commonJS = (cb, mod) => function __require() {
25
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
10
  };
@@ -3448,7 +3432,7 @@ var require_make_dir = __commonJS({
3448
3432
  const defaults = { mode: 511 };
3449
3433
  if (typeof options === "number")
3450
3434
  return options;
3451
- return __spreadValues(__spreadValues({}, defaults), options).mode;
3435
+ return { ...defaults, ...options }.mode;
3452
3436
  };
3453
3437
  module2.exports.makeDir = async (dir, options) => {
3454
3438
  checkPath(dir);
@@ -5090,7 +5074,18 @@ var require_move2 = __commonJS({
5090
5074
  var require_lib = __commonJS({
5091
5075
  "node_modules/fs-extra/lib/index.js"(exports, module2) {
5092
5076
  "use strict";
5093
- module2.exports = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, require_fs()), require_copy2()), require_empty()), require_ensure()), require_json()), require_mkdirs()), require_move2()), require_output_file()), require_path_exists()), require_remove());
5077
+ module2.exports = {
5078
+ ...require_fs(),
5079
+ ...require_copy2(),
5080
+ ...require_empty(),
5081
+ ...require_ensure(),
5082
+ ...require_json(),
5083
+ ...require_mkdirs(),
5084
+ ...require_move2(),
5085
+ ...require_output_file(),
5086
+ ...require_path_exists(),
5087
+ ...require_remove()
5088
+ };
5094
5089
  }
5095
5090
  });
5096
5091
 
@@ -21828,7 +21823,7 @@ var ProcessService = class {
21828
21823
  return deferred.promise;
21829
21824
  }
21830
21825
  getDefaultOptions(options) {
21831
- const defaultOptions = __spreadValues({}, options);
21826
+ const defaultOptions = { ...options };
21832
21827
  const execOptions = defaultOptions;
21833
21828
  if (execOptions) {
21834
21829
  const encoding = execOptions.encoding = typeof execOptions.encoding === "string" && execOptions.encoding.length > 0 ? execOptions.encoding : DEFAULT_ENCODING;
@@ -21836,9 +21831,9 @@ var ProcessService = class {
21836
21831
  execOptions.encoding = encoding;
21837
21832
  }
21838
21833
  if (!defaultOptions.env || Object.keys(defaultOptions.env).length === 0) {
21839
- defaultOptions.env = __spreadValues({}, process.env);
21834
+ defaultOptions.env = { ...process.env };
21840
21835
  } else {
21841
- defaultOptions.env = __spreadValues({}, defaultOptions.env);
21836
+ defaultOptions.env = { ...defaultOptions.env };
21842
21837
  }
21843
21838
  defaultOptions.env.PYTHONUNBUFFERED = "1";
21844
21839
  if (!defaultOptions.env.PYTHONIOENCODING) {
@@ -21856,11 +21851,11 @@ var PythonExecutionService = class {
21856
21851
  return this.procService.exec(this.pythonSettings.pythonPath, ["-c", `import ${moduleName}`], { throwOnStdErr: true }).then(() => true).catch(() => false);
21857
21852
  }
21858
21853
  execObservable(args, options) {
21859
- const opts = __spreadValues({}, options);
21854
+ const opts = { ...options };
21860
21855
  return this.procService.execObservable(this.pythonSettings.pythonPath, args, opts);
21861
21856
  }
21862
21857
  async exec(executionInfo, options) {
21863
- const opts = __spreadValues({}, options);
21858
+ const opts = { ...options };
21864
21859
  const { execPath, moduleName, args } = executionInfo;
21865
21860
  if (moduleName && moduleName.length > 0) {
21866
21861
  const result = await this.procService.exec(this.pythonSettings.pythonPath, ["-m", moduleName, ...args], opts);
@@ -21946,7 +21941,7 @@ var BaseFormatter = class {
21946
21941
  }
21947
21942
  const edits = getTextEditsFromPatch(document.getText(), data);
21948
21943
  if (edits.length)
21949
- import_coc4.window.showMessage(`Formatted with ${this.Id}`);
21944
+ import_coc4.window.showInformationMessage(`Formatted with ${this.Id}`);
21950
21945
  return edits;
21951
21946
  }).catch((error) => {
21952
21947
  this.handleError(this.Id, error).catch(() => {
@@ -21968,7 +21963,7 @@ var BaseFormatter = class {
21968
21963
  if (isNotInstalledError(error)) {
21969
21964
  customError = `${customError}: ${this.Id} module is not installed.`;
21970
21965
  }
21971
- import_coc4.window.showMessage(customError, "warning");
21966
+ import_coc4.window.showWarningMessage(customError);
21972
21967
  }
21973
21968
  createTempFile(document) {
21974
21969
  return getTempFileWithDocumentContents(document);
@@ -22024,7 +22019,7 @@ var BlackFormatter = class extends BaseFormatter {
22024
22019
  if (formatSelection) {
22025
22020
  const errorMessage = async () => {
22026
22021
  this.outputChannel.appendLine('Black does not support the "Format Selection" command');
22027
- import_coc5.window.showMessage('Black does not support the "Format Selection" command', "error");
22022
+ import_coc5.window.showErrorMessage('Black does not support the "Format Selection" command');
22028
22023
  return [];
22029
22024
  };
22030
22025
  return errorMessage();
@@ -22181,12 +22176,12 @@ async function getPorts(options) {
22181
22176
  if (exclude.has(port)) {
22182
22177
  continue;
22183
22178
  }
22184
- let availablePort = await getAvailablePort(__spreadProps(__spreadValues({}, options), { port }), hosts);
22179
+ let availablePort = await getAvailablePort({ ...options, port }, hosts);
22185
22180
  while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
22186
22181
  if (port !== 0) {
22187
22182
  throw new Locked(port);
22188
22183
  }
22189
- availablePort = await getAvailablePort(__spreadProps(__spreadValues({}, options), { port }), hosts);
22184
+ availablePort = await getAvailablePort({ ...options, port }, hosts);
22190
22185
  }
22191
22186
  lockedPorts.young.add(availablePort);
22192
22187
  return availablePort;
@@ -22287,16 +22282,16 @@ var PythonFormattingEditProvider = class {
22287
22282
  }
22288
22283
  async _provideEdits(document, options, token, range) {
22289
22284
  const provider = this.pythonSettings.formatting.provider;
22290
- const formater = this.formatters.get(provider);
22291
- if (!formater) {
22292
- import_coc8.window.showMessage(`No formatter is set. You need to set "python.formatting.provider" in your coc-settings.json`);
22285
+ const formatter = this.formatters.get(provider);
22286
+ if (!formatter) {
22287
+ import_coc8.window.showWarningMessage(`No formatter is set. You need to set "python.formatting.provider" in your coc-settings.json`);
22293
22288
  this.outputChannel.appendLine(`${"#".repeat(10)} Error: python.formatting.provider is ${provider}, which is not supported`);
22294
22289
  return [];
22295
22290
  }
22296
22291
  this.outputChannel.appendLine(`Using python from ${this.pythonSettings.pythonPath}
22297
22292
  `);
22298
- this.outputChannel.appendLine(`${"#".repeat(10)} active formattor: ${formater.Id}`);
22299
- return await formater.formatDocument(document, options, token, range);
22293
+ this.outputChannel.appendLine(`${"#".repeat(10)} active formattor: ${formatter.Id}`);
22294
+ return await formatter.formatDocument(document, options, token, range);
22300
22295
  }
22301
22296
  provideDocumentFormattingEdits(document, options, token) {
22302
22297
  return this._provideEdits(document, options, token);
@@ -22363,7 +22358,7 @@ async function sortImports(extensionRoot, outputChannel) {
22363
22358
  outputChannel.appendLine(`${"#".repeat(10)} isort Output ${"#".repeat(10)}`);
22364
22359
  outputChannel.appendLine(`Error from isort:
22365
22360
  ${message}`);
22366
- import_coc9.window.showMessage(`Failed to format import by isort`, "error");
22361
+ import_coc9.window.showErrorMessage(`Failed to format import by isort`);
22367
22362
  }
22368
22363
  }
22369
22364
 
@@ -23285,7 +23280,7 @@ async function checkDocument(doc) {
23285
23280
  return false;
23286
23281
  const modified = await doc.buffer.getOption("modified");
23287
23282
  if (modified != 0) {
23288
- import_coc23.window.showMessage("Buffer not saved, please save the buffer first!", "warning");
23283
+ import_coc23.window.showWarningMessage("Buffer not saved, please save the buffer first!");
23289
23284
  return false;
23290
23285
  }
23291
23286
  return true;
@@ -23308,7 +23303,7 @@ async function extractVariable(root, document, range, outputChannel) {
23308
23303
  const pythonToolsExecutionService = new PythonExecutionService();
23309
23304
  const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
23310
23305
  if (!rope) {
23311
- import_coc23.window.showMessage(`Module rope not installed`, "warning");
23306
+ import_coc23.window.showWarningMessage(`Module rope not installed`);
23312
23307
  return;
23313
23308
  }
23314
23309
  const workspaceFolder = import_coc23.workspace.getWorkspaceFolder(doc.uri);
@@ -23331,7 +23326,7 @@ async function extractMethod(root, document, range, outputChannel) {
23331
23326
  const pythonToolsExecutionService = new PythonExecutionService();
23332
23327
  const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
23333
23328
  if (!rope) {
23334
- import_coc23.window.showMessage(`Module rope not installed`, "warning");
23329
+ import_coc23.window.showWarningMessage(`Module rope not installed`);
23335
23330
  return;
23336
23331
  }
23337
23332
  const workspaceFolder = import_coc23.workspace.getWorkspaceFolder(doc.uri);
@@ -23354,7 +23349,7 @@ async function addImport(root, document, name, parent, outputChannel) {
23354
23349
  const pythonToolsExecutionService = new PythonExecutionService();
23355
23350
  const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
23356
23351
  if (!rope) {
23357
- import_coc23.window.showMessage(`Module rope not installed`, "warning");
23352
+ import_coc23.window.showWarningMessage(`Module rope not installed`);
23358
23353
  return;
23359
23354
  }
23360
23355
  let parentModule = "";
@@ -23390,7 +23385,7 @@ async function applyImports(doc, resp, outputChannel) {
23390
23385
  outputChannel.appendLine(`Error in add import:
23391
23386
  ${errorMessage}`);
23392
23387
  outputChannel.appendLine("");
23393
- import_coc23.window.showMessage(`Cannot perform addImport using selected element(s).`, "error");
23388
+ import_coc23.window.showErrorMessage(`Cannot perform addImport using selected element(s).`);
23394
23389
  return await Promise.reject(error);
23395
23390
  }
23396
23391
  }
@@ -23440,7 +23435,7 @@ async function extractName(textEditor, newName, renameResponse, outputChannel) {
23440
23435
  outputChannel.appendLine(`Error in refactoring:
23441
23436
  ${errorMessage}`);
23442
23437
  outputChannel.appendLine("");
23443
- import_coc23.window.showMessage(`Cannot perform refactoring using selected element(s).`, "error");
23438
+ import_coc23.window.showErrorMessage(`Cannot perform refactoring using selected element(s).`);
23444
23439
  return await Promise.reject(error);
23445
23440
  }
23446
23441
  }
@@ -23565,11 +23560,11 @@ async function activate(context) {
23565
23560
  return;
23566
23561
  const state = import_coc24.extensions.getExtensionState("coc-python");
23567
23562
  if (state.toString() === "activated") {
23568
- import_coc24.window.showMessage(`coc-python is installed and activated, coc-pyright will be disabled`, "warning");
23563
+ import_coc24.window.showWarningMessage(`coc-python is installed and activated, coc-pyright will be disabled`);
23569
23564
  return;
23570
23565
  }
23571
23566
  if ((0, import_semver2.lt)(process.versions.node, "12.0.0")) {
23572
- import_coc24.window.showMessage(`Pyright needs Node.js v12+ to work, your Node.js is ${process.version}.`, "error");
23567
+ import_coc24.window.showErrorMessage(`Pyright needs Node.js v12+ to work, your Node.js is ${process.version}.`);
23573
23568
  return;
23574
23569
  }
23575
23570
  let module2 = pyrightCfg.get("server");
@@ -23579,7 +23574,7 @@ async function activate(context) {
23579
23574
  module2 = (0, import_path5.join)(context.extensionPath, "node_modules", "pyright", "langserver.index.js");
23580
23575
  }
23581
23576
  if (!(0, import_fs.existsSync)(module2)) {
23582
- import_coc24.window.showMessage(`Pyright langserver doesn't exist, please reinstall coc-pyright`, "error");
23577
+ import_coc24.window.showErrorMessage(`Pyright langserver doesn't exist, please reinstall coc-pyright`);
23583
23578
  return;
23584
23579
  }
23585
23580
  const runOptions = { execArgv: [`--max-old-space-size=${defaultHeapSize}`] };
@@ -23595,6 +23590,9 @@ async function activate(context) {
23595
23590
  if (pyrightCfg.get("disableDiagnostics")) {
23596
23591
  disabledFeatures.push("diagnostics");
23597
23592
  }
23593
+ const disableProgress = pyrightCfg.get("disableProgressNotifications");
23594
+ if (disableProgress)
23595
+ disabledFeatures.push("progress");
23598
23596
  const outputChannel = import_coc24.window.createOutputChannel("Pyright");
23599
23597
  const pythonSettings = PythonSettings.getInstance();
23600
23598
  outputChannel.appendLine(`Workspace: ${import_coc24.workspace.root}`);
@@ -23607,7 +23605,7 @@ async function activate(context) {
23607
23605
  },
23608
23606
  outputChannel,
23609
23607
  disabledFeatures,
23610
- progressOnInitialization: true,
23608
+ progressOnInitialization: !disableProgress,
23611
23609
  middleware: {
23612
23610
  workspace: {
23613
23611
  configuration
@@ -23651,7 +23649,7 @@ async function activate(context) {
23651
23649
  command = "pyright.createtypestub";
23652
23650
  disposable = import_coc24.commands.registerCommand(command, async (...args) => {
23653
23651
  if (!args.length) {
23654
- import_coc24.window.showMessage(`Module name is missing`, "warning");
23652
+ import_coc24.window.showWarningMessage(`Module name is missing`);
23655
23653
  return;
23656
23654
  }
23657
23655
  const doc = await import_coc24.workspace.document;
@@ -23692,7 +23690,7 @@ async function activate(context) {
23692
23690
  const pyrightPackage = JSON.parse((0, import_fs.readFileSync)(pyrightJSON, "utf8"));
23693
23691
  const cocPyrightJSON = (0, import_path5.join)(context.extensionPath, "package.json");
23694
23692
  const cocPyrightPackage = JSON.parse((0, import_fs.readFileSync)(cocPyrightJSON, "utf8"));
23695
- import_coc24.window.showMessage(`coc-pyright ${cocPyrightPackage.version} with Pyright ${pyrightPackage.version}`);
23693
+ import_coc24.window.showInformationMessage(`coc-pyright ${cocPyrightPackage.version} with Pyright ${pyrightPackage.version}`);
23696
23694
  });
23697
23695
  context.subscriptions.push(disposable);
23698
23696
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-pyright",
3
- "version": "1.1.252",
3
+ "version": "1.1.260",
4
4
  "description": "Pyright extension for coc.nvim, static type checker for Python",
5
5
  "author": "Heyward Fann <fannheyward@gmail.com>",
6
6
  "license": "MIT",
@@ -425,6 +425,17 @@
425
425
  "error"
426
426
  ]
427
427
  },
428
+ "reportTypeCommentUsage": {
429
+ "type": "string",
430
+ "description": "Diagnostics for usage of deprecated type comments.",
431
+ "default": "none",
432
+ "enum": [
433
+ "none",
434
+ "information",
435
+ "warning",
436
+ "error"
437
+ ]
438
+ },
428
439
  "reportPrivateImportUsage": {
429
440
  "type": "string",
430
441
  "description": "Diagnostics for incorrect usage of symbol imported from a \"py.typed\" module that is not re-exported from that module.",
@@ -1327,6 +1338,11 @@
1327
1338
  "default": false,
1328
1339
  "description": "Disable diagnostics from Pyright"
1329
1340
  },
1341
+ "pyright.disableProgressNotifications": {
1342
+ "type": "boolean",
1343
+ "default": false,
1344
+ "description": "Disable the initialization and workdone progress notifications"
1345
+ },
1330
1346
  "pyright.completion.importSupport": {
1331
1347
  "type": "boolean",
1332
1348
  "default": true,
@@ -1403,6 +1419,6 @@
1403
1419
  ]
1404
1420
  },
1405
1421
  "dependencies": {
1406
- "pyright": "^1.1.251"
1422
+ "pyright": "^1.1.260"
1407
1423
  }
1408
1424
  }
@@ -67,6 +67,17 @@
67
67
  "pattern": "^(.*)$"
68
68
  }
69
69
  },
70
+ "defineConstant": {
71
+ "$id": "#/properties/defineConstant",
72
+ "type": "object",
73
+ "title": "Identifiers that should be treated as constants",
74
+ "properties": {
75
+ },
76
+ "additionalProperties": {
77
+ "type": ["string", "boolean"],
78
+ "title": "Value of constant (boolean or string)"
79
+ }
80
+ },
70
81
  "typeCheckingMode": {
71
82
  "$id": "#/properties/typeCheckingMode",
72
83
  "type": "string",
@@ -281,6 +292,12 @@
281
292
  "title": "Controls reporting of private variables and functions used outside of the owning class or module and usage of protected members outside of subclasses",
282
293
  "default": "none"
283
294
  },
295
+ "reportTypeCommentUsage": {
296
+ "$id": "#/properties/reportTypeCommentUsage",
297
+ "$ref": "#/definitions/diagnostic",
298
+ "title": "Controls reporting of deprecated type comment usage",
299
+ "default": "none"
300
+ },
284
301
  "reportPrivateImportUsage": {
285
302
  "$id": "#/properties/reportPrivateImportUsage",
286
303
  "$ref": "#/definitions/diagnostic",