diff --git a/README.md b/README.md index 50e8edc..557469b 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ pylyzer as a language server supports various features, such as completion and r ![autoimport](https://raw.githubusercontent.com/mtshiba/pylyzer/main/images/autoimport.gif) +## [VSCode extension](https://github.com/mtshiba/pylyzer/blob/main/extension) + ## How it works pylyzer uses the type checker of [the Erg programming language](https://erg-lang.org) internally. diff --git a/extension/README.md b/extension/README.md index 680c8d2..f6b6b8b 100644 --- a/extension/README.md +++ b/extension/README.md @@ -15,3 +15,18 @@ or ```console cargo install pylyzer ``` + +## Commands + +| Command | Description | +| - | - | +| pylyzer.restartLanguageServer | Restart the language server | + +## Settings + +| Setting | Description | Default | +| - | - | - | +| pylyzer.diagnostics | Enable diagnostics | true | +| pylyzer.inlayHints | Enable inlay hints (this feature is unstable) | false | +| pylyzer.smartCompletion | Enable smart completion (see [ELS features](https://github.com/erg-lang/erg/blob/main/crates/els/doc/features.md))| true | +| pylyzer.checkOnType | Perform checking each time any character is entered. This improves the accuracy of completion, etc., but may slow down the execution | false | diff --git a/extension/package-lock.json b/extension/package-lock.json index 3b9acb8..667cbe5 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "pylyzer", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pylyzer", - "version": "0.1.3", + "version": "0.1.4", "dependencies": { "vscode-languageclient": "^8.0.2" }, diff --git a/extension/package.json b/extension/package.json index c1176bd..506994f 100644 --- a/extension/package.json +++ b/extension/package.json @@ -3,7 +3,7 @@ "displayName": "pylyzer", "description": "A fast Python static code analyzer & language server for VSCode", "publisher": "pylyzer", - "version": "0.1.3", + "version": "0.1.4", "engines": { "vscode": "^1.70.0" }, @@ -43,6 +43,11 @@ "type": "object", "title": "pylyzer", "properties": { + "pylyzer.diagnostics": { + "type": "boolean", + "default": true, + "markdownDescription": "Enable diagnostics" + }, "pylyzer.inlayHints": { "type": "boolean", "default": false, diff --git a/extension/src/extension.ts b/extension/src/extension.ts index ad60318..b5ad749 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -16,6 +16,7 @@ async function startLanguageClient(context: ExtensionContext) { .get("executablePath", ""); return executablePath === "" ? "pylyzer" : executablePath; })(); + const enableDiagnostics = workspace.getConfiguration("pylyzer").get("diagnostics", true); const enableInlayHints = workspace.getConfiguration("pylyzer").get("inlayHints", false); const enableSemanticTokens = workspace.getConfiguration("pylyzer").get("semanticTokens", true); const enableHover = workspace.getConfiguration("pylyzer").get("hover", true); @@ -23,9 +24,13 @@ async function startLanguageClient(context: ExtensionContext) { /* optional features */ const checkOnType = workspace.getConfiguration("pylyzer").get("checkOnType", false); let args = ["--server"]; - if (!(enableInlayHints && enableSemanticTokens && enableHover && smartCompletion) || checkOnType) { + if (!(enableDiagnostics && enableSemanticTokens && enableHover && smartCompletion) || (checkOnType || enableInlayHints)) { args.push("--"); } + if (!enableDiagnostics) { + args.push("--disable"); + args.push("diagnostic"); + } if (!enableInlayHints) { args.push("--disable"); args.push("inlayHints");