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

#10026 Implement DocumentSymbolProviderMetadata #10811

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

ndoschek
Copy link
Contributor

@ndoschek ndoschek commented Feb 28, 2022

What it does

This PR adds the implementation for DocumentSymbolProviderMetadata and uses label in MonacoOutlineContribution:

  • Introduce DocumentSymbolProviderMetadata interface in theia.d.ts
  • Adapt register functions to pass on optional metadata
  • Adapt the MonacoOutlineContribution and use metadata label or plugin's displayName as root node if multiple providers are registered (aligned to behavior in VSCode)
  • Remove Theia's custom DocumentSymbolProvider for 'launch.json' files and reuse VSCode's provider (available via vscode-builtin-configuration-editing)

Contributed on behalf of STMicroelectronics

Signed-off-by: Nina Doschek ndoschek@eclipsesource.com

Fixes #10026

How to test

  1. Open a launch.json file in your workspace (e.g. https://github.com/eclipse-theia/theia/blob/master/.vscode/launch.json)
  2. Open the Outline View via menu View > Outline
  3. Comparable to VSCode, there are two providers registered:
    1. The plugin vscode-builtin-json-language-features
      Provides the JSON document outline under the root node JSON Language Features (built-in)
    2. The plugin vscode-builtin-configuration-editing
      Provides all launch configs as document symbols under the root node Launch Targets.
  4. It is shown that either the metadata label (in case of 3.ii.) is used as root node display name or if not available the plugin display name (in case of 3.i.).

Review checklist

Reminder for reviewers

@msujew
Copy link
Member

msujew commented Feb 28, 2022

@colin-grant-work Can you tell, whether this change is in conflict with your changes for the monaco uplift? If so, we should probably wait for your uplift to finish before merging/reviewing other monaco related changes.

@msujew msujew added outline issues related to the outline vscode issues related to VSCode compatibility labels Feb 28, 2022
@colin-grant-work
Copy link
Contributor

@msujew, at a glance, it looks like it'll only require modifying the references to monaco.Range to use imports to be compatible with the uplift, so I don't think it needs to wait - fixing the uplift once this is merged will be straightforward.

Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

The changes are looking really good. Happy that we're able to remove the adhoc document symbol provider for the launch.json :)

  • Opening the launch.json file shows two distinct document symbol providers
  • Other *.json files show the usual json symbols
  • Symbols for code (tested with *.ts) work as expected

A minor comment before this is ready to be merged.

packages/plugin-ext/src/plugin/languages.ts Outdated Show resolved Hide resolved
- Introduce DocumentSymbolProviderMetadata interface in theia.d.ts
- Adapt register functions to pass on optional metadata
- Adapt the MonacoOutlineContribution and use metadata label or plugin's displayName as root node if multiple providers are registered (aligned to behavior in VSCode)
- Remove Theia's custom DocumentSymbolProvider for 'launch.json' files and reuse VSCode's provider (available via vscode-builtin-configuration-editing)

Contributed on behalf of STMicroelectronics

Signed-off-by: Nina Doschek <ndoschek@eclipsesource.com>

Fixes eclipse-theia#10026
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

Thanks, looking good!

@msujew msujew merged commit 7fd85c0 into eclipse-theia:master Mar 1, 2022
@vince-fugnitto vince-fugnitto added this to the 1.24.0 milestone Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
outline issues related to the outline vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement DocumentSymbolProviderMetadata
4 participants