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

Stub implementation of proposed API for multiDocumentHighlightProvider. #13248

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

rschnekenbu
Copy link
Contributor

What it does

This PR stubs the proposed API multiDocumentHighlightProvider introduced in VS Code 1.85. This API cannot be implemented before a new monaco upgrade (at least 1.85 version).

Fixes #13232

Contributed on behalf of STMicroelectronics

How to test

  • On current master, install the 1.85.1 version of typescript builtin extensions. This archive contains both typescript & typescript language feature extensions and it is based on 1.85.1 vscode tag: typescript-builtins-1.85.1.zip
  • editing a typescript file will show an error in the console:
    Promise rejection not handled in one second: TypeError: s.languages.registerMultiDocumentHighlightProvider is not a function , reason: TypeError: s.languages.registerMultiDocumentHighlightProvider is not a function plugin-host.js:2976 With stack trace: TypeError: s.languages.registerMultiDocumentHighlightProvider is not a function at Object.$6b (/home/remi/.theia/deployedPlugins/typescript-language-features-1.85.1/extension/dist/extension.js:2:328653) at /home/remi/.theia/deployedPlugins/typescript-language-features-1.85.1/extension/dist/extension.js:2:423494 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Promise.all (index 6) at async f.m (/home/remi/.theia/deployedPlugins/typescript-language-features-1.85.1/extension/dist/extension.js:2:422900)
  • Now switch to this branch. This error message won't show up anymore.

Follow-ups

Implement the feature once monaco upgrade >= 1.85 is done.

Review checklist

Reminder for reviewers

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

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

Just one suggestion.

@@ -916,6 +917,10 @@ export function createAPIFactory(
registerDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.DocumentHighlightProvider): theia.Disposable {
return languagesExt.registerDocumentHighlightProvider(selector, provider, pluginToPluginInfo(plugin));
},
/** @stubbed proposed API */
registerMultiDocumentHighlightProvider(selector: theia.DocumentSelector, provider: theia.MultiDocumentHighlightProvider): theia.Disposable {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to make this work in the future, we should mark it with @monaco-uplift.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this annotation here:

* @monaco-uplift: wait until API is available in Monaco API (1.85.0+)

Should I also add it to this doc?

Copy link
Contributor

Choose a reason for hiding this comment

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

I try to do as few changes to the api.d.ts files we take from VS Code because it makes it easier to maintain them, IMO (diff, etc.). Unless this is a general convention, I would prefer the @monaco-uplift annotatio where we put the stub implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for explanation, @tsmaeder.
I have rebased and updated my changes, as this is a trivial fix and there was the usual conflict with the changelog. The monaco uplift annotation has been moved to plugin-context file.

fix eclipse-theia#13232

Contributed on behalf of STMicroelectronics

Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
@rschnekenbu
Copy link
Contributor Author

Wrong formatting, I pushed an updated version.

@tsmaeder tsmaeder merged commit 59ea819 into eclipse-theia:master Jan 15, 2024
14 checks passed
@jfaltermeier jfaltermeier added this to the 1.46.0 milestone Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[vscode] support proposed API multiDocumentHighlightProvider introduced with vscode 1.85
3 participants