coc-pyright 1.1.177 → 1.1.189

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 (2) hide show
  1. package/lib/index.js +17 -13
  2. package/package.json +9 -9
package/lib/index.js CHANGED
@@ -21206,7 +21206,6 @@ var SystemVariables = class extends AbstractSystemVariables {
21206
21206
  // src/configSettings.ts
21207
21207
  var _PythonSettings = class {
21208
21208
  constructor() {
21209
- this.isWindows = process.platform === "win32";
21210
21209
  this.disposables = [];
21211
21210
  this._pythonPath = "";
21212
21211
  this.workspaceRoot = import_coc2.workspace.root ? import_coc2.workspace.root : __dirname;
@@ -21231,6 +21230,9 @@ var _PythonSettings = class {
21231
21230
  this.disposables = [];
21232
21231
  }
21233
21232
  resolvePythonFromVENV() {
21233
+ function pythonBinFromPath(p) {
21234
+ return process.platform === "win32" ? import_path.default.join(p, "Scripts", "python.exe") : import_path.default.join(p, "bin", "python");
21235
+ }
21234
21236
  try {
21235
21237
  let p = import_path.default.join(this.workspaceRoot, ".python-version");
21236
21238
  if (import_fs_extra.default.existsSync(p)) {
@@ -21255,20 +21257,20 @@ var _PythonSettings = class {
21255
21257
  info = item;
21256
21258
  }
21257
21259
  if (info) {
21258
- if (this.isWindows) {
21259
- return import_path.default.join(info, "Scripts", "python.exe");
21260
- }
21261
- return import_path.default.join(info, "bin", "python");
21260
+ return pythonBinFromPath(info);
21262
21261
  }
21263
21262
  }
21263
+ if (process.env.VIRTUAL_ENV && import_fs_extra.default.existsSync(import_path.default.join(process.env.VIRTUAL_ENV, "pyvenv.cfg"))) {
21264
+ return pythonBinFromPath(process.env.VIRTUAL_ENV);
21265
+ }
21266
+ if (process.env.CONDA_PREFIX) {
21267
+ return pythonBinFromPath(process.env.CONDA_PREFIX);
21268
+ }
21264
21269
  const files = import_fs_extra.default.readdirSync(this.workspaceRoot);
21265
21270
  for (const file of files) {
21266
- const p2 = import_path.default.join(this.workspaceRoot, file);
21267
- if (import_fs_extra.default.existsSync(import_path.default.join(p2, "pyvenv.cfg"))) {
21268
- if (this.isWindows) {
21269
- return import_path.default.join(p2, "Scripts", "python.exe");
21270
- }
21271
- return import_path.default.join(p2, "bin", "python");
21271
+ const x = import_path.default.join(this.workspaceRoot, file);
21272
+ if (import_fs_extra.default.existsSync(import_path.default.join(x, "pyvenv.cfg"))) {
21273
+ return pythonBinFromPath(x);
21272
21274
  }
21273
21275
  }
21274
21276
  } catch (e) {
@@ -23337,9 +23339,11 @@ async function provideCompletionItem(document, position, context, token, next) {
23337
23339
  const result = await next(document, position, context, token);
23338
23340
  if (!result)
23339
23341
  return;
23342
+ const items = Array.isArray(result) ? result : result.items;
23343
+ items.map((x) => delete x.sortText);
23344
+ items.sort((a, b) => a.kind && b.kind ? a.kind - b.kind : 0);
23340
23345
  const snippetSupport = import_coc24.workspace.getConfiguration("pyright").get("completion.snippetSupport");
23341
23346
  if (snippetSupport) {
23342
- const items = Array.isArray(result) ? result : result.items;
23343
23347
  for (const item of items) {
23344
23348
  if ((_a = item.data) == null ? void 0 : _a.funcParensDisabled)
23345
23349
  continue;
@@ -23349,7 +23353,7 @@ async function provideCompletionItem(document, position, context, token, next) {
23349
23353
  }
23350
23354
  }
23351
23355
  }
23352
- return result;
23356
+ return Array.isArray(result) ? items : { items, isIncomplete: result.isIncomplete };
23353
23357
  }
23354
23358
  async function resolveCompletionItem(item, token, next) {
23355
23359
  const result = await next(item, token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-pyright",
3
- "version": "1.1.177",
3
+ "version": "1.1.189",
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",
@@ -40,14 +40,14 @@
40
40
  "@types/md5": "^2.2.0",
41
41
  "@types/minimatch": "^3.0.3",
42
42
  "@types/node": "10.12.0",
43
- "@types/semver": "^7.3.6",
43
+ "@types/semver": "^7.3.9",
44
44
  "@types/which": "^2.0.0",
45
- "@typescript-eslint/eslint-plugin": "^4.30.0",
46
- "@typescript-eslint/parser": "^4.30.0",
47
- "coc.nvim": "^0.0.81-next.1",
45
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
46
+ "@typescript-eslint/parser": "^5.4.0",
47
+ "coc.nvim": "^0.0.81-next.7",
48
48
  "diff-match-patch": "^1.0.5",
49
- "esbuild": "^0.13.4",
50
- "eslint": "^7.26.0",
49
+ "esbuild": "^0.13.15",
50
+ "eslint": "^8.3.0",
51
51
  "fs-extra": "^10.0.0",
52
52
  "iconv-lite": "^0.6.2",
53
53
  "md5": "^2.3.0",
@@ -57,7 +57,7 @@
57
57
  "rxjs-compat": "^6.6.7",
58
58
  "semver": "^7.3.2",
59
59
  "tree-kill": "^1.2.2",
60
- "typescript": "^4.0.2",
60
+ "typescript": "^4.5.2",
61
61
  "untildify": "^4.0.0",
62
62
  "which": "^2.0.2"
63
63
  },
@@ -1342,6 +1342,6 @@
1342
1342
  ]
1343
1343
  },
1344
1344
  "dependencies": {
1345
- "pyright": "^1.1.177"
1345
+ "pyright": "^1.1.189"
1346
1346
  }
1347
1347
  }