coc-pyright 1.1.251 → 1.1.255
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 +25 -22
- package/package.json +18 -2
- package/schemas/pyrightconfig.schema.json +17 -0
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
|
@@ -21292,7 +21292,7 @@ var _PythonSettings = class {
|
|
|
21292
21292
|
resolvePythonFromVENV() {
|
|
21293
21293
|
function pythonBinFromPath(p) {
|
|
21294
21294
|
const fullPath = process.platform === "win32" ? import_path.default.join(p, "Scripts", "python.exe") : import_path.default.join(p, "bin", "python");
|
|
21295
|
-
return import_fs_extra.default.existsSync(fullPath) ?
|
|
21295
|
+
return import_fs_extra.default.existsSync(fullPath) ? fullPath : void 0;
|
|
21296
21296
|
}
|
|
21297
21297
|
try {
|
|
21298
21298
|
if (process.env.VIRTUAL_ENV && import_fs_extra.default.existsSync(import_path.default.join(process.env.VIRTUAL_ENV, "pyvenv.cfg"))) {
|
|
@@ -21946,7 +21946,7 @@ var BaseFormatter = class {
|
|
|
21946
21946
|
}
|
|
21947
21947
|
const edits = getTextEditsFromPatch(document.getText(), data);
|
|
21948
21948
|
if (edits.length)
|
|
21949
|
-
import_coc4.window.
|
|
21949
|
+
import_coc4.window.showInformationMessage(`Formatted with ${this.Id}`);
|
|
21950
21950
|
return edits;
|
|
21951
21951
|
}).catch((error) => {
|
|
21952
21952
|
this.handleError(this.Id, error).catch(() => {
|
|
@@ -21968,7 +21968,7 @@ var BaseFormatter = class {
|
|
|
21968
21968
|
if (isNotInstalledError(error)) {
|
|
21969
21969
|
customError = `${customError}: ${this.Id} module is not installed.`;
|
|
21970
21970
|
}
|
|
21971
|
-
import_coc4.window.
|
|
21971
|
+
import_coc4.window.showWarningMessage(customError);
|
|
21972
21972
|
}
|
|
21973
21973
|
createTempFile(document) {
|
|
21974
21974
|
return getTempFileWithDocumentContents(document);
|
|
@@ -22024,7 +22024,7 @@ var BlackFormatter = class extends BaseFormatter {
|
|
|
22024
22024
|
if (formatSelection) {
|
|
22025
22025
|
const errorMessage = async () => {
|
|
22026
22026
|
this.outputChannel.appendLine('Black does not support the "Format Selection" command');
|
|
22027
|
-
import_coc5.window.
|
|
22027
|
+
import_coc5.window.showErrorMessage('Black does not support the "Format Selection" command');
|
|
22028
22028
|
return [];
|
|
22029
22029
|
};
|
|
22030
22030
|
return errorMessage();
|
|
@@ -22287,16 +22287,16 @@ var PythonFormattingEditProvider = class {
|
|
|
22287
22287
|
}
|
|
22288
22288
|
async _provideEdits(document, options, token, range) {
|
|
22289
22289
|
const provider = this.pythonSettings.formatting.provider;
|
|
22290
|
-
const
|
|
22291
|
-
if (!
|
|
22292
|
-
import_coc8.window.
|
|
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`);
|
|
22293
22293
|
this.outputChannel.appendLine(`${"#".repeat(10)} Error: python.formatting.provider is ${provider}, which is not supported`);
|
|
22294
22294
|
return [];
|
|
22295
22295
|
}
|
|
22296
22296
|
this.outputChannel.appendLine(`Using python from ${this.pythonSettings.pythonPath}
|
|
22297
22297
|
`);
|
|
22298
|
-
this.outputChannel.appendLine(`${"#".repeat(10)} active formattor: ${
|
|
22299
|
-
return await
|
|
22298
|
+
this.outputChannel.appendLine(`${"#".repeat(10)} active formattor: ${formatter.Id}`);
|
|
22299
|
+
return await formatter.formatDocument(document, options, token, range);
|
|
22300
22300
|
}
|
|
22301
22301
|
provideDocumentFormattingEdits(document, options, token) {
|
|
22302
22302
|
return this._provideEdits(document, options, token);
|
|
@@ -22363,7 +22363,7 @@ async function sortImports(extensionRoot, outputChannel) {
|
|
|
22363
22363
|
outputChannel.appendLine(`${"#".repeat(10)} isort Output ${"#".repeat(10)}`);
|
|
22364
22364
|
outputChannel.appendLine(`Error from isort:
|
|
22365
22365
|
${message}`);
|
|
22366
|
-
import_coc9.window.
|
|
22366
|
+
import_coc9.window.showErrorMessage(`Failed to format import by isort`);
|
|
22367
22367
|
}
|
|
22368
22368
|
}
|
|
22369
22369
|
|
|
@@ -23285,7 +23285,7 @@ async function checkDocument(doc) {
|
|
|
23285
23285
|
return false;
|
|
23286
23286
|
const modified = await doc.buffer.getOption("modified");
|
|
23287
23287
|
if (modified != 0) {
|
|
23288
|
-
import_coc23.window.
|
|
23288
|
+
import_coc23.window.showWarningMessage("Buffer not saved, please save the buffer first!");
|
|
23289
23289
|
return false;
|
|
23290
23290
|
}
|
|
23291
23291
|
return true;
|
|
@@ -23308,7 +23308,7 @@ async function extractVariable(root, document, range, outputChannel) {
|
|
|
23308
23308
|
const pythonToolsExecutionService = new PythonExecutionService();
|
|
23309
23309
|
const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
|
|
23310
23310
|
if (!rope) {
|
|
23311
|
-
import_coc23.window.
|
|
23311
|
+
import_coc23.window.showWarningMessage(`Module rope not installed`);
|
|
23312
23312
|
return;
|
|
23313
23313
|
}
|
|
23314
23314
|
const workspaceFolder = import_coc23.workspace.getWorkspaceFolder(doc.uri);
|
|
@@ -23331,7 +23331,7 @@ async function extractMethod(root, document, range, outputChannel) {
|
|
|
23331
23331
|
const pythonToolsExecutionService = new PythonExecutionService();
|
|
23332
23332
|
const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
|
|
23333
23333
|
if (!rope) {
|
|
23334
|
-
import_coc23.window.
|
|
23334
|
+
import_coc23.window.showWarningMessage(`Module rope not installed`);
|
|
23335
23335
|
return;
|
|
23336
23336
|
}
|
|
23337
23337
|
const workspaceFolder = import_coc23.workspace.getWorkspaceFolder(doc.uri);
|
|
@@ -23354,7 +23354,7 @@ async function addImport(root, document, name, parent, outputChannel) {
|
|
|
23354
23354
|
const pythonToolsExecutionService = new PythonExecutionService();
|
|
23355
23355
|
const rope = await pythonToolsExecutionService.isModuleInstalled("rope");
|
|
23356
23356
|
if (!rope) {
|
|
23357
|
-
import_coc23.window.
|
|
23357
|
+
import_coc23.window.showWarningMessage(`Module rope not installed`);
|
|
23358
23358
|
return;
|
|
23359
23359
|
}
|
|
23360
23360
|
let parentModule = "";
|
|
@@ -23390,7 +23390,7 @@ async function applyImports(doc, resp, outputChannel) {
|
|
|
23390
23390
|
outputChannel.appendLine(`Error in add import:
|
|
23391
23391
|
${errorMessage}`);
|
|
23392
23392
|
outputChannel.appendLine("");
|
|
23393
|
-
import_coc23.window.
|
|
23393
|
+
import_coc23.window.showErrorMessage(`Cannot perform addImport using selected element(s).`);
|
|
23394
23394
|
return await Promise.reject(error);
|
|
23395
23395
|
}
|
|
23396
23396
|
}
|
|
@@ -23440,7 +23440,7 @@ async function extractName(textEditor, newName, renameResponse, outputChannel) {
|
|
|
23440
23440
|
outputChannel.appendLine(`Error in refactoring:
|
|
23441
23441
|
${errorMessage}`);
|
|
23442
23442
|
outputChannel.appendLine("");
|
|
23443
|
-
import_coc23.window.
|
|
23443
|
+
import_coc23.window.showErrorMessage(`Cannot perform refactoring using selected element(s).`);
|
|
23444
23444
|
return await Promise.reject(error);
|
|
23445
23445
|
}
|
|
23446
23446
|
}
|
|
@@ -23565,11 +23565,11 @@ async function activate(context) {
|
|
|
23565
23565
|
return;
|
|
23566
23566
|
const state = import_coc24.extensions.getExtensionState("coc-python");
|
|
23567
23567
|
if (state.toString() === "activated") {
|
|
23568
|
-
import_coc24.window.
|
|
23568
|
+
import_coc24.window.showWarningMessage(`coc-python is installed and activated, coc-pyright will be disabled`);
|
|
23569
23569
|
return;
|
|
23570
23570
|
}
|
|
23571
23571
|
if ((0, import_semver2.lt)(process.versions.node, "12.0.0")) {
|
|
23572
|
-
import_coc24.window.
|
|
23572
|
+
import_coc24.window.showErrorMessage(`Pyright needs Node.js v12+ to work, your Node.js is ${process.version}.`);
|
|
23573
23573
|
return;
|
|
23574
23574
|
}
|
|
23575
23575
|
let module2 = pyrightCfg.get("server");
|
|
@@ -23579,7 +23579,7 @@ async function activate(context) {
|
|
|
23579
23579
|
module2 = (0, import_path5.join)(context.extensionPath, "node_modules", "pyright", "langserver.index.js");
|
|
23580
23580
|
}
|
|
23581
23581
|
if (!(0, import_fs.existsSync)(module2)) {
|
|
23582
|
-
import_coc24.window.
|
|
23582
|
+
import_coc24.window.showErrorMessage(`Pyright langserver doesn't exist, please reinstall coc-pyright`);
|
|
23583
23583
|
return;
|
|
23584
23584
|
}
|
|
23585
23585
|
const runOptions = { execArgv: [`--max-old-space-size=${defaultHeapSize}`] };
|
|
@@ -23595,6 +23595,9 @@ async function activate(context) {
|
|
|
23595
23595
|
if (pyrightCfg.get("disableDiagnostics")) {
|
|
23596
23596
|
disabledFeatures.push("diagnostics");
|
|
23597
23597
|
}
|
|
23598
|
+
const disableProgress = pyrightCfg.get("disableProgressNotifications");
|
|
23599
|
+
if (disableProgress)
|
|
23600
|
+
disabledFeatures.push("progress");
|
|
23598
23601
|
const outputChannel = import_coc24.window.createOutputChannel("Pyright");
|
|
23599
23602
|
const pythonSettings = PythonSettings.getInstance();
|
|
23600
23603
|
outputChannel.appendLine(`Workspace: ${import_coc24.workspace.root}`);
|
|
@@ -23607,7 +23610,7 @@ async function activate(context) {
|
|
|
23607
23610
|
},
|
|
23608
23611
|
outputChannel,
|
|
23609
23612
|
disabledFeatures,
|
|
23610
|
-
progressOnInitialization:
|
|
23613
|
+
progressOnInitialization: !disableProgress,
|
|
23611
23614
|
middleware: {
|
|
23612
23615
|
workspace: {
|
|
23613
23616
|
configuration
|
|
@@ -23651,7 +23654,7 @@ async function activate(context) {
|
|
|
23651
23654
|
command = "pyright.createtypestub";
|
|
23652
23655
|
disposable = import_coc24.commands.registerCommand(command, async (...args) => {
|
|
23653
23656
|
if (!args.length) {
|
|
23654
|
-
import_coc24.window.
|
|
23657
|
+
import_coc24.window.showWarningMessage(`Module name is missing`);
|
|
23655
23658
|
return;
|
|
23656
23659
|
}
|
|
23657
23660
|
const doc = await import_coc24.workspace.document;
|
|
@@ -23692,7 +23695,7 @@ async function activate(context) {
|
|
|
23692
23695
|
const pyrightPackage = JSON.parse((0, import_fs.readFileSync)(pyrightJSON, "utf8"));
|
|
23693
23696
|
const cocPyrightJSON = (0, import_path5.join)(context.extensionPath, "package.json");
|
|
23694
23697
|
const cocPyrightPackage = JSON.parse((0, import_fs.readFileSync)(cocPyrightJSON, "utf8"));
|
|
23695
|
-
import_coc24.window.
|
|
23698
|
+
import_coc24.window.showInformationMessage(`coc-pyright ${cocPyrightPackage.version} with Pyright ${pyrightPackage.version}`);
|
|
23696
23699
|
});
|
|
23697
23700
|
context.subscriptions.push(disposable);
|
|
23698
23701
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coc-pyright",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.255",
|
|
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.
|
|
1422
|
+
"pyright": "^1.1.255"
|
|
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",
|