coc-pyright 1.1.250 → 1.1.253

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 +1 -0
  2. package/lib/index.js +100 -78
  3. package/package.json +7 -2
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
@@ -20241,11 +20241,15 @@ var require_minimatch = __commonJS({
20241
20241
  "node_modules/minimatch/minimatch.js"(exports, module2) {
20242
20242
  module2.exports = minimatch;
20243
20243
  minimatch.Minimatch = Minimatch2;
20244
- var path10 = { sep: "/" };
20245
- try {
20246
- path10 = require("path");
20247
- } catch (er) {
20248
- }
20244
+ var path10 = function() {
20245
+ try {
20246
+ return require("path");
20247
+ } catch (e) {
20248
+ }
20249
+ }() || {
20250
+ sep: "/"
20251
+ };
20252
+ minimatch.sep = path10.sep;
20249
20253
  var GLOBSTAR = minimatch.GLOBSTAR = Minimatch2.GLOBSTAR = {};
20250
20254
  var expand = require_brace_expansion();
20251
20255
  var plTypes = {
@@ -20275,58 +20279,68 @@ var require_minimatch = __commonJS({
20275
20279
  };
20276
20280
  }
20277
20281
  function ext(a, b) {
20278
- a = a || {};
20279
20282
  b = b || {};
20280
20283
  var t = {};
20281
- Object.keys(b).forEach(function(k) {
20282
- t[k] = b[k];
20283
- });
20284
20284
  Object.keys(a).forEach(function(k) {
20285
20285
  t[k] = a[k];
20286
20286
  });
20287
+ Object.keys(b).forEach(function(k) {
20288
+ t[k] = b[k];
20289
+ });
20287
20290
  return t;
20288
20291
  }
20289
20292
  minimatch.defaults = function(def) {
20290
- if (!def || !Object.keys(def).length)
20293
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
20291
20294
  return minimatch;
20295
+ }
20292
20296
  var orig = minimatch;
20293
20297
  var m = function minimatch2(p, pattern, options) {
20294
- return orig.minimatch(p, pattern, ext(def, options));
20298
+ return orig(p, pattern, ext(def, options));
20295
20299
  };
20296
20300
  m.Minimatch = function Minimatch3(pattern, options) {
20297
20301
  return new orig.Minimatch(pattern, ext(def, options));
20298
20302
  };
20303
+ m.Minimatch.defaults = function defaults(options) {
20304
+ return orig.defaults(ext(def, options)).Minimatch;
20305
+ };
20306
+ m.filter = function filter2(pattern, options) {
20307
+ return orig.filter(pattern, ext(def, options));
20308
+ };
20309
+ m.defaults = function defaults(options) {
20310
+ return orig.defaults(ext(def, options));
20311
+ };
20312
+ m.makeRe = function makeRe2(pattern, options) {
20313
+ return orig.makeRe(pattern, ext(def, options));
20314
+ };
20315
+ m.braceExpand = function braceExpand2(pattern, options) {
20316
+ return orig.braceExpand(pattern, ext(def, options));
20317
+ };
20318
+ m.match = function(list, pattern, options) {
20319
+ return orig.match(list, pattern, ext(def, options));
20320
+ };
20299
20321
  return m;
20300
20322
  };
20301
20323
  Minimatch2.defaults = function(def) {
20302
- if (!def || !Object.keys(def).length)
20303
- return Minimatch2;
20304
20324
  return minimatch.defaults(def).Minimatch;
20305
20325
  };
20306
20326
  function minimatch(p, pattern, options) {
20307
- if (typeof pattern !== "string") {
20308
- throw new TypeError("glob pattern string required");
20309
- }
20327
+ assertValidPattern(pattern);
20310
20328
  if (!options)
20311
20329
  options = {};
20312
20330
  if (!options.nocomment && pattern.charAt(0) === "#") {
20313
20331
  return false;
20314
20332
  }
20315
- if (pattern.trim() === "")
20316
- return p === "";
20317
20333
  return new Minimatch2(pattern, options).match(p);
20318
20334
  }
20319
20335
  function Minimatch2(pattern, options) {
20320
20336
  if (!(this instanceof Minimatch2)) {
20321
20337
  return new Minimatch2(pattern, options);
20322
20338
  }
20323
- if (typeof pattern !== "string") {
20324
- throw new TypeError("glob pattern string required");
20325
- }
20339
+ assertValidPattern(pattern);
20326
20340
  if (!options)
20327
20341
  options = {};
20328
20342
  pattern = pattern.trim();
20329
- if (path10.sep !== "/") {
20343
+ if (!options.allowWindowsEscape && path10.sep !== "/") {
20330
20344
  pattern = pattern.split(path10.sep).join("/");
20331
20345
  }
20332
20346
  this.options = options;
@@ -20336,14 +20350,13 @@ var require_minimatch = __commonJS({
20336
20350
  this.negate = false;
20337
20351
  this.comment = false;
20338
20352
  this.empty = false;
20353
+ this.partial = !!options.partial;
20339
20354
  this.make();
20340
20355
  }
20341
20356
  Minimatch2.prototype.debug = function() {
20342
20357
  };
20343
20358
  Minimatch2.prototype.make = make;
20344
20359
  function make() {
20345
- if (this._made)
20346
- return;
20347
20360
  var pattern = this.pattern;
20348
20361
  var options = this.options;
20349
20362
  if (!options.nocomment && pattern.charAt(0) === "#") {
@@ -20357,7 +20370,9 @@ var require_minimatch = __commonJS({
20357
20370
  this.parseNegate();
20358
20371
  var set = this.globSet = this.braceExpand();
20359
20372
  if (options.debug)
20360
- this.debug = console.error;
20373
+ this.debug = function debug() {
20374
+ console.error.apply(console, arguments);
20375
+ };
20361
20376
  this.debug(this.pattern, set);
20362
20377
  set = this.globParts = set.map(function(s) {
20363
20378
  return s.split(slashSplit);
@@ -20402,23 +20417,32 @@ var require_minimatch = __commonJS({
20402
20417
  }
20403
20418
  }
20404
20419
  pattern = typeof pattern === "undefined" ? this.pattern : pattern;
20405
- if (typeof pattern === "undefined") {
20406
- throw new TypeError("undefined pattern");
20407
- }
20408
- if (options.nobrace || !pattern.match(/\{.*\}/)) {
20420
+ assertValidPattern(pattern);
20421
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
20409
20422
  return [pattern];
20410
20423
  }
20411
20424
  return expand(pattern);
20412
20425
  }
20426
+ var MAX_PATTERN_LENGTH = 1024 * 64;
20427
+ var assertValidPattern = function(pattern) {
20428
+ if (typeof pattern !== "string") {
20429
+ throw new TypeError("invalid pattern");
20430
+ }
20431
+ if (pattern.length > MAX_PATTERN_LENGTH) {
20432
+ throw new TypeError("pattern is too long");
20433
+ }
20434
+ };
20413
20435
  Minimatch2.prototype.parse = parse;
20414
20436
  var SUBPARSE = {};
20415
20437
  function parse(pattern, isSub) {
20416
- if (pattern.length > 1024 * 64) {
20417
- throw new TypeError("pattern is too long");
20418
- }
20438
+ assertValidPattern(pattern);
20419
20439
  var options = this.options;
20420
- if (!options.noglobstar && pattern === "**")
20421
- return GLOBSTAR;
20440
+ if (pattern === "**") {
20441
+ if (!options.noglobstar)
20442
+ return GLOBSTAR;
20443
+ else
20444
+ pattern = "*";
20445
+ }
20422
20446
  if (pattern === "")
20423
20447
  return "";
20424
20448
  var re = "";
@@ -20459,8 +20483,9 @@ var require_minimatch = __commonJS({
20459
20483
  continue;
20460
20484
  }
20461
20485
  switch (c) {
20462
- case "/":
20486
+ case "/": {
20463
20487
  return false;
20488
+ }
20464
20489
  case "\\":
20465
20490
  clearStateChar();
20466
20491
  escaping = true;
@@ -20544,17 +20569,15 @@ var require_minimatch = __commonJS({
20544
20569
  escaping = false;
20545
20570
  continue;
20546
20571
  }
20547
- if (inClass) {
20548
- var cs = pattern.substring(classStart + 1, i);
20549
- try {
20550
- RegExp("[" + cs + "]");
20551
- } catch (er) {
20552
- var sp = this.parse(cs, SUBPARSE);
20553
- re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
20554
- hasMagic = hasMagic || sp[1];
20555
- inClass = false;
20556
- continue;
20557
- }
20572
+ var cs = pattern.substring(classStart + 1, i);
20573
+ try {
20574
+ RegExp("[" + cs + "]");
20575
+ } catch (er) {
20576
+ var sp = this.parse(cs, SUBPARSE);
20577
+ re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
20578
+ hasMagic = hasMagic || sp[1];
20579
+ inClass = false;
20580
+ continue;
20558
20581
  }
20559
20582
  hasMagic = true;
20560
20583
  inClass = false;
@@ -20596,8 +20619,8 @@ var require_minimatch = __commonJS({
20596
20619
  }
20597
20620
  var addPatternStart = false;
20598
20621
  switch (re.charAt(0)) {
20599
- case ".":
20600
20622
  case "[":
20623
+ case ".":
20601
20624
  case "(":
20602
20625
  addPatternStart = true;
20603
20626
  }
@@ -20684,8 +20707,9 @@ var require_minimatch = __commonJS({
20684
20707
  }
20685
20708
  return list;
20686
20709
  };
20687
- Minimatch2.prototype.match = match;
20688
- function match(f, partial) {
20710
+ Minimatch2.prototype.match = function match(f, partial) {
20711
+ if (typeof partial === "undefined")
20712
+ partial = this.partial;
20689
20713
  this.debug("match", f, this.pattern);
20690
20714
  if (this.comment)
20691
20715
  return false;
@@ -20724,7 +20748,7 @@ var require_minimatch = __commonJS({
20724
20748
  if (options.flipNegate)
20725
20749
  return false;
20726
20750
  return this.negate;
20727
- }
20751
+ };
20728
20752
  Minimatch2.prototype.matchOne = function(file, pattern, partial) {
20729
20753
  var options = this.options;
20730
20754
  this.debug("matchOne", { "this": this, file, pattern });
@@ -20772,11 +20796,7 @@ var require_minimatch = __commonJS({
20772
20796
  }
20773
20797
  var hit;
20774
20798
  if (typeof p === "string") {
20775
- if (options.nocase) {
20776
- hit = f.toLowerCase() === p.toLowerCase();
20777
- } else {
20778
- hit = f === p;
20779
- }
20799
+ hit = f === p;
20780
20800
  this.debug("string match", p, f, hit);
20781
20801
  } else {
20782
20802
  hit = f.match(p);
@@ -20790,8 +20810,7 @@ var require_minimatch = __commonJS({
20790
20810
  } else if (fi === fl) {
20791
20811
  return partial;
20792
20812
  } else if (pi === pl) {
20793
- var emptyFileEnd = fi === fl - 1 && file[fi] === "";
20794
- return emptyFileEnd;
20813
+ return fi === fl - 1 && file[fi] === "";
20795
20814
  }
20796
20815
  throw new Error("wtf?");
20797
20816
  };
@@ -21927,7 +21946,7 @@ var BaseFormatter = class {
21927
21946
  }
21928
21947
  const edits = getTextEditsFromPatch(document.getText(), data);
21929
21948
  if (edits.length)
21930
- import_coc4.window.showMessage(`Formatted with ${this.Id}`);
21949
+ import_coc4.window.showInformationMessage(`Formatted with ${this.Id}`);
21931
21950
  return edits;
21932
21951
  }).catch((error) => {
21933
21952
  this.handleError(this.Id, error).catch(() => {
@@ -21949,7 +21968,7 @@ var BaseFormatter = class {
21949
21968
  if (isNotInstalledError(error)) {
21950
21969
  customError = `${customError}: ${this.Id} module is not installed.`;
21951
21970
  }
21952
- import_coc4.window.showMessage(customError, "warning");
21971
+ import_coc4.window.showWarningMessage(customError);
21953
21972
  }
21954
21973
  createTempFile(document) {
21955
21974
  return getTempFileWithDocumentContents(document);
@@ -22005,7 +22024,7 @@ var BlackFormatter = class extends BaseFormatter {
22005
22024
  if (formatSelection) {
22006
22025
  const errorMessage = async () => {
22007
22026
  this.outputChannel.appendLine('Black does not support the "Format Selection" command');
22008
- import_coc5.window.showMessage('Black does not support the "Format Selection" command', "error");
22027
+ import_coc5.window.showErrorMessage('Black does not support the "Format Selection" command');
22009
22028
  return [];
22010
22029
  };
22011
22030
  return errorMessage();
@@ -22268,16 +22287,16 @@ var PythonFormattingEditProvider = class {
22268
22287
  }
22269
22288
  async _provideEdits(document, options, token, range) {
22270
22289
  const provider = this.pythonSettings.formatting.provider;
22271
- const formater = this.formatters.get(provider);
22272
- if (!formater) {
22273
- import_coc8.window.showMessage(`No formatter is set. You need to set "python.formatting.provider" in your coc-settings.json`);
22290
+ const formatter = this.formatters.get(provider);
22291
+ if (!formatter) {
22292
+ import_coc8.window.showWarningMessage(`No formatter is set. You need to set "python.formatting.provider" in your coc-settings.json`);
22274
22293
  this.outputChannel.appendLine(`${"#".repeat(10)} Error: python.formatting.provider is ${provider}, which is not supported`);
22275
22294
  return [];
22276
22295
  }
22277
22296
  this.outputChannel.appendLine(`Using python from ${this.pythonSettings.pythonPath}
22278
22297
  `);
22279
- this.outputChannel.appendLine(`${"#".repeat(10)} active formattor: ${formater.Id}`);
22280
- return await formater.formatDocument(document, options, token, range);
22298
+ this.outputChannel.appendLine(`${"#".repeat(10)} active formattor: ${formatter.Id}`);
22299
+ return await formatter.formatDocument(document, options, token, range);
22281
22300
  }
22282
22301
  provideDocumentFormattingEdits(document, options, token) {
22283
22302
  return this._provideEdits(document, options, token);
@@ -22344,7 +22363,7 @@ async function sortImports(extensionRoot, outputChannel) {
22344
22363
  outputChannel.appendLine(`${"#".repeat(10)} isort Output ${"#".repeat(10)}`);
22345
22364
  outputChannel.appendLine(`Error from isort:
22346
22365
  ${message}`);
22347
- import_coc9.window.showMessage(`Failed to format import by isort`, "error");
22366
+ import_coc9.window.showErrorMessage(`Failed to format import by isort`);
22348
22367
  }
22349
22368
  }
22350
22369
 
@@ -23266,7 +23285,7 @@ async function checkDocument(doc) {
23266
23285
  return false;
23267
23286
  const modified = await doc.buffer.getOption("modified");
23268
23287
  if (modified != 0) {
23269
- import_coc23.window.showMessage("Buffer not saved, please save the buffer first!", "warning");
23288
+ import_coc23.window.showWarningMessage("Buffer not saved, please save the buffer first!");
23270
23289
  return false;
23271
23290
  }
23272
23291
  return true;
@@ -23289,7 +23308,7 @@ async function extractVariable(root, document, range, outputChannel) {
23289
23308
  const pythonToolsExecutionService = new PythonExecutionService();
23290
23309
  const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
23291
23310
  if (!rope) {
23292
- import_coc23.window.showMessage(`Module rope not installed`, "warning");
23311
+ import_coc23.window.showWarningMessage(`Module rope not installed`);
23293
23312
  return;
23294
23313
  }
23295
23314
  const workspaceFolder = import_coc23.workspace.getWorkspaceFolder(doc.uri);
@@ -23312,7 +23331,7 @@ async function extractMethod(root, document, range, outputChannel) {
23312
23331
  const pythonToolsExecutionService = new PythonExecutionService();
23313
23332
  const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
23314
23333
  if (!rope) {
23315
- import_coc23.window.showMessage(`Module rope not installed`, "warning");
23334
+ import_coc23.window.showWarningMessage(`Module rope not installed`);
23316
23335
  return;
23317
23336
  }
23318
23337
  const workspaceFolder = import_coc23.workspace.getWorkspaceFolder(doc.uri);
@@ -23335,7 +23354,7 @@ async function addImport(root, document, name, parent, outputChannel) {
23335
23354
  const pythonToolsExecutionService = new PythonExecutionService();
23336
23355
  const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
23337
23356
  if (!rope) {
23338
- import_coc23.window.showMessage(`Module rope not installed`, "warning");
23357
+ import_coc23.window.showWarningMessage(`Module rope not installed`);
23339
23358
  return;
23340
23359
  }
23341
23360
  let parentModule = "";
@@ -23371,7 +23390,7 @@ async function applyImports(doc, resp, outputChannel) {
23371
23390
  outputChannel.appendLine(`Error in add import:
23372
23391
  ${errorMessage}`);
23373
23392
  outputChannel.appendLine("");
23374
- import_coc23.window.showMessage(`Cannot perform addImport using selected element(s).`, "error");
23393
+ import_coc23.window.showErrorMessage(`Cannot perform addImport using selected element(s).`);
23375
23394
  return await Promise.reject(error);
23376
23395
  }
23377
23396
  }
@@ -23421,7 +23440,7 @@ async function extractName(textEditor, newName, renameResponse, outputChannel) {
23421
23440
  outputChannel.appendLine(`Error in refactoring:
23422
23441
  ${errorMessage}`);
23423
23442
  outputChannel.appendLine("");
23424
- import_coc23.window.showMessage(`Cannot perform refactoring using selected element(s).`, "error");
23443
+ import_coc23.window.showErrorMessage(`Cannot perform refactoring using selected element(s).`);
23425
23444
  return await Promise.reject(error);
23426
23445
  }
23427
23446
  }
@@ -23546,11 +23565,11 @@ async function activate(context) {
23546
23565
  return;
23547
23566
  const state = import_coc24.extensions.getExtensionState("coc-python");
23548
23567
  if (state.toString() === "activated") {
23549
- import_coc24.window.showMessage(`coc-python is installed and activated, coc-pyright will be disabled`, "warning");
23568
+ import_coc24.window.showWarningMessage(`coc-python is installed and activated, coc-pyright will be disabled`);
23550
23569
  return;
23551
23570
  }
23552
23571
  if ((0, import_semver2.lt)(process.versions.node, "12.0.0")) {
23553
- import_coc24.window.showMessage(`Pyright needs Node.js v12+ to work, your Node.js is ${process.version}.`, "error");
23572
+ import_coc24.window.showErrorMessage(`Pyright needs Node.js v12+ to work, your Node.js is ${process.version}.`);
23554
23573
  return;
23555
23574
  }
23556
23575
  let module2 = pyrightCfg.get("server");
@@ -23560,7 +23579,7 @@ async function activate(context) {
23560
23579
  module2 = (0, import_path5.join)(context.extensionPath, "node_modules", "pyright", "langserver.index.js");
23561
23580
  }
23562
23581
  if (!(0, import_fs.existsSync)(module2)) {
23563
- import_coc24.window.showMessage(`Pyright langserver doesn't exist, please reinstall coc-pyright`, "error");
23582
+ import_coc24.window.showErrorMessage(`Pyright langserver doesn't exist, please reinstall coc-pyright`);
23564
23583
  return;
23565
23584
  }
23566
23585
  const runOptions = { execArgv: [`--max-old-space-size=${defaultHeapSize}`] };
@@ -23576,6 +23595,9 @@ async function activate(context) {
23576
23595
  if (pyrightCfg.get("disableDiagnostics")) {
23577
23596
  disabledFeatures.push("diagnostics");
23578
23597
  }
23598
+ const disableProgress = pyrightCfg.get("disableProgressNotifications");
23599
+ if (disableProgress)
23600
+ disabledFeatures.push("progress");
23579
23601
  const outputChannel = import_coc24.window.createOutputChannel("Pyright");
23580
23602
  const pythonSettings = PythonSettings.getInstance();
23581
23603
  outputChannel.appendLine(`Workspace: ${import_coc24.workspace.root}`);
@@ -23588,7 +23610,7 @@ async function activate(context) {
23588
23610
  },
23589
23611
  outputChannel,
23590
23612
  disabledFeatures,
23591
- progressOnInitialization: true,
23613
+ progressOnInitialization: !disableProgress,
23592
23614
  middleware: {
23593
23615
  workspace: {
23594
23616
  configuration
@@ -23632,7 +23654,7 @@ async function activate(context) {
23632
23654
  command = "pyright.createtypestub";
23633
23655
  disposable = import_coc24.commands.registerCommand(command, async (...args) => {
23634
23656
  if (!args.length) {
23635
- import_coc24.window.showMessage(`Module name is missing`, "warning");
23657
+ import_coc24.window.showWarningMessage(`Module name is missing`);
23636
23658
  return;
23637
23659
  }
23638
23660
  const doc = await import_coc24.workspace.document;
@@ -23673,7 +23695,7 @@ async function activate(context) {
23673
23695
  const pyrightPackage = JSON.parse((0, import_fs.readFileSync)(pyrightJSON, "utf8"));
23674
23696
  const cocPyrightJSON = (0, import_path5.join)(context.extensionPath, "package.json");
23675
23697
  const cocPyrightPackage = JSON.parse((0, import_fs.readFileSync)(cocPyrightJSON, "utf8"));
23676
- import_coc24.window.showMessage(`coc-pyright ${cocPyrightPackage.version} with Pyright ${pyrightPackage.version}`);
23698
+ import_coc24.window.showInformationMessage(`coc-pyright ${cocPyrightPackage.version} with Pyright ${pyrightPackage.version}`);
23677
23699
  });
23678
23700
  context.subscriptions.push(disposable);
23679
23701
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-pyright",
3
- "version": "1.1.250",
3
+ "version": "1.1.253",
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",
@@ -1327,6 +1327,11 @@
1327
1327
  "default": false,
1328
1328
  "description": "Disable diagnostics from Pyright"
1329
1329
  },
1330
+ "pyright.disableProgressNotifications": {
1331
+ "type": "boolean",
1332
+ "default": false,
1333
+ "description": "Disable the initialization and workdone progress notifications"
1334
+ },
1330
1335
  "pyright.completion.importSupport": {
1331
1336
  "type": "boolean",
1332
1337
  "default": true,
@@ -1403,6 +1408,6 @@
1403
1408
  ]
1404
1409
  },
1405
1410
  "dependencies": {
1406
- "pyright": "^1.1.250"
1411
+ "pyright": "^1.1.253"
1407
1412
  }
1408
1413
  }