jupyter-lsp / jupyterlab-lsp

Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
https://jupyterlab-lsp.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.81k stars 149 forks source link

Autocomplete across multiple cells #868

Open catethos opened 2 years ago

catethos commented 2 years ago

Description

There is no autocomplete if the import statement is in the other cell

CPT2210211230-1415x762

Is this expected behavior? that I need to use kernel autocomplete in this case

krassowski commented 2 years ago

No, this is not expected. I could not reproduce the issue (it completed in the second cell as expected). What are your settings? Could you provide more details, see this template? I

catethos commented 2 years ago

I am using Poetry and Poetry-kernel

Context

Required: installed server extensions
Config dir: /home/xx.jupyter

Config dir: /home/xx/.pyenv/versions/3.9.15/etc/jupyter
    jupyter_lsp enabled
    - Validating jupyter_lsp...
      jupyter_lsp 1.5.1 OK
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 3.4.8 OK
    nbclassic enabled
    - Validating nbclassic...
      nbclassic 0.4.5 OK

Config dir: /usr/local/etc/jupyter

Required: installed lab extensions
JupyterLab v3.4.8
/homexx/.pyenv/versions/3.9.15/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @krassowski/jupyterlab-lsp v3.10.2 enabled OK (python, jupyterlab-lsp)

Other labextensions (built into JupyterLab)
   app dir: /home/xx/.pyenv/versions/3.9.15/share/jupyter/lab
        jupyterlab-tailwind-theme v3.0.3 enabled OK

Troubleshoot Output
$PATH:
    /home/xx/.pyenv/versions/3.9.15/bin
    /home/cxx/.pyenv/libexec
    /home/xx/.pyenv/plugins/python-build/bin
    /home/xx/.pyenv/plugins/pyenv-virtualenv/bin
    /home/xx/.pyenv/plugins/pyenv-update/bin
    /home/xx/.pyenv/plugins/pyenv-installer/bin
    /home/xx/.pyenv/plugins/pyenv-doctor/bin
    /home/cxx/.pyenv/plugins/pyenv-virtualenv/shims
    /home/xx/.pyenv/shims
    /home/xx.pyenv/bin
    /home/xx/.local/bin
    /usr/local/bin
    /usr/bin
    /usr/local/sbin
    /usr/bin/site_perl
    /usr/bin/vendor_perl
    /usr/bin/core_perl

sys.path:
    /home/xx/.pyenv/versions/3.9.15/bin
    /home/xx/.pyenv/versions/3.9.15/lib/python39.zip
    /home/xx/.pyenv/versions/3.9.15/lib/python3.9
    /home/xx/.pyenv/versions/3.9.15/lib/python3.9/lib-dynload
    /home/xx/.pyenv/versions/3.9.15/lib/python3.9/site-packages

sys.executable:
    /home/xx/pyenv/versions/3.9.15/bin/python3.9

sys.version:
    3.9.15 (main, Oct 21 2022, 02:49:21) 
    [GCC 12.2.0]

platform.platform():
    Linux-5.15.74-3-MANJARO-x86_64-with-glibc2.36

which -a jupyter:
    /home/xx/.pyenv/versions/3.9.15/bin/jupyter
    /home/xx/.pyenv/shims/jupyter

pip list:
    Package               Version
    --------------------- -----------
    aiobotocore           2.4.0
    aiohttp               3.8.3
    aioitertools          0.11.0
    aiosignal             1.2.0
    anyio                 3.6.2
    argon2-cffi           21.3.0
    argon2-cffi-bindings  21.2.0
    astroid               2.12.12
    asttokens             2.0.8
    async-timeout         4.0.2
    attrs                 22.1.0
    autopep8              1.6.0
    Babel                 2.10.3
    backcall              0.2.0
    beautifulsoup4        4.11.1
    bleach                5.0.1
    botocore              1.27.59
    certifi               2022.9.24
    cffi                  1.15.1
    charset-normalizer    2.1.1
    colorama              0.4.5
    debugpy               1.6.3
    decorator             5.1.1
    defusedxml            0.7.1
    dill                  0.3.5.1
    docstring-to-markdown 0.10
    entrypoints           0.4
    executing             1.1.1
    fastjsonschema        2.16.2
    flake8                4.0.1
    frozenlist            1.3.1
    fsspec                2022.10.0
    idna                  3.4
    importlib-metadata    5.0.0
    ipykernel             6.16.1
    ipython               8.5.0
    ipython-genutils      0.2.0
    isort                 5.10.1
    jedi                  0.18.1
    Jinja2                3.1.2
    jmespath              1.0.1
    json5                 0.9.10
    jsonschema            4.16.0
    jupyter-client        7.0.6
    jupyter_core          4.11.2
    jupyter-lsp           1.5.1
    jupyter-server        1.21.0
    jupyterlab            3.4.8
    jupyterlab-lsp        3.10.2
    jupyterlab-pygments   0.2.2
    jupyterlab_server     2.16.1
    lazy-object-proxy     1.7.1
    MarkupSafe            2.1.1
    matplotlib-inline     0.1.6
    mccabe                0.6.1
    mistune               2.0.4
    multidict             6.0.2
    nbclassic             0.4.5
    nbclient              0.7.0
    nbconvert             7.2.2
    nbformat              5.7.0
    nest-asyncio          1.5.6
    nodeenv               1.7.0
    notebook              6.5.1
    notebook_shim         0.2.0
    packaging             21.3
    pandocfilters         1.5.0
    parso                 0.8.3
    pexpect               4.8.0
    pickleshare           0.7.5
    pip                   22.3
    platformdirs          2.5.2
    pluggy                1.0.0
    poetry-kernel         0.1.2
    prometheus-client     0.15.0
    prompt-toolkit        3.0.31
    psutil                5.9.3
    ptyprocess            0.7.0
    pure-eval             0.2.2
    pycodestyle           2.8.0
    pycparser             2.21
    pydantic              1.9.2
    pydocstyle            6.1.1
    pyflakes              2.4.0
    pygls                 0.12.2
    Pygments              2.13.0
    pylint                2.15.4
    pyparsing             3.0.9
    pyrsistent            0.18.1
    python-dateutil       2.8.2
    python-lsp-jsonrpc    1.0.0
    python-lsp-server     1.5.0
    pytoolconfig          1.2.2
    pytz                  2022.5
    pyzmq                 24.0.1
    requests              2.28.1
    rope                  1.3.0
    s3fs                  2022.10.0
    Send2Trash            1.8.0
    setuptools            58.1.0
    six                   1.16.0
    sniffio               1.3.0
    snowballstemmer       2.2.0
    soupsieve             2.3.2.post1
    stack-data            0.5.1
    terminado             0.16.0
    tinycss2              1.2.1
    toml                  0.10.2
    tomli                 2.0.1
    tomlkit               0.11.5
    tornado               6.2
    traitlets             5.5.0
    typeguard             2.13.3
    typing_extensions     4.4.0
    ujson                 5.5.0
    urllib3               1.26.12
    wcwidth               0.2.5
    webencodings          0.5.1
    websocket-client      1.4.1
    whatthepatch          1.0.2
    wrapt                 1.14.1
    yapf                  0.32.0
    yarl                  1.8.1
    zipp                  3.9.0

Command Line Output
[I 2022-10-22 01:20:01.693 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2022-10-22 01:20:01.699 ServerApp] jupyterlab | extension was successfully linked.
[I 2022-10-22 01:20:01.703 ServerApp] nbclassic | extension was successfully linked.
[I 2022-10-22 01:20:01.726 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2022-10-22 01:20:01.748 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2022-10-22 01:20:01.749 LabApp] JupyterLab extension loaded from /home/xx/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jupyterlab
[I 2022-10-22 01:20:01.749 LabApp] JupyterLab application directory is /home/xx/pyenv/versions/3.9.15/share/jupyter/lab
[I 2022-10-22 01:20:01.750 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-10-22 01:20:01.752 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-10-22 01:20:01.752 ServerApp] Serving notebooks from local directory: /home/catethos
[I 2022-10-22 01:20:01.752 ServerApp] Jupyter Server 1.21.0 is running at:
[I 2022-10-22 01:20:01.752 ServerApp] http://localhost:8888/lab?token=4c09ed4d869e9fbafce610f69acdadc7806116918dc4c774
[I 2022-10-22 01:20:01.752 ServerApp]  or http://127.0.0.1:8888/lab?token=4c09ed4d869e9fbafce610f69acdadc7806116918dc4c774
[I 2022-10-22 01:20:01.752 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-10-22 01:20:01.771 ServerApp] 

    To access the server, open this file in a browser:
        file:///home/xx/.local/share/jupyter/runtime/jpserver-4519-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=4c09ed4d869e9fbafce610f69acdadc7806116918dc4c774
     or http://127.0.0.1:8888/lab?token=4c09ed4d869e9fbafce610f69acdadc7806116918dc4c774
Opening in existing browser session.
[I 2022-10-22 01:20:05.331 LabApp] Build is up to date

Browser Output (recommended for all interface issues)
321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1 LSP.WidgetAdapter.EditorAdapter: TypeError: Cannot read properties of null (reading 'line')
    at Y.document_at_source_position (321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1:30301)
    at Proxy.document_at_root_position (321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1:164501)
    at ie.updateAfterChange (321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1:38205)
    at async 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1:45296
updateAfterChange @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
await in updateAfterChange (async)
(anonymous) @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
(anonymous) @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
Promise.then (async)
with_update_lock @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
document_changed @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
m @ index.es6.js:461
l @ index.es6.js:416
e.emit @ index.es6.js:99
maybe_emit_changed @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
(anonymous) @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
Promise.then (async)
(anonymous) @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
update_documents @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
update_documents @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
handle_cell_change @ 321.0176abf53bb1a24b854d.js?v=0176abf53bb1a24b854d:1
m @ index.es6.js:461
l @ index.es6.js:416
e.emit @ index.es6.js:99
_onOrderChanged @ celllist.js:520
m @ index.es6.js:461
l @ index.es6.js:416
e.emit @ index.es6.js:99
remove @ observablelist.js:232
remove @ celllist.js:302
(anonymous) @ actions.js:2005
b @ actions.js:2004
c @ actions.js:277
execute @ index.js:1476
e.execute @ index.es6.js:370
e._executeKeyBinding @ index.es6.js:530
e.processKeydownEvent @ index.es6.js:469
e.evtKeydown @ index.es6.js:361
e.handleEvent @ index.es6.js:317

Thanks for the help.