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

Add support for diagnostic tags from LSP 3.15 #736

Merged
merged 5 commits into from
Dec 31, 2021
Merged

Conversation

krassowski
Copy link
Member

@krassowski krassowski commented Dec 30, 2021

References

Add support for diagnostic tags (DiagnosticTag) from LSP 3.15.

Code changes

Adds two new CSS classes:

  • cm-lsp-diagnostic-tag-Unnecessary
  • cm-lsp-diagnostic-tag-Deprecated

moves severity determination code so it is not run if we don't need to update the diagnostic.

User-facing changes

  1. Strike-through is shown for deprecated items:
    Screenshot from 2021-12-30 16-27-32
  2. Unused code is faded out:
    TBD

Backwards-incompatible changes

None

Chores

  • linted
  • tested
  • documented
  • changelog entry

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch jupyter-lsp/jupyterlab-lsp/improve-diagnostics

@krassowski
Copy link
Member Author

It looks like inclusion of pyls-memestra breaks LSP diagnostics on Windows.

@krassowski
Copy link
Member Author

Yup, the lab.log shows:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "C:\Miniconda3\envs\test\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Miniconda3\envs\test\lib\threading.py", line 1371, in run
    self.function(*self.args, **self.kwargs)
  File "C:\Miniconda3\envs\test\lib\site-packages\pylsp\_utils.py", line 33, in run
    return func(*args, **kwargs)
  File "C:\Miniconda3\envs\test\lib\site-packages\pylsp\python_lsp.py", line 299, in lint
    flatten(self._hook('pylsp_lint', doc_uri, is_saved=is_saved))
  File "C:\Miniconda3\envs\test\lib\site-packages\pylsp\python_lsp.py", line 156, in _hook
    return hook_handlers(config=self.config, workspace=workspace, document=doc, **kwargs)
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_manager.py", line 327, in traced_hookexec
    return outcome.get_result()
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_result.py", line 33, in from_call
    result = func()
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_manager.py", line 324, in <lambda>
    lambda: oldcall(hook_name, hook_impls, kwargs, firstresult)
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "C:\Miniconda3\envs\test\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "C:\Miniconda3\envs\test\lib\site-packages\pyls_memestra\plugin.py", line 32, in pylsp_lint
    print("pyls_lint \U0001f414")
  File "C:\Miniconda3\envs\test\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f414' in position 10: character maps to <undefined>

Which is basically QuantStack/pyls-memestra#50

@krassowski krassowski merged commit 9784f08 into master Dec 31, 2021
@krassowski krassowski deleted the improve-diagnostics branch December 31, 2021 00:38
@krassowski krassowski mentioned this pull request Dec 31, 2021
4 tasks
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

Successfully merging this pull request may close these issues.

1 participant