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

Refactor Roles Support #495

Merged
merged 4 commits into from
Nov 28, 2022
Merged

Refactor Roles Support #495

merged 4 commits into from
Nov 28, 2022

Conversation

alcarney
Copy link
Member

@alcarney alcarney commented Nov 27, 2022

Similar to #444 and #453, this introduces RoleLanguageFeatures as the preferred method of extending role support moving forward. The following methods are currently supported

  • complete_targets called when generating role target completion items
  • find_target_definitions used to implement goto definition for role targets
  • get_implementation used to get the implementation of a role given its name
  • index_roles used to tell the language server which roles exist
  • resolve_target_link used to implement document links for role targets
  • suggest_roles called when generating role completion suggestions

This should allow for features like #464 to be implemented

As a result the following methods/protocols have been deprecated and will be removed in v1.0

  • TargetDefinition
  • TargetCompletion
  • TargetLink
  • Roles.add_target_definition_provider()
  • Roles.add_target_link_provider()
  • Roles.add_target_completion_provider()
  • RstLanguageServer.get_roles()
  • SphinxLanguageServer.get_domain()
  • SphinxLanguageServer.get_domains()
  • SphinxLanguageServer.get_roles()
  • SphinxLanguageServer.get_role_target_types()
  • SphinxLanguageServer.get_role_targets()
  • SphinxLanguageServer.get_intersphinx_targets()
  • SphinxLanguageServer.has_intersphinx_targets()
  • SphinxLanguageServer.get_intersphinx_projects()

Closes #416

@alcarney alcarney force-pushed the roles-refactor branch 3 times, most recently from 06dd928 to 5793222 Compare November 28, 2022 19:29
@alcarney alcarney marked this pull request as ready for review November 28, 2022 19:29
Following on from the work on ``DirectiveLanguageFeatures`` a similar
refactoring has been performed for roles.

`RoleLanguageFeatures` are now responsible for all the 'smarts' behind
LSP features with the `Roles` language feature providing the framework
within which they operate.

Features can currently implement the following methods

- ``complete_targets`` called when generating role target completion
  items
- ``find_target_definitions`` used to implement goto definition for role
  targets
- ``get_implementation`` used to get the implementation of a role given
  its name
- ``index_roles`` used to tell the language server which roles exist
- ``resolve_target_link`` used to implement document links for role
  targets
- ``suggest_roles`` called when generating role completion suggestions

The existing "provider" approach has been deprecated along with a number
of methods on the base lanaguage servers all of which will be removed in
the ``v1.0`` release
This replaces the `get_roles()` method on the base `RstLanguageServer`
and is responsible for providing support for the roles that come with
vanilla docutils
This ports the existing Sphinx domain and intersphinx roles support to
dedicated language features.

Additionally, the language server will generate completions for both the
short (`:func:`) and long (`:py:func:`) names of roles in the primary
and standard Sphinx domains.
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.

Include prefix part in primary domain
1 participant