From 7fd409c4392417245cf7723394aed647ab3fab28 Mon Sep 17 00:00:00 2001 From: DetachHead <57028336+DetachHead@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:39:28 +1000 Subject: [PATCH 1/2] workaround for memory leak caused by pylint bug --- bundled/tool/lsp_server.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 8262235..91afdcf 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -735,10 +735,14 @@ def _run_tool_on_document( argv += TOOL_ARGS + settings["args"] + extra_args + # pygls normalizes the path to lowercase on windows, but we need to resolve the + # correct capitalization to avoid https://github.com/pylint-dev/pylint/issues/10137 + resolved_path = pathlib.Path(document.path).resolve() + if use_stdin: - argv += ["--from-stdin", document.path] + argv += ["--from-stdin", resolved_path] else: - argv += [document.path] + argv += [resolved_path] env = None if use_path or use_rpc: From 5befab345e0d7a2915c1c597c59bee412e3490fc Mon Sep 17 00:00:00 2001 From: DetachHead <57028336+DetachHead@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:53:44 +1000 Subject: [PATCH 2/2] fix type of `resolved_path` --- bundled/tool/lsp_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index 91afdcf..d15f26a 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -737,7 +737,7 @@ def _run_tool_on_document( # pygls normalizes the path to lowercase on windows, but we need to resolve the # correct capitalization to avoid https://github.com/pylint-dev/pylint/issues/10137 - resolved_path = pathlib.Path(document.path).resolve() + resolved_path = str(pathlib.Path(document.path).resolve()) if use_stdin: argv += ["--from-stdin", resolved_path]