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

Release v1.1.0: LSP 3.17 support #377

Merged
merged 1 commit into from
Oct 2, 2023
Merged

Release v1.1.0: LSP 3.17 support #377

merged 1 commit into from
Oct 2, 2023

Conversation

tombh
Copy link
Collaborator

@tombh tombh commented Sep 24, 2023

Fixes #346 (LSP 3.17 support)

Is this all we need now for a release, to just bump the version number and all the automation takes care of the rest!? Only one way to find out 🤓

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly

@tombh tombh requested a review from alcarney September 24, 2023 18:56
@dimbleby
Copy link
Contributor

I tried running the unit tests at https://github.com/pappasam/jedi-language-server against main, and it didn't go well.

Principal problem I'm seeing is:

  File "/home/dch/pygls/pygls/capabilities.py", line 390, in _with_workspace_symbol
    value.resolve_provider = self._provider_options(WORKSPACE_SYMBOL_RESOLVE)
AttributeError: 'bool' object has no attribute 'resolve_provider'

presumably because True is the default value for self._provider_options(WORKSPACE_SYMBOL), but is not suitable here.

Similar looks to be the case in _with_diagnostic_provider().

I don't know if there are further problems behind these, I haven't tried fixing.

@dimbleby
Copy link
Contributor

By the way - apart from having more unit tests of course - this is the sort of thing that mypy is great for catching.

if you annotated _provider_options() as:

      @overload
      def _provider_options(self, feature: str) -> Union[Any, bool]:
          ...

      @overload
      def _provider_options(self, feature: str, default: T) -> Union[Any, T]:
          ...

where T = TypeVar("T") is defined earlier in the file, then

$ mypy pygls/capabilities.py
pygls/capabilities.py:309: error: Incompatible types in assignment (expression has type "Any | bool", variable has type "DocumentOnTypeFormattingOptions | None")  [assignment]
pygls/capabilities.py:400: error: Item "bool" of "Any | bool" has no attribute "resolve_provider"  [union-attr]
pygls/capabilities.py:437: error: Item "bool" of "Any | bool" has no attribute "workspace_diagnostics"  [union-attr]
pygls/capabilities.py:438: error: Incompatible types in assignment (expression has type "Any | bool", variable has type "DiagnosticOptions | DiagnosticRegistrationOptions | None")  [assignment]
Found 4 errors in 1 file (checked 1 source file)

I realise it's quite the undertaking to get this project mypy clean from its current state, but perhaps you will find it worthwhile to chip away at it.

@alcarney
Copy link
Collaborator

Thanks for catching it before the release went out!

@RossBencina
Copy link
Contributor

I'd argue that #383 should be merged prior to this PR, since it changes the interface to translating Positions.

@tombh
Copy link
Collaborator Author

tombh commented Oct 2, 2023

Shall we release then, or wait a few more days for any feedback?

@dimbleby Totally agree about the types. I've actually started exposing all the typing errors (according to Pyright) in my editor by default: https://github.com/openlawlibrary/pygls/blob/main/pyproject.toml#L81 And I try to fix as much as possible as I'm working on other things. But I'm thinking of just doing some dedicated typing work as well.

@dimbleby
Copy link
Contributor

dimbleby commented Oct 2, 2023

I don't expect to have any further comments on this, don't wait for me!

re typing: an approach that I've seen used successfully in taking a project from lots-of-errors to clean is the ratchet:

  • set up the mypy configuration so that it is strict, but with lots of exclusions as needed for individual files or particular warnings; or even for particular warnings in individual files
  • whenever you feel like spending time on such things: clean up some particular warning class, or file
  • remove the exclusion from the mypy configuration, so that the improvement can't be undone
  • repeat until there are no exclusions remaining

Copy link
Collaborator

@alcarney alcarney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we release then, or wait a few more days for any feedback?

I’m ready if you are :)

Fixes #346 (LSP 3.17 support)
@tombh tombh merged commit 85c39fb into main Oct 2, 2023
23 checks passed
@tombh tombh deleted the tombh/v1.1.0 branch October 2, 2023 20:11
@tombh
Copy link
Collaborator Author

tombh commented Oct 2, 2023

@dimbleby that's a much better idea, ratchets only let things go in one direction, nice 😏

@alcarney rebased aaaand released....we'll soon see 🤞

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.

Add remaining features for 3.17 support
4 participants