coc-pyright 1.1.181 → 1.1.191
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 +1 -0
- package/lib/index.js +47 -23
- package/package.json +15 -10
- package/schemas/pyrightconfig.schema.json +1 -1
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.completion.importSupport | Enable `python-import` completion source support | true |
|
|
70
71
|
| pyright.completion.snippetSupport | Enable completion snippets support | true |
|
|
71
72
|
| pyright.organizeimports.provider | Organize imports provider, `pyright` or `isort` | pyright |
|
|
72
73
|
|
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
|
-
|
|
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
|
|
21267
|
-
if (import_fs_extra.default.existsSync(import_path.default.join(
|
|
21268
|
-
|
|
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) {
|
|
@@ -22062,7 +22064,11 @@ var BlackdFormatter = class extends BaseFormatter {
|
|
|
22062
22064
|
import_coc7.window.showErrorMessage("blackd request error");
|
|
22063
22065
|
this.outputChannel.appendLine("");
|
|
22064
22066
|
this.outputChannel.appendLine(`${"#".repeat(10)} blackd request error:`);
|
|
22065
|
-
|
|
22067
|
+
if (typeof e === "string") {
|
|
22068
|
+
this.outputChannel.appendLine(e);
|
|
22069
|
+
} else if (e instanceof Error) {
|
|
22070
|
+
this.outputChannel.appendLine(e.message);
|
|
22071
|
+
}
|
|
22066
22072
|
return [];
|
|
22067
22073
|
}
|
|
22068
22074
|
}
|
|
@@ -22178,7 +22184,12 @@ async function sortImports(extensionRoot, outputChannel) {
|
|
|
22178
22184
|
const edits = getTextEditsFromPatch(doc.getDocumentContent(), patch);
|
|
22179
22185
|
await doc.applyEdits(edits);
|
|
22180
22186
|
} catch (err) {
|
|
22181
|
-
|
|
22187
|
+
let message = "";
|
|
22188
|
+
if (typeof err === "string") {
|
|
22189
|
+
message = err;
|
|
22190
|
+
} else if (err instanceof Error) {
|
|
22191
|
+
message = err.message;
|
|
22192
|
+
}
|
|
22182
22193
|
outputChannel.appendLine(`${"#".repeat(10)} isort Output ${"#".repeat(10)}`);
|
|
22183
22194
|
outputChannel.appendLine(`Error from isort:
|
|
22184
22195
|
${message}`);
|
|
@@ -22326,7 +22337,9 @@ var BaseLinter = class {
|
|
|
22326
22337
|
return await this.parseMessages(result.stdout, document, cancellation, regEx);
|
|
22327
22338
|
} catch (error) {
|
|
22328
22339
|
this.outputChannel.appendLine(`Linting with ${this.info.id} failed:`);
|
|
22329
|
-
|
|
22340
|
+
if (error instanceof Error) {
|
|
22341
|
+
this.outputChannel.appendLine(error.message.toString());
|
|
22342
|
+
}
|
|
22330
22343
|
return [];
|
|
22331
22344
|
}
|
|
22332
22345
|
}
|
|
@@ -22342,10 +22355,14 @@ var BaseLinter = class {
|
|
|
22342
22355
|
break;
|
|
22343
22356
|
}
|
|
22344
22357
|
}
|
|
22345
|
-
} catch (
|
|
22358
|
+
} catch (err) {
|
|
22346
22359
|
this.outputChannel.appendLine(`${"#".repeat(10)} Linter ${this.info.id} failed to parse the line:`);
|
|
22347
22360
|
this.outputChannel.appendLine(line);
|
|
22348
|
-
|
|
22361
|
+
if (typeof err === "string") {
|
|
22362
|
+
this.outputChannel.appendLine(err);
|
|
22363
|
+
} else if (err instanceof Error) {
|
|
22364
|
+
this.outputChannel.appendLine(err.message);
|
|
22365
|
+
}
|
|
22349
22366
|
}
|
|
22350
22367
|
}
|
|
22351
22368
|
return messages;
|
|
@@ -22559,9 +22576,13 @@ var PyDocStyle = class extends BaseLinter {
|
|
|
22559
22576
|
type: "",
|
|
22560
22577
|
provider: this.info.id
|
|
22561
22578
|
};
|
|
22562
|
-
} catch (
|
|
22579
|
+
} catch (err) {
|
|
22563
22580
|
this.outputChannel.appendLine(`Failed to parse pydocstyle line '${line}'`);
|
|
22564
|
-
|
|
22581
|
+
if (typeof err === "string") {
|
|
22582
|
+
this.outputChannel.appendLine(err);
|
|
22583
|
+
} else if (err instanceof Error) {
|
|
22584
|
+
this.outputChannel.appendLine(err.message);
|
|
22585
|
+
}
|
|
22565
22586
|
return;
|
|
22566
22587
|
}
|
|
22567
22588
|
}).filter((item) => item !== void 0).map((item) => item);
|
|
@@ -23195,7 +23216,7 @@ async function applyImports(doc, resp, outputChannel) {
|
|
|
23195
23216
|
if (typeof error === "string") {
|
|
23196
23217
|
errorMessage = error;
|
|
23197
23218
|
}
|
|
23198
|
-
if (
|
|
23219
|
+
if (error instanceof Error) {
|
|
23199
23220
|
errorMessage = error.message;
|
|
23200
23221
|
}
|
|
23201
23222
|
outputChannel.appendLine(`${"#".repeat(10)}Rope Output${"#".repeat(10)}`);
|
|
@@ -23245,7 +23266,7 @@ async function extractName(textEditor, newName, renameResponse, outputChannel) {
|
|
|
23245
23266
|
if (typeof error === "string") {
|
|
23246
23267
|
errorMessage = error;
|
|
23247
23268
|
}
|
|
23248
|
-
if (
|
|
23269
|
+
if (error instanceof Error) {
|
|
23249
23270
|
errorMessage = error.message;
|
|
23250
23271
|
}
|
|
23251
23272
|
outputChannel.appendLine(`${"#".repeat(10)}Refactor Output${"#".repeat(10)}`);
|
|
@@ -23433,8 +23454,11 @@ async function activate(context) {
|
|
|
23433
23454
|
context.subscriptions.push(new LinterProvider(context));
|
|
23434
23455
|
const codeActionProvider = new PythonCodeActionProvider();
|
|
23435
23456
|
context.subscriptions.push(import_coc24.languages.registerCodeActionProvider(documentSelector, codeActionProvider, "Pyright"));
|
|
23436
|
-
const
|
|
23437
|
-
|
|
23457
|
+
const importSupport = pyrightCfg.get("completion.importSupport");
|
|
23458
|
+
if (importSupport) {
|
|
23459
|
+
const provider = new ImportCompletionProvider();
|
|
23460
|
+
context.subscriptions.push(import_coc24.languages.registerCompletionItemProvider("python-import", "PY", ["python"], provider, [" "]));
|
|
23461
|
+
}
|
|
23438
23462
|
const textEditorCommands = ["pyright.organizeimports", "pyright.addoptionalforparam"];
|
|
23439
23463
|
textEditorCommands.forEach((commandName) => {
|
|
23440
23464
|
context.subscriptions.push(import_coc24.commands.registerCommand(commandName, async (offset) => {
|
|
@@ -23520,7 +23544,7 @@ var ImportCompletionProvider = class {
|
|
|
23520
23544
|
return [];
|
|
23521
23545
|
const items = [];
|
|
23522
23546
|
for (const o of result.items) {
|
|
23523
|
-
items.push({ label: o.word, sortText: o.sortText });
|
|
23547
|
+
items.push({ label: o.word, sortText: o.sortText, kind: import_coc24.CompletionItemKind.Module, filterText: o.filterText });
|
|
23524
23548
|
}
|
|
23525
23549
|
return items;
|
|
23526
23550
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-pyright",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.191",
|
|
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",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"@types/fs-extra": "^9.0.2",
|
|
40
40
|
"@types/md5": "^2.2.0",
|
|
41
41
|
"@types/minimatch": "^3.0.3",
|
|
42
|
-
"@types/node": "
|
|
42
|
+
"@types/node": "12.12",
|
|
43
43
|
"@types/semver": "^7.3.9",
|
|
44
44
|
"@types/which": "^2.0.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
46
|
-
"@typescript-eslint/parser": "^5.
|
|
47
|
-
"coc.nvim": "^0.0.81-next.
|
|
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.
|
|
50
|
-
"eslint": "^8.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.
|
|
60
|
+
"typescript": "^4.5.2",
|
|
61
61
|
"untildify": "^4.0.0",
|
|
62
62
|
"which": "^2.0.2"
|
|
63
63
|
},
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"reportPropertyTypeMismatch": {
|
|
164
164
|
"type": "string",
|
|
165
165
|
"description": "Diagnostics for property whose setter and getter have mismatched types.",
|
|
166
|
-
"default": "
|
|
166
|
+
"default": "none",
|
|
167
167
|
"enum": [
|
|
168
168
|
"none",
|
|
169
169
|
"information",
|
|
@@ -1271,6 +1271,11 @@
|
|
|
1271
1271
|
"default": false,
|
|
1272
1272
|
"description": "Disable diagnostics from Pyright"
|
|
1273
1273
|
},
|
|
1274
|
+
"pyright.completion.importSupport": {
|
|
1275
|
+
"type": "boolean",
|
|
1276
|
+
"default": true,
|
|
1277
|
+
"description": "Enable `python-import` completion source, will list suggestions after input `import`"
|
|
1278
|
+
},
|
|
1274
1279
|
"pyright.completion.snippetSupport": {
|
|
1275
1280
|
"type": "boolean",
|
|
1276
1281
|
"default": true,
|
|
@@ -1342,6 +1347,6 @@
|
|
|
1342
1347
|
]
|
|
1343
1348
|
},
|
|
1344
1349
|
"dependencies": {
|
|
1345
|
-
"pyright": "^1.1.
|
|
1350
|
+
"pyright": "^1.1.191"
|
|
1346
1351
|
}
|
|
1347
1352
|
}
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"$id": "#/properties/reportPropertyTypeMismatch",
|
|
142
142
|
"$ref": "#/definitions/diagnostic",
|
|
143
143
|
"title": "Controls reporting of property getter/setter type mismatches",
|
|
144
|
-
"default": "
|
|
144
|
+
"default": "none"
|
|
145
145
|
},
|
|
146
146
|
"reportFunctionMemberAccess": {
|
|
147
147
|
"$id": "#/properties/reportFunctionMemberAccess",
|