From 8c34634653be5c62c4c2463b962d9ecc8b332d5d Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 5 Jun 2023 12:48:11 -0700 Subject: [PATCH 1/3] Bug fixes and package updates from extension template --- bundled/tool/lsp_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bundled/tool/lsp_utils.py b/bundled/tool/lsp_utils.py index b642c04..5f82375 100644 --- a/bundled/tool/lsp_utils.py +++ b/bundled/tool/lsp_utils.py @@ -4,6 +4,7 @@ from __future__ import annotations import contextlib +import importlib import io import os import pathlib From a7ca8c23e129a44f6647189b9349e6a1b52e3ffe Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 5 Jun 2023 13:27:12 -0700 Subject: [PATCH 2/3] Linting fixes --- bundled/tool/lsp_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bundled/tool/lsp_utils.py b/bundled/tool/lsp_utils.py index 5f82375..b642c04 100644 --- a/bundled/tool/lsp_utils.py +++ b/bundled/tool/lsp_utils.py @@ -4,7 +4,6 @@ from __future__ import annotations import contextlib -import importlib import io import os import pathlib From fa6156d2cf46b065b6ae2ba9e2efa51a3cd4cd99 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 5 Jun 2023 18:54:25 -0700 Subject: [PATCH 3/3] Update logging details for `isort` --- README.md | 7 +++++-- bundled/tool/lsp_server.py | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2dba64..98e7277 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Import sorting extension for Visual Studio Code using `isort` -A Visual Studio Code extension that provides import sorting using `isort`. The extension ships with `isort=5.11.5`. +A Visual Studio Code extension that provides import sorting using `isort`. The extension ships with `isort=5.11.5`. This extension uses Language Server Protocol ([LSP](https://microsoft.github.io/language-server-protocol/)) to run `isort` in a server like mode. Note: @@ -40,7 +40,6 @@ If you want to disable isort extension, you can [disable this extension](https:/ | isort.args | `[]` | Custom arguments passed to `isort`. E.g `"isort.args" = ["--settings-file", ""]` | | isort.check | `false` | Runs `isort --check` on open files and reports sorting issues as `Hint`. Update `isort.severity` to show sorting issues with higher severity. | | isort.severity | `{ "W": "Warning", "E": "Hint" }` | Controls mapping of severity from `isort` to VS Code severity when displaying in the problems window. | -| isort.logLevel | `error` | Sets the tracing level for the extension. | | isort.path | `[]` | Setting to provide custom `isort` executable. This will slow down formatting, since we will have to run `isort` executable every time or file save or open. Example 1: `["~/global_env/isort"]` Example 2: `["conda", "run", "-n", "lint_env", "python", "-m", "isort"]` | | isort.interpreter | `[]` | Path to a python interpreter to use to run the linter server. | | isort.importStrategy | `useBundled` | Setting to choose where to load `isort` from. `useBundled` picks isort bundled with the extension. `fromEnvironment` uses `isort` available in the environment. | @@ -52,3 +51,7 @@ If you want to disable isort extension, you can [disable this extension](https:/ | Command | Description | | -------------- | -------------------------------- | | isort: Restart | Force re-start the isort server. | + +## Logging + +Use `Developer : Set Log Level...` command from the **Command Palette**, and select `isort` from the extensions list to set the Log Level for the extension. For detailed LSP traces, add `"isort.trace.server" : "verbose"` to your **User** `settings.json` file. diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 8ecf903..022970c 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -468,7 +468,6 @@ def _log_verbose_config(settings: Dict[str, str]) -> None: def _get_global_defaults(): return { "check": GLOBAL_SETTINGS.get("check", False), - "logLevel": GLOBAL_SETTINGS.get("logLevel", "error"), "path": GLOBAL_SETTINGS.get("path", []), "severity": GLOBAL_SETTINGS.get("severity", {"E": "Hint", "W": "Warning"}), "interpreter": GLOBAL_SETTINGS.get("interpreter", [sys.executable]),