ashmind / mirrorsharp

MirrorSharp is a code editor <textarea> built on Roslyn and CodeMirror
BSD 2-Clause "Simplified" License
216 stars 40 forks source link

Add new document to the project #104

Open vrassouli opened 5 years ago

vrassouli commented 5 years ago

Is it possible to create a ISetOptionsFromClientExtension like what is mentioned at #83 , and adding some documents of code to the project?

session.Roslyn.Project.AddDocument is immutable, and as I could find, adding documents require the workspace!

ashmind commented 5 years ago

@vrassouli Thanks for asking! This is something I was planning to add/test explicitly, but haven't got to yet. You can definitely do the Roslyn part:

session.Roslyn.Project = session.Roslyn.Project.AddDocument(...).Project;

However the MirrorSharp part might expect exactly one document in some places, and may fail otherwise.

vrassouli commented 5 years ago

Thanks for your reply adding document this way, throws NotSupported exception: System.NotSupportedException: 'Adding documents is not supported.'