From 6c168d0f8ee2e59ec8438373bc2c1b33cb74cdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krassowski?= <5832902+krassowski@users.noreply.github.com> Date: Sat, 9 Sep 2023 22:39:22 +0100 Subject: [PATCH 01/10] Add black reformatting commit to `.git-blame-ignore-revs` (#436) --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..96147baf --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Reformatting with Black +d47dc3c1fd1f2bafcc079006c3283e465b372f75 From 8377b2cb11208dfda917100807cf3d6019ac58ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krassowski?= <5832902+krassowski@users.noreply.github.com> Date: Sun, 10 Sep 2023 17:11:42 +0100 Subject: [PATCH 02/10] Fix `include_declaration` handling in references request (#440) --- pylsp/plugins/references.py | 2 +- test/plugins/test_references.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylsp/plugins/references.py b/pylsp/plugins/references.py index cfdf86b5..fadf1de8 100644 --- a/pylsp/plugins/references.py +++ b/pylsp/plugins/references.py @@ -8,7 +8,7 @@ @hookimpl -def pylsp_references(document, position, exclude_declaration=False): +def pylsp_references(document, position, exclude_declaration): code_position = _utils.position_to_jedi_linecolumn(document, position) usages = document.jedi_script().get_references(**code_position) diff --git a/test/plugins/test_references.py b/test/plugins/test_references.py index 20906dff..e8030a42 100644 --- a/test/plugins/test_references.py +++ b/test/plugins/test_references.py @@ -42,7 +42,7 @@ def test_references(tmp_workspace): # pylint: disable=redefined-outer-name DOC1_URI = uris.from_fs_path(os.path.join(tmp_workspace.root_path, DOC1_NAME)) doc1 = Document(DOC1_URI, tmp_workspace) - refs = pylsp_references(doc1, position) + refs = pylsp_references(doc1, position, exclude_declaration=False) # Definition, the import and the instantiation assert len(refs) == 3 @@ -72,7 +72,7 @@ def test_references_builtin(tmp_workspace): # pylint: disable=redefined-outer-n doc2_uri = uris.from_fs_path(os.path.join(str(tmp_workspace.root_path), DOC2_NAME)) doc2 = Document(doc2_uri, tmp_workspace) - refs = pylsp_references(doc2, position) + refs = pylsp_references(doc2, position, exclude_declaration=False) assert len(refs) >= 1 expected = { From 6059aa39e4fcc7b645c2f2c7f3d9463c1ab58f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krassowski?= <5832902+krassowski@users.noreply.github.com> Date: Sun, 10 Sep 2023 18:22:16 +0100 Subject: [PATCH 03/10] Pass a single copy of the document's source around for flake8 (#441) --- pylsp/plugins/flake8_lint.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py index 068585ef..d31783bf 100644 --- a/pylsp/plugins/flake8_lint.py +++ b/pylsp/plugins/flake8_lint.py @@ -79,11 +79,15 @@ def pylsp_lint(workspace, document): flake8_executable = settings.get("executable", "flake8") args = build_args(opts) - output = run_flake8(flake8_executable, args, document) - return parse_stdout(document, output) + # ensure the same source is used for flake8 execution and result parsing; + # single source access improves performance as it is only one disk access + source = document.source + output = run_flake8(flake8_executable, args, document, source) + return parse_stdout(source, output) -def run_flake8(flake8_executable, args, document): + +def run_flake8(flake8_executable, args, document, source): """Run flake8 with the provided arguments, logs errors from stderr if any. """ @@ -127,7 +131,7 @@ def run_flake8(flake8_executable, args, document): p = Popen( # pylint: disable=consider-using-with cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, **popen_kwargs ) - (stdout, stderr) = p.communicate(document.source.encode()) + (stdout, stderr) = p.communicate(source.encode()) if stderr: log.error("Error while running flake8 '%s'", stderr.decode()) return stdout.decode() @@ -155,7 +159,7 @@ def build_args(options): return args -def parse_stdout(document, stdout): +def parse_stdout(source, stdout): """ Build a diagnostics from flake8's output, it should extract every result and format it into a dict that looks like this: @@ -183,6 +187,7 @@ def parse_stdout(document, stdout): A list of dictionaries. """ + document_lines = source.splitlines(True) diagnostics = [] lines = stdout.splitlines() for raw_line in lines: @@ -212,7 +217,7 @@ def parse_stdout(document, stdout): "end": { "line": line, # no way to determine the column - "character": len(document.lines[line]), + "character": len(document_lines[line]), }, }, "message": msg, From 4211502fabf650d49f1731d608699dd07ea41723 Mon Sep 17 00:00:00 2001 From: Stephen Macke Date: Sat, 30 Sep 2023 07:40:45 -0700 Subject: [PATCH 04/10] Allow Jedi "goto" to perform multiple hops for "go to definition" (#443) --- pylsp/plugins/definition.py | 42 ++++++++++++++++++++++---- test/plugins/test_definitions.py | 51 +++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 6 deletions(-) diff --git a/pylsp/plugins/definition.py b/pylsp/plugins/definition.py index a5ccbd70..ffc1b00b 100644 --- a/pylsp/plugins/definition.py +++ b/pylsp/plugins/definition.py @@ -1,22 +1,54 @@ # Copyright 2017-2020 Palantir Technologies, Inc. # Copyright 2021- Python Language Server Contributors. - +from __future__ import annotations import logging +from typing import Any, Dict, List, TYPE_CHECKING from pylsp import hookimpl, uris, _utils +if TYPE_CHECKING: + from jedi.api import Script + from jedi.api.classes import Name + from pylsp.config.config import Config + from pylsp.workspace import Document + log = logging.getLogger(__name__) +MAX_JEDI_GOTO_HOPS = 100 + + +def _resolve_definition( + maybe_defn: Name, script: Script, settings: Dict[str, Any] +) -> Name: + for _ in range(MAX_JEDI_GOTO_HOPS): + if maybe_defn.is_definition() or maybe_defn.module_path != script.path: + break + defns = script.goto( + follow_imports=settings.get("follow_imports", True), + follow_builtin_imports=settings.get("follow_builtin_imports", True), + line=maybe_defn.line, + column=maybe_defn.column, + ) + if len(defns) == 1: + maybe_defn = defns[0] + else: + break + return maybe_defn + + @hookimpl -def pylsp_definitions(config, document, position): +def pylsp_definitions( + config: Config, document: Document, position: Dict[str, int] +) -> List[Dict[str, Any]]: settings = config.plugin_settings("jedi_definition") code_position = _utils.position_to_jedi_linecolumn(document, position) - definitions = document.jedi_script(use_document_path=True).goto( + script = document.jedi_script(use_document_path=True) + definitions = script.goto( follow_imports=settings.get("follow_imports", True), follow_builtin_imports=settings.get("follow_builtin_imports", True), **code_position, ) - + definitions = [_resolve_definition(d, script, settings) for d in definitions] follow_builtin_defns = settings.get("follow_builtin_definitions", True) return [ { @@ -31,7 +63,7 @@ def pylsp_definitions(config, document, position): ] -def _not_internal_definition(definition): +def _not_internal_definition(definition: Name) -> bool: return ( definition.line is not None and definition.column is not None diff --git a/test/plugins/test_definitions.py b/test/plugins/test_definitions.py index 34acc6a9..f0e9ffef 100644 --- a/test/plugins/test_definitions.py +++ b/test/plugins/test_definitions.py @@ -12,7 +12,7 @@ DOC = """def a(): pass -print a() +print(a()) class Directory(object): @@ -21,6 +21,21 @@ def __init__(self): def add_member(self, id, name): self.members[id] = name + + +subscripted_before_reference = {} +subscripted_before_reference[0] = 0 +subscripted_before_reference + + +def my_func(): + print('called') + +alias = my_func +my_list = [1, None, alias] +inception = my_list[2] + +inception() """ @@ -40,6 +55,40 @@ def test_definitions(config, workspace): ) +def test_indirect_definitions(config, workspace): + # Over 'subscripted_before_reference' + cursor_pos = {"line": 16, "character": 0} + + # The definition of 'subscripted_before_reference', + # skipping intermediate writes to the most recent definition + def_range = { + "start": {"line": 14, "character": 0}, + "end": {"line": 14, "character": len("subscripted_before_reference")}, + } + + doc = Document(DOC_URI, workspace, DOC) + assert [{"uri": DOC_URI, "range": def_range}] == pylsp_definitions( + config, doc, cursor_pos + ) + + +def test_definition_with_multihop_inference_goto(config, workspace): + # Over 'inception()' + cursor_pos = {"line": 26, "character": 0} + + # The most recent definition of 'inception', + # ignoring alias hops + def_range = { + "start": {"line": 24, "character": 0}, + "end": {"line": 24, "character": len("inception")}, + } + + doc = Document(DOC_URI, workspace, DOC) + assert [{"uri": DOC_URI, "range": def_range}] == pylsp_definitions( + config, doc, cursor_pos + ) + + def test_builtin_definition(config, workspace): # Over 'i' in dict cursor_pos = {"line": 8, "character": 24} From ccbf6cd7b32db8fd338fb6767bdb73bdfd10b4cf Mon Sep 17 00:00:00 2001 From: Stephen Macke Date: Tue, 3 Oct 2023 14:29:00 -0700 Subject: [PATCH 05/10] Fix numpy go-to-definition by taking it off autoimport list for this case (#447) --- pylsp/plugins/definition.py | 22 ++++++++++++++++------ test/plugins/test_definitions.py | 12 ++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pylsp/plugins/definition.py b/pylsp/plugins/definition.py index ffc1b00b..53eda915 100644 --- a/pylsp/plugins/definition.py +++ b/pylsp/plugins/definition.py @@ -3,6 +3,9 @@ from __future__ import annotations import logging from typing import Any, Dict, List, TYPE_CHECKING + +import jedi + from pylsp import hookimpl, uris, _utils if TYPE_CHECKING: @@ -43,12 +46,19 @@ def pylsp_definitions( settings = config.plugin_settings("jedi_definition") code_position = _utils.position_to_jedi_linecolumn(document, position) script = document.jedi_script(use_document_path=True) - definitions = script.goto( - follow_imports=settings.get("follow_imports", True), - follow_builtin_imports=settings.get("follow_builtin_imports", True), - **code_position, - ) - definitions = [_resolve_definition(d, script, settings) for d in definitions] + auto_import_modules = jedi.settings.auto_import_modules + + try: + jedi.settings.auto_import_modules = [] + definitions = script.goto( + follow_imports=settings.get("follow_imports", True), + follow_builtin_imports=settings.get("follow_builtin_imports", True), + **code_position, + ) + definitions = [_resolve_definition(d, script, settings) for d in definitions] + finally: + jedi.settings.auto_import_modules = auto_import_modules + follow_builtin_defns = settings.get("follow_builtin_definitions", True) return [ { diff --git a/test/plugins/test_definitions.py b/test/plugins/test_definitions.py index f0e9ffef..c366e8ca 100644 --- a/test/plugins/test_definitions.py +++ b/test/plugins/test_definitions.py @@ -36,6 +36,9 @@ def my_func(): inception = my_list[2] inception() + +import numpy +numpy.ones """ @@ -89,6 +92,15 @@ def test_definition_with_multihop_inference_goto(config, workspace): ) +def test_numpy_definition(config, workspace): + # Over numpy.ones + cursor_pos = {"line": 29, "character": 8} + + doc = Document(DOC_URI, workspace, DOC) + defns = pylsp_definitions(config, doc, cursor_pos) + assert len(defns) > 0, defns + + def test_builtin_definition(config, workspace): # Over 'i' in dict cursor_pos = {"line": 8, "character": 24} From 76ea9ae702ae9c1c2a821e5ce27a81d23eb81ebe Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 4 Oct 2023 12:17:48 -0400 Subject: [PATCH 06/10] Increase minimal required version of autopep8 to `>=2.0.4,<2.1.0` (#449) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a27c1316..d2983edb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ Homepage = "https://github.com/python-lsp/python-lsp-server" [project.optional-dependencies] all = [ - "autopep8>=1.6.0,<2.1.0", + "autopep8>=2.0.4,<2.1.0", "flake8>=6.1.0,<7", "mccabe>=0.7.0,<0.8.0", "pycodestyle>=2.11.0,<2.12.0", From ecefb7318ae31451ed6d4a7f7cc55583fff7049f Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Wed, 4 Oct 2023 13:18:21 -0400 Subject: [PATCH 07/10] Fix renaming when file has no EOLs (#450) --- pylsp/plugins/jedi_rename.py | 4 +++- pylsp/plugins/rope_rename.py | 8 +++++-- test/plugins/test_jedi_rename.py | 38 +++++++++++++++++++++++++++----- test/plugins/test_rope_rename.py | 28 ++++++++++++++++++++++- 4 files changed, 68 insertions(+), 10 deletions(-) diff --git a/pylsp/plugins/jedi_rename.py b/pylsp/plugins/jedi_rename.py index 700da508..9c89c1de 100644 --- a/pylsp/plugins/jedi_rename.py +++ b/pylsp/plugins/jedi_rename.py @@ -54,4 +54,6 @@ def pylsp_rename( def _num_lines(file_contents): "Count the number of lines in the given string." - return len(file_contents.splitlines()) + if _utils.get_eol_chars(file_contents): + return len(file_contents.splitlines()) + return 0 diff --git a/pylsp/plugins/rope_rename.py b/pylsp/plugins/rope_rename.py index f59ba890..a4323a42 100644 --- a/pylsp/plugins/rope_rename.py +++ b/pylsp/plugins/rope_rename.py @@ -6,7 +6,7 @@ from rope.base import libutils from rope.refactor.rename import Rename -from pylsp import hookimpl, uris +from pylsp import hookimpl, uris, _utils log = logging.getLogger(__name__) @@ -59,4 +59,8 @@ def pylsp_rename(config, workspace, document, position, new_name): def _num_lines(resource): "Count the number of lines in a `File` resource." - return len(resource.read().splitlines()) + text = resource.read() + + if _utils.get_eol_chars(text): + return len(text.splitlines()) + return 0 diff --git a/test/plugins/test_jedi_rename.py b/test/plugins/test_jedi_rename.py index c3a1e485..d88a9297 100644 --- a/test/plugins/test_jedi_rename.py +++ b/test/plugins/test_jedi_rename.py @@ -2,16 +2,12 @@ # Copyright 2021- Python Language Server Contributors. import os -import sys import pytest from pylsp import uris from pylsp.plugins.jedi_rename import pylsp_rename from pylsp.workspace import Document -LT_PY36 = sys.version_info.major < 3 or ( - sys.version_info.major == 3 and sys.version_info.minor < 6 -) DOC_NAME = "test1.py" DOC = """class Test1(): @@ -26,13 +22,17 @@ class Test2(Test1): x = Test1() """ +DOC_NAME_SIMPLE = "test3.py" +DOC_SIMPLE = "foo = 12" + @pytest.fixture def tmp_workspace(temp_workspace_factory): - return temp_workspace_factory({DOC_NAME: DOC, DOC_NAME_EXTRA: DOC_EXTRA}) + return temp_workspace_factory( + {DOC_NAME: DOC, DOC_NAME_EXTRA: DOC_EXTRA, DOC_NAME_SIMPLE: DOC_SIMPLE} + ) -@pytest.mark.skipif(LT_PY36, reason="Jedi refactoring isnt supported on Python 2.x/3.5") def test_jedi_rename(tmp_workspace, config): # pylint: disable=redefined-outer-name # rename the `Test1` class position = {"line": 0, "character": 6} @@ -56,6 +56,7 @@ def test_jedi_rename(tmp_workspace, config): # pylint: disable=redefined-outer- "newText": "class ShouldBeRenamed():\n pass\n\nclass Test2(ShouldBeRenamed):\n pass\n", } ] + path = os.path.join(tmp_workspace.root_path, DOC_NAME_EXTRA) uri_extra = uris.from_fs_path(path) assert changes[1]["textDocument"]["uri"] == uri_extra @@ -63,6 +64,7 @@ def test_jedi_rename(tmp_workspace, config): # pylint: disable=redefined-outer- # but that do need to be renamed in the project have a `null` version # number. assert changes[1]["textDocument"]["version"] is None + expected = "from test1 import ShouldBeRenamed\nx = ShouldBeRenamed()\n" if os.name == "nt": # The .write method in the temp_workspace_factory functions writes @@ -77,3 +79,27 @@ def test_jedi_rename(tmp_workspace, config): # pylint: disable=redefined-outer- "newText": expected, } ] + + # Regression test for issue python-lsp/python-lsp-server#413 + # rename foo + position = {"line": 0, "character": 0} + DOC_URI = uris.from_fs_path(os.path.join(tmp_workspace.root_path, DOC_NAME_SIMPLE)) + doc = Document(DOC_URI, tmp_workspace) + + result = pylsp_rename(config, tmp_workspace, doc, position, "bar") + assert len(result.keys()) == 1 + + changes = result.get("documentChanges") + assert len(changes) == 1 + + assert changes[0]["textDocument"]["uri"] == doc.uri + assert changes[0]["textDocument"]["version"] == doc.version + assert changes[0].get("edits") == [ + { + "range": { + "start": {"line": 0, "character": 0}, + "end": {"line": 0, "character": 0}, + }, + "newText": "bar = 12", + } + ] diff --git a/test/plugins/test_rope_rename.py b/test/plugins/test_rope_rename.py index 285a565e..9b9039ba 100644 --- a/test/plugins/test_rope_rename.py +++ b/test/plugins/test_rope_rename.py @@ -8,6 +8,7 @@ from pylsp.plugins.rope_rename import pylsp_rename from pylsp.workspace import Document + DOC_NAME = "test1.py" DOC = """class Test1(): pass @@ -16,10 +17,13 @@ class Test2(Test1): pass """ +DOC_NAME_SIMPLE = "test2.py" +DOC_SIMPLE = "foo = 12" + @pytest.fixture def tmp_workspace(temp_workspace_factory): - return temp_workspace_factory({DOC_NAME: DOC}) + return temp_workspace_factory({DOC_NAME: DOC, DOC_NAME_SIMPLE: DOC_SIMPLE}) def test_rope_rename(tmp_workspace, config): # pylint: disable=redefined-outer-name @@ -45,3 +49,25 @@ def test_rope_rename(tmp_workspace, config): # pylint: disable=redefined-outer- "newText": "class ShouldBeRenamed():\n pass\n\nclass Test2(ShouldBeRenamed):\n pass\n", } ] + + # Regression test for issue python-lsp/python-lsp-server#413 + # rename foo + position = {"line": 0, "character": 0} + DOC_URI = uris.from_fs_path(os.path.join(tmp_workspace.root_path, DOC_NAME_SIMPLE)) + doc = Document(DOC_URI, tmp_workspace) + + result = pylsp_rename(config, tmp_workspace, doc, position, "bar") + assert len(result.keys()) == 1 + + changes = result.get("documentChanges") + assert len(changes) == 1 + + assert changes[0].get("edits") == [ + { + "range": { + "start": {"line": 0, "character": 0}, + "end": {"line": 0, "character": 0}, + }, + "newText": "bar = 12", + } + ] From 05698fa11bfc566ae7e040a2ed272247f8d406b2 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Thu, 5 Oct 2023 12:21:02 -0400 Subject: [PATCH 08/10] Update changelog for 1.8.1 (#451) --- CHANGELOG.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed800436..0b0e8d1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # History of changes +## Version 1.8.1 (2023/10/05) + +### Issues Closed + +* [Issue 439](https://github.com/python-lsp/python-lsp-server/issues/439) - `includeDeclaration` is no longer respected in `textDocument/references` ([PR 440](https://github.com/python-lsp/python-lsp-server/pull/440) by [@krassowski](https://github.com/krassowski)) +* [Issue 438](https://github.com/python-lsp/python-lsp-server/issues/438) - flake8 can error out when deleting lines ([PR 441](https://github.com/python-lsp/python-lsp-server/pull/441) by [@krassowski](https://github.com/krassowski)) +* [Issue 413](https://github.com/python-lsp/python-lsp-server/issues/413) - textDocument/rename reports positions outside of the document ([PR 450](https://github.com/python-lsp/python-lsp-server/pull/450) by [@ccordoba12](https://github.com/ccordoba12)) + +In this release 3 issues were closed. + +### Pull Requests Merged + +* [PR 450](https://github.com/python-lsp/python-lsp-server/pull/450) - Fix renaming when file has no EOLs, by [@ccordoba12](https://github.com/ccordoba12) ([413](https://github.com/python-lsp/python-lsp-server/issues/413)) +* [PR 449](https://github.com/python-lsp/python-lsp-server/pull/449) - Increase minimal required version of autopep8 to `>=2.0.4,<2.1.0`, by [@ccordoba12](https://github.com/ccordoba12) +* [PR 447](https://github.com/python-lsp/python-lsp-server/pull/447) - Fix numpy go-to-definition by taking it off autoimport list for this case, by [@smacke](https://github.com/smacke) +* [PR 443](https://github.com/python-lsp/python-lsp-server/pull/443) - Allow Jedi "goto" to perform multiple hops for "go to definition", by [@smacke](https://github.com/smacke) +* [PR 441](https://github.com/python-lsp/python-lsp-server/pull/441) - Pass a single copy of the document's source around for flake8, by [@krassowski](https://github.com/krassowski) ([438](https://github.com/python-lsp/python-lsp-server/issues/438)) +* [PR 440](https://github.com/python-lsp/python-lsp-server/pull/440) - Fix `include_declaration` handling in references request, by [@krassowski](https://github.com/krassowski) ([439](https://github.com/python-lsp/python-lsp-server/issues/439)) +* [PR 436](https://github.com/python-lsp/python-lsp-server/pull/436) - Add black reformatting commit to `.git-blame-ignore-revs`, by [@krassowski](https://github.com/krassowski) + +In this release 7 pull requests were closed. + +---- + ## Version 1.8.0 (2023/09/08) ### New features From 6b975be4de2697979ee8039a59d84cfd7923c827 Mon Sep 17 00:00:00 2001 From: Stephen Macke Date: Sun, 8 Oct 2023 18:19:07 -0700 Subject: [PATCH 09/10] Fix notebook document selector not being a list in capabilities (#454) --- pylsp/python_lsp.py | 2 +- test/test_notebook_document.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pylsp/python_lsp.py b/pylsp/python_lsp.py index 3eeb2f7f..e2b541d5 100644 --- a/pylsp/python_lsp.py +++ b/pylsp/python_lsp.py @@ -295,7 +295,7 @@ def capabilities(self): "openClose": True, }, "notebookDocumentSync": { - "notebookSelector": {"cells": [{"language": "python"}]} + "notebookSelector": [{"cells": [{"language": "python"}]}] }, "workspace": { "workspaceFolders": {"supported": True, "changeNotifications": True} diff --git a/test/test_notebook_document.py b/test/test_notebook_document.py index e8e7ac75..6050b58f 100644 --- a/test/test_notebook_document.py +++ b/test/test_notebook_document.py @@ -33,7 +33,8 @@ def test_initialize(client_server_pair): }, ).result(timeout=CALL_TIMEOUT_IN_SECONDS) assert server.workspace is not None - assert "notebookDocumentSync" in response["capabilities"].keys() + selector = response["capabilities"]["notebookDocumentSync"]["notebookSelector"] + assert isinstance(selector, list) @pytest.mark.skipif(IS_WIN, reason="Flaky on Windows") From d33927208a60890f48148d2cd1c007e859e6f084 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Mon, 9 Oct 2023 10:57:39 -0400 Subject: [PATCH 10/10] Update changelog for 1.8.2 (#456) --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b0e8d1f..eb9c7957 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # History of changes +## Version 1.8.2 (2023/10/09) + +### Issues Closed + +* [Issue 453](https://github.com/python-lsp/python-lsp-server/issues/453) - notebookDocumentSync notebookSelector type error ([PR 454](https://github.com/python-lsp/python-lsp-server/pull/454) by [@smacke](https://github.com/smacke)) + +In this release 1 issue was closed. + +### Pull Requests Merged + +* [PR 454](https://github.com/python-lsp/python-lsp-server/pull/454) - Fix notebook document selector not being a list in capabilities, by [@smacke](https://github.com/smacke) ([453](https://github.com/python-lsp/python-lsp-server/issues/453)) + +In this release 1 pull request was closed. + +---- + ## Version 1.8.1 (2023/10/05) ### Issues Closed