coc-pyright 1.1.164 → 1.1.171
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 +6 -8
- package/lib/index.js +26 -13
- package/package.json +21 -5
- package/schemas/pyrightconfig.schema.json +6 -0
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# coc-pyright
|
|
2
2
|
|
|
3
|
+
<!-- markdownlint-disable no-inline-html -->
|
|
4
|
+
<a href="https://github.com/sponsors/fannheyward"><img src="https://user-images.githubusercontent.com/345274/133218454-014a4101-b36a-48c6-a1f6-342881974938.png" alt="GitHub Sponsors" /></a>
|
|
5
|
+
<a href="https://patreon.com/fannheyward"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /></a>
|
|
6
|
+
<a href="https://paypal.me/fannheyward"><img src="https://user-images.githubusercontent.com/345274/104303610-41149f00-5505-11eb-88b2-5a95c53187b4.png" alt="PayPal donate button" /></a>
|
|
7
|
+
|
|
3
8
|
[Pyright](https://github.com/microsoft/pyright) extension for coc.nvim
|
|
4
9
|
|
|
5
10
|
<!-- markdownlint-disable-next-line -->
|
|
@@ -59,6 +64,7 @@ These configurations are used by `coc-pyright`, you need to set them in your `co
|
|
|
59
64
|
| python.linting.pylintEnabled | Whether to lint with pylint | false |
|
|
60
65
|
| python.sortImports.path | Path to isort script, default using inner version | '' |
|
|
61
66
|
| python.sortImports.args | Arguments passed to isort | [] |
|
|
67
|
+
| pyright.server | Custom `pyright-langserver` path | '' |
|
|
62
68
|
| pyright.disableDiagnostics | Disable diagnostics from Pyright | false |
|
|
63
69
|
| pyright.completion.snippetSupport | Enable completion snippets support | true |
|
|
64
70
|
| pyright.organizeimports.provider | Organize imports provider, `pyright` or `isort` | pyright |
|
|
@@ -101,14 +107,6 @@ This way python from your currently activated environment will be used
|
|
|
101
107
|
3. install modules with pip and work with Pyright
|
|
102
108
|
4. `deactivate`
|
|
103
109
|
|
|
104
|
-
## Supporting
|
|
105
|
-
|
|
106
|
-
If this extension is helpful to you, please support me via Patreon or PayPal:
|
|
107
|
-
|
|
108
|
-
<!-- markdownlint-disable no-inline-html -->
|
|
109
|
-
<a href="https://patreon.com/fannheyward"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Patreon donate button" /></a>
|
|
110
|
-
<a href="https://paypal.me/fannheyward"><img src="https://user-images.githubusercontent.com/345274/104303610-41149f00-5505-11eb-88b2-5a95c53187b4.png" alt="PayPal donate button" /></a>
|
|
111
|
-
|
|
112
110
|
## License
|
|
113
111
|
|
|
114
112
|
MIT
|
package/lib/index.js
CHANGED
|
@@ -19,7 +19,10 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
21
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
-
var
|
|
22
|
+
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
23
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
24
|
+
};
|
|
25
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
23
26
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
27
|
};
|
|
25
28
|
var __export = (target, all) => {
|
|
@@ -21886,14 +21889,22 @@ var BaseFormatter = class {
|
|
|
21886
21889
|
this.outputChannel.appendLine(`moduleName: ${executionInfo.moduleName}`);
|
|
21887
21890
|
this.outputChannel.appendLine(`args: ${executionInfo.args}`);
|
|
21888
21891
|
const pythonToolsExecutionService = new PythonExecutionService();
|
|
21889
|
-
const promise = pythonToolsExecutionService.exec(executionInfo, { cwd, throwOnStdErr: false, token }).then((output) =>
|
|
21892
|
+
const promise = pythonToolsExecutionService.exec(executionInfo, { cwd, throwOnStdErr: false, token }).then((output) => {
|
|
21893
|
+
if (output.stderr) {
|
|
21894
|
+
throw new Error(output.stderr);
|
|
21895
|
+
}
|
|
21896
|
+
return output.stdout;
|
|
21897
|
+
}).then((data) => {
|
|
21890
21898
|
this.outputChannel.appendLine("");
|
|
21891
21899
|
this.outputChannel.appendLine(`${"#".repeat(10)} ${this.Id} output:`);
|
|
21892
21900
|
this.outputChannel.appendLine(data);
|
|
21893
21901
|
if (this.checkCancellation(filepath, tempFile, token)) {
|
|
21894
21902
|
return [];
|
|
21895
21903
|
}
|
|
21896
|
-
|
|
21904
|
+
const edits = getTextEditsFromPatch(document.getText(), data);
|
|
21905
|
+
if (edits.length)
|
|
21906
|
+
import_coc4.window.showMessage(`Formatted with ${this.Id}`);
|
|
21907
|
+
return edits;
|
|
21897
21908
|
}).catch((error) => {
|
|
21898
21909
|
if (this.checkCancellation(filepath, tempFile, token)) {
|
|
21899
21910
|
return [];
|
|
@@ -21901,12 +21912,7 @@ var BaseFormatter = class {
|
|
|
21901
21912
|
this.handleError(this.Id, error).catch(() => {
|
|
21902
21913
|
});
|
|
21903
21914
|
return [];
|
|
21904
|
-
})
|
|
21905
|
-
promise.then(() => {
|
|
21906
|
-
this.deleteTempFile(filepath, tempFile).catch(() => {
|
|
21907
|
-
});
|
|
21908
|
-
import_coc4.window.showMessage(`Formatted with ${this.Id}`);
|
|
21909
|
-
}, () => {
|
|
21915
|
+
}).finally(() => {
|
|
21910
21916
|
this.deleteTempFile(filepath, tempFile).catch(() => {
|
|
21911
21917
|
});
|
|
21912
21918
|
});
|
|
@@ -23427,6 +23433,9 @@ async function provideHover(document, position, token, next) {
|
|
|
23427
23433
|
}
|
|
23428
23434
|
return hover;
|
|
23429
23435
|
}
|
|
23436
|
+
async function handleDiagnostics(uri, diagnostics, next) {
|
|
23437
|
+
next(uri, diagnostics.filter((d) => d.message !== '"__" is not accessed'));
|
|
23438
|
+
}
|
|
23430
23439
|
async function activate(context) {
|
|
23431
23440
|
const pyrightCfg = import_coc24.workspace.getConfiguration("pyright");
|
|
23432
23441
|
const isEnable = pyrightCfg.get("enable", true);
|
|
@@ -23441,10 +23450,13 @@ async function activate(context) {
|
|
|
23441
23450
|
import_coc24.window.showMessage(`Pyright needs Node.js v12+ to work, your Node.js is ${process.version}.`, "error");
|
|
23442
23451
|
return;
|
|
23443
23452
|
}
|
|
23444
|
-
|
|
23445
|
-
if (!
|
|
23446
|
-
|
|
23447
|
-
|
|
23453
|
+
let module2 = pyrightCfg.get("server");
|
|
23454
|
+
if (!module2) {
|
|
23455
|
+
module2 = (0, import_path5.join)(context.extensionPath, "node_modules", "pyright", "langserver.index.js");
|
|
23456
|
+
if (!(0, import_fs.existsSync)(module2)) {
|
|
23457
|
+
import_coc24.window.showMessage(`Pyright file doesn't exist, please reinstall coc-pyright`, "error");
|
|
23458
|
+
return;
|
|
23459
|
+
}
|
|
23448
23460
|
}
|
|
23449
23461
|
const serverOptions = {
|
|
23450
23462
|
module: module2,
|
|
@@ -23469,6 +23481,7 @@ async function activate(context) {
|
|
|
23469
23481
|
configuration
|
|
23470
23482
|
},
|
|
23471
23483
|
provideHover,
|
|
23484
|
+
handleDiagnostics,
|
|
23472
23485
|
provideCompletionItem,
|
|
23473
23486
|
resolveCompletionItem
|
|
23474
23487
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-pyright",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.171",
|
|
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",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@types/node": "10.12.0",
|
|
43
43
|
"@types/semver": "^7.3.6",
|
|
44
44
|
"@types/which": "^2.0.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
46
|
-
"@typescript-eslint/parser": "^4.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
|
46
|
+
"@typescript-eslint/parser": "^4.30.0",
|
|
47
47
|
"coc.nvim": "^0.0.81-next.1",
|
|
48
48
|
"diff-match-patch": "^1.0.5",
|
|
49
|
-
"esbuild": "^0.12.
|
|
49
|
+
"esbuild": "^0.12.25",
|
|
50
50
|
"eslint": "^7.26.0",
|
|
51
51
|
"fs-extra": "^10.0.0",
|
|
52
52
|
"iconv-lite": "^0.6.2",
|
|
@@ -424,6 +424,17 @@
|
|
|
424
424
|
"error"
|
|
425
425
|
]
|
|
426
426
|
},
|
|
427
|
+
"reportPrivateImportUsage": {
|
|
428
|
+
"type": "string",
|
|
429
|
+
"description": "Diagnostics for incorrect usage of symbol imported from a \"py.typed\" module that is not re-exported from that module.",
|
|
430
|
+
"default": "error",
|
|
431
|
+
"enum": [
|
|
432
|
+
"none",
|
|
433
|
+
"information",
|
|
434
|
+
"warning",
|
|
435
|
+
"error"
|
|
436
|
+
]
|
|
437
|
+
},
|
|
427
438
|
"reportConstantRedefinition": {
|
|
428
439
|
"type": "string",
|
|
429
440
|
"description": "Diagnostics for attempts to redefine variables whose names are all-caps with underscores and numerals.",
|
|
@@ -1263,6 +1274,11 @@
|
|
|
1263
1274
|
"isort"
|
|
1264
1275
|
]
|
|
1265
1276
|
},
|
|
1277
|
+
"pyright.server": {
|
|
1278
|
+
"type": "string",
|
|
1279
|
+
"default": "",
|
|
1280
|
+
"description": "Custom pyright-langserver path"
|
|
1281
|
+
},
|
|
1266
1282
|
"pyright.trace.server": {
|
|
1267
1283
|
"type": "string",
|
|
1268
1284
|
"scope": "window",
|
|
@@ -1315,6 +1331,6 @@
|
|
|
1315
1331
|
]
|
|
1316
1332
|
},
|
|
1317
1333
|
"dependencies": {
|
|
1318
|
-
"pyright": "^1.1.
|
|
1334
|
+
"pyright": "^1.1.171"
|
|
1319
1335
|
}
|
|
1320
1336
|
}
|
|
@@ -281,6 +281,12 @@
|
|
|
281
281
|
"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
282
|
"default": "none"
|
|
283
283
|
},
|
|
284
|
+
"reportPrivateImportUsage": {
|
|
285
|
+
"$id": "#/properties/reportPrivateImportUsage",
|
|
286
|
+
"$ref": "#/definitions/diagnostic",
|
|
287
|
+
"title": "Controls reporting of improper usage of symbol imported from a \"py.typed\" module that is not re-exported from that module",
|
|
288
|
+
"default": "error"
|
|
289
|
+
},
|
|
284
290
|
"reportConstantRedefinition": {
|
|
285
291
|
"$id": "#/properties/reportConstantRedefinition",
|
|
286
292
|
"$ref": "#/definitions/diagnostic",
|