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

[Plugin-API] Apply ResourceLabelFormatter API #8187

Merged
merged 1 commit into from
Aug 6, 2020
Merged

Conversation

vinokurig
Copy link
Contributor

@vinokurig vinokurig commented Jul 16, 2020

Signed-off-by: Igor Vinokur ivinokur@redhat.com

What it does

Apply registerResourceLabelFormatter vscode Plugin-API function. It allows plugins to register a custom resource label formatters that specify how to display URIs. The test plugin registers a formatter:

theia.workspace.registerResourceLabelFormatter({
            scheme: 'file',
            formatting: {
                label: '${path} (formated)',
                separator: '/',
                tildify: true
            }
        });
    }));

CQ: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=22392

How to test

  1. Download the test plugin and put it to the plugins directory.

  2. Start Theia workspace with some git project

  3. Open some file.

  4. Point the mouse cursor to the opened editor tab, see the tooltip:
    Screenshot from 2020-07-29 18-17-41

  5. Run F1 => Register Resource label formatter

  6. Point the mouse cursor to the opened editor tab, see the tooltip that shows the formatted URI, which is added by the registered formatter:
    Screenshot from 2020-07-29 18-17-02

  7. Run F1 => Unregister formatter and see the original tooltip.

Review checklist

Reminder for reviewers

fixes #7946

@vinokurig vinokurig added plug-in system issues related to the plug-in system vscode issues related to VSCode compatibility labels Jul 16, 2020
@vinokurig
Copy link
Contributor Author

@eclipse-theia/plugin-system @eclipse-theia/core @akosyakov any updates?

@akosyakov
Copy link
Member

It should be used to replace FileSystemUtils.tildifyPath correct?

@akosyakov akosyakov added the CQ Required (deprecated) issues requiring a CQ (contributor questionnaire) label Jul 28, 2020
@vinokurig vinokurig force-pushed the theia-7946 branch 2 times, most recently from edc36d6 to b32a86a Compare July 29, 2020 14:10
@akosyakov
Copy link
Member

@vinokurig It looks better, could you rebase please, address comments and squash commits (somehow some commit got changes from unrelated commits, hard to understad what they do). I will test then.

@vinokurig vinokurig force-pushed the theia-7946 branch 3 times, most recently from 02ae8a8 to 52fc292 Compare August 4, 2020 13:46
@vinokurig
Copy link
Contributor Author

@akosyakov I squashed the commits, could you please review again

separator: '/' | '\\' | '';
tildify?: boolean;
normalizeDriveLetter?: boolean;
workspaceSuffix?: string;
Copy link
Member

Choose a reason for hiding this comment

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

it is never used, did we forget some logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the leftovers. In vscode it is used for the getWorkspaceLabel() function, but we are using only the getLongName() function

Copy link
Member

@akosyakov akosyakov Aug 5, 2020

Choose a reason for hiding this comment

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

I think WorkspaceUriLabelProviderContribution.getLongName should respect it. That's a reason why we introduced workspace aware provider. We could handle it with a follow-up PR though. Please file an issue.

@akosyakov
Copy link
Member

I could not find code which respects static resourceLabelFormatters contributions: https://code.visualstudio.com/api/references/contribution-points#contributes.resourceLabelFormatters

@akosyakov
Copy link
Member

Code-wise looks good. With which version of git extension do you test? The latest does not work.

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

Unfortunately it is not feasible to verify with the git extension. A version which registers the label formatter does not work in Theia.

I've tested with the proposed sample and it worked as in How to test section. I've aslo verified that without registered formatters there are not regressions.

Please clean up the history, file a follow-up issue to support workspacePrefix API and merge. Thank you!

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CQ Required (deprecated) issues requiring a CQ (contributor questionnaire) plug-in system issues related to the plug-in system vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Plugin API] Apply workspace.registerResourceLabelFormatter function
3 participants