Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

[TextEditor] Allow extensions to opt file types into new editor #7872

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

mhutch
Copy link
Member

@mhutch mhutch commented Jun 11, 2019

This adds a new extension point that extensions can use to opt individual file types into the new editor, optionally controlled by feature flags.

This means that extensions can light up new file types in the new editor without changing the new editor itself.

Copy link
Contributor

@garuma garuma left a comment

Choose a reason for hiding this comment

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

👍

@abock
Copy link
Contributor

abock commented Jun 12, 2019

FYI, the plan by 8.3 is for the new editor to blacklist types it cannot open (e.g. F#) instead of whitelist types it can. For 8.2 we will likely do this, and also blacklist web editor files until we light them up (because we will have TextMate support as generic fallback).

<Extension path="/MonoDevelop/TextEditor/SupportedFileTypes">
<SupportedFileType id="csharp" extensions=".cs,.csx" />
<SupportedFileType id="xaml" extensions=".xaml" FeatureSwitch="DesignersNewEditor" />
<SupportedFileType id="androidxaml" extensions=".xml,.axml" BuildAction="AndroidResource" FeatureSwitch="DesignersNewEditor" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a typo? androidxaml we already confuse people enough with the silly .axml.

Copy link
Member Author

@mhutch mhutch Jun 12, 2019

Choose a reason for hiding this comment

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

yeah, stray a, will remove

@mhutch
Copy link
Member Author

mhutch commented Jun 12, 2019

@abock should we merge this in the meantime? I imagine it would still be useful as a mechanism to allow the blocklisted extensions (F#, generic XML, ASPX, MSBuild, .addin.xml, etc) to override the block smoothly when transitioning over.

@abock abock added the Area: VS Text Editor For issues and pull requests concerning the new native Cocoa VS Text Editor in Visual Studio for Mac label Jun 12, 2019
@DavidKarlas
Copy link
Member

@mhutch yes, merge this and I will rebase textmate on this

@mhutch
Copy link
Member Author

mhutch commented Jun 13, 2019

Failures look completely unrelated. Ok to merge?

@abock
Copy link
Contributor

abock commented Jun 13, 2019

@slluis care to review?

@slluis
Copy link
Member

slluis commented Jun 13, 2019

It looks good to me.

}

bool supported = false;
var nodes = Mono.Addins.AddinManager.GetExtensionNodes<SupportedFileTypeExtensionNode> ("/MonoDevelop/TextEditor/SupportedFileTypes");
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should cache this and listen to extension node change events? No use querying this every time.

Copy link
Member Author

@mhutch mhutch Jun 13, 2019

Choose a reason for hiding this comment

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

I don't think that's necessary, it's not particularly expensive. The main value of the event is to cache derived data, and we don't have any of that here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mhutch thoughts? Looks like this does rebuild a list on each call.

Copy link
Contributor

Choose a reason for hiding this comment

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

Batch opening docs will cause wasteful processing over here. Imo, switch to extension node events here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@Therzok Therzok left a comment

Choose a reason for hiding this comment

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

Approved, added one more small improvement for caching extension nodes and listening for changes.

This adds a new extension point that extensions can use to
opt individual file types into the new editor, optionally
controlled by feature flags.

This means that extensions can light up new file types in the
new editor without changing the new editor itself.
@abock
Copy link
Contributor

abock commented Jun 13, 2019

Test failure is Xamarin.Forms timing out. Something about Java.

@abock abock merged commit ed3ca8c into mono:master Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: VS Text Editor For issues and pull requests concerning the new native Cocoa VS Text Editor in Visual Studio for Mac
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants