Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON completion introduces unexpected character #1075

Open
Musaefendic opened this issue Apr 7, 2024 · 1 comment
Open

JSON completion introduces unexpected character #1075

Musaefendic opened this issue Apr 7, 2024 · 1 comment

Comments

@Musaefendic
Copy link

Description

Using the vscode-json-languageserver-bin server for auto-completion in JSON introduces unexpected characters.

Note: Following jupyterlab/jupyterlab#16129

Reproduce

1/ Create environment

conda create -n lsp install python=3.8 jupyterlab jupyterlab-lsp json-lsp

2/ Create an empty json based on a schema

{
    "$schema": "https://json.schemastore.org/tsconfig",
}

Add a line, type ", then press Tab to see the suggestions, select one options and press Enter
image

After pressing Enter , an object {} is inserted with an unexpected character $1
image

Expected behavior

The equivalent behavior in vscode, no unexpected character introduced

Context

  • Operating System and version: Windows 10
  • Browser and version: Chrome 123.0.6312.105 (Build officiel) (64 bits)
  • JupyterLab version: Version 4.1.5
  • Language server and version: jupyter-lsp-jupyterlab-lsp 5.1.0 & json (vscode-json-languageserver-bin)
Required: installed server extensions
(lsp) C:\Users\***>jupyter server extension list
Config dir: C:\Users\***\.jupyter

Config dir: C:\Users***\miniconda3\envs\lsp\etc\jupyter
jupyter_lsp enabled
- Validating jupyter_lsp...
jupyter_lsp 2.2.4 ok
jupyter_server_terminals enabled
- Validating jupyter_server_terminals...
jupyter_server_terminals 0.5.3 ok
jupyterlab enabled
- Validating jupyterlab...
Extension package jupyterlab took 0.2171s to import
jupyterlab 4.1.5 ok
notebook_shim enabled
- Validating notebook_shim...
notebook_shim ok

Config dir: C:\ProgramData\jupyter

Required: installed lab extensions
JupyterLab v4.1.5
C:\Users\***\miniconda3\envs\lsp\share\jupyter\labextensions
        jupyterlab_pygments v0.3.0 enabled ok (python, jupyterlab_pygments)
        @jupyter-lsp/jupyterlab-lsp v5.1.0 enabled ok (python, jupyterlab-lsp)

Disabled extensions:
@jupyterlab/completer-extension:base-service
@jupyterlab/fileeditor-extension:language-server
@jupyterlab/lsp-extension:settings
@jupyterlab/notebook-extension:language-server

Troubleshoot Output
$PATH:
        C:\Users\***\miniconda3\envs\lsp
        C:\Users\***\miniconda3\envs\lsp\Library\mingw-w64\bin
        C:\Users\***\miniconda3\envs\lsp\Library\usr\bin
        C:\Users\***\miniconda3\envs\lsp\Library\bin
        C:\Users\***\miniconda3\envs\lsp\Scripts
        C:\Users\***\miniconda3\envs\lsp\bin
        C:\Users\***\miniconda3\condabin
        C:\Windows\system32
        C:\Windows
        C:\Windows\System32\Wbem
        C:\Windows\System32\WindowsPowerShell\v1.0
        C:\Windows\System32\OpenSSH
        C:\Program Files\Git\cmd
        C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn
        C:\Program Files\Azure Data Studio\bin
        C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn
        C:\Program Files\Microsoft SQL Server\160\Tools\Binn
        C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn
        C:\Program Files\Microsoft SQL Server\160\DTS\Binn
        C:\Users\***\AppData\Local\Programs\Python\Python38\Scripts
        C:\Users\***\AppData\Local\Programs\Python\Python38
        C:\Users\***\AppData\Local\Programs\Python\Python37\Scripts
        C:\Users\***\AppData\Local\Programs\Python\Python37
        C:\Users\***\AppData\Local\Microsoft\WindowsApps
        .
        C:\Users\***\AppData\Local\Programs\Microsoft VS Code\bin
        C:\Program Files\Azure Data Studio\bin

sys.path:
C:\Users*\miniconda3\envs\lsp\Scripts
C:\Users*
\miniconda3\envs\lsp\python38.zip
C:\Users*\miniconda3\envs\lsp\DLLs
C:\Users*
\miniconda3\envs\lsp\lib
C:\Users*\miniconda3\envs\lsp
C:\Users*
\miniconda3\envs\lsp\lib\site-packages
C:\Users*\miniconda3\envs\lsp\lib\site-packages\win32
C:\Users*
\miniconda3\envs\lsp\lib\site-packages\win32\lib
C:\Users***\miniconda3\envs\lsp\lib\site-packages\Pythonwin

sys.executable:
C:\Users***\miniconda3\envs\lsp\python.exe

sys.version:
3.8.19 | packaged by conda-forge | (default, Mar 20 2024, 12:38:07) [MSC v.1929 64 bit (AMD64)]

platform.platform():
Windows-10-10.0.19045-SP0

where jupyter:
C:\Users***\miniconda3\envs\lsp\Scripts\jupyter.exe

pip list:
Package Version
------------------------- --------------
anyio 4.3.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
async-lru 2.0.4
attrs 23.2.0
Babel 2.14.0
backcall 0.2.0
beautifulsoup4 4.12.3
bleach 6.1.0
Brotli 1.1.0
cached-property 1.5.2
certifi 2024.2.2
cffi 1.16.0
charset-normalizer 3.3.2
colorama 0.4.6
comm 0.2.2
debugpy 1.8.1
decorator 5.1.1
defusedxml 0.7.1
entrypoints 0.4
exceptiongroup 1.2.0
executing 2.0.1
fastjsonschema 2.19.1
fqdn 1.5.1
h11 0.14.0
h2 4.1.0
hpack 4.0.0
httpcore 1.0.5
httpx 0.27.0
hyperframe 6.0.1
idna 3.6
importlib_metadata 7.1.0
importlib_resources 6.4.0
ipykernel 6.29.3
ipython 8.12.2
isoduration 20.11.0
jedi 0.19.1
Jinja2 3.1.3
json5 0.9.24
jsonpointer 2.4
jsonschema 4.21.1
jsonschema-specifications 2023.12.1
jupyter_client 8.6.1
jupyter_core 5.7.2
jupyter-events 0.10.0
jupyter-lsp 2.2.4
jupyter_server 2.13.0
jupyter_server_terminals 0.5.3
jupyterlab 4.1.5
jupyterlab-lsp 5.1.0
jupyterlab_pygments 0.3.0
jupyterlab_server 2.25.4
MarkupSafe 2.1.5
matplotlib-inline 0.1.6
mistune 3.0.2
nbclient 0.10.0
nbconvert 7.16.3
nbformat 5.10.4
nest_asyncio 1.6.0
notebook_shim 0.2.4
overrides 7.7.0
packaging 24.0
pandocfilters 1.5.0
parso 0.8.4
pickleshare 0.7.5
pip 24.0
pkgutil_resolve_name 1.3.10
platformdirs 4.2.0
prometheus_client 0.20.0
prompt-toolkit 3.0.42
psutil 5.9.8
pure-eval 0.2.2
pycparser 2.22
Pygments 2.17.2
PySocks 1.7.1
python-dateutil 2.9.0
python-json-logger 2.0.7
pytz 2024.1
pywin32 306
pywinpty 2.0.13
PyYAML 6.0.1
pyzmq 25.1.2
referencing 0.34.0
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.18.0
Send2Trash 1.8.2
setuptools 69.2.0
six 1.16.0
sniffio 1.3.1
soupsieve 2.5
stack-data 0.6.2
terminado 0.18.1
tinycss2 1.2.1
tomli 2.0.1
tornado 6.4
traitlets 5.14.2
types-python-dateutil 2.9.0.20240316
typing_extensions 4.11.0
typing-utils 0.1.0
uri-template 1.3.0
urllib3 2.2.1
wcwidth 0.2.13
webcolors 1.13
webencodings 0.5.1
websocket-client 1.7.0
wheel 0.43.0
win-inet-pton 1.1.0
zipp 3.17.0

Command Line Output
(lsp) C:\Users\***\LSP>jupyter lab
[I 2024-04-07 16:52:45.903 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-04-07 16:52:45.921 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-04-07 16:52:45.945 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-04-07 16:52:46.751 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-04-07 16:52:46.820 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-04-07 16:52:46.828 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-04-07 16:52:46.834 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-04-07 16:52:46.843 LabApp] JupyterLab extension loaded from C:\Users\***\miniconda3\envs\lsp\lib\site-packages\jupyterlab
[I 2024-04-07 16:52:46.864 LabApp] JupyterLab application directory is C:\Users\***\miniconda3\envs\lsp\share\jupyter\lab
[I 2024-04-07 16:52:46.875 LabApp] Extension Manager is 'pypi'.
[I 2024-04-07 16:52:47.360 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-04-07 16:52:47.360 ServerApp] The port 8888 is already in use, trying another port.
[I 2024-04-07 16:52:47.370 ServerApp] Serving notebooks from local directory: C:\Users\***\Documents\DEV\LSP
[I 2024-04-07 16:52:47.374 ServerApp] Jupyter Server 2.13.0 is running at:
[I 2024-04-07 16:52:47.375 ServerApp] http://localhost:8889/lab?token=238a6c705333adf5ef18de2a75e907da1e6567aca215393f
[I 2024-04-07 16:52:47.375 ServerApp]     http://127.0.0.1:8889/lab?token=238a6c705333adf5ef18de2a75e907da1e6567aca215393f
[I 2024-04-07 16:52:47.376 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-04-07 16:52:47.475 ServerApp]
To access the server, open this file in a browser:
    file:///C:/Users/***/AppData/Roaming/jupyter/runtime/jpserver-7088-open.html
Or copy and paste one of these URLs:
    http://localhost:8889/lab?token=238a6c705333adf5ef18de2a75e907da1e6567aca215393f
    http://127.0.0.1:8889/lab?token=238a6c705333adf5ef18de2a75e907da1e6567aca215393f

[I 2024-04-07 16:52:50.853 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, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin
[I 2024-04-07 16:52:54.241 LabApp] Build is up to date
[I 2024-04-07 16:53:02.235 ServerApp] Saving file at /untitled.json
[I 2024-04-07 16:53:06.811 ServerApp] Saving file at /untitled.json
[I 2024-04-07 16:53:13.176 ServerApp] Saving file at /untitled.json

Browser Output (recommended for all interface issues)
Paste the output from your browser JavaScript console replacing the text in here.

To learn how to open the developer tools in your browser:
https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#How_to_open_the_devtools_in_your_browser
If too many messages accumulated after many hours of working in JupyterLab,
consider refreshing the window and then reproducing the bug to reduce the noise in the logs.

@krassowski
Copy link
Member

This is a snippet completion. Apparently vscode-json-languageserver-bin is violating the LSP spec - it should not return snippet completions when client does not advertise support for these. I guess we should implement snippet support (#208) now that CodeMirror 6 migration headaches are over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants