/// <summary> /// Initializes a new instance of the <see cref="AltaxoWorkspaceBase"/> class. /// </summary> /// <param name="roslynHost">The roslyn host.</param> /// <param name="staticReferences">The static references, i.e. project references that are not stated in the code by #r statements.</param> /// <param name="workingDirectory">The working directory. Is used only for script workspaces, otherwise, it can be null.</param> public AltaxoWorkspaceBase(RoslynHost roslynHost, IEnumerable <System.Reflection.Assembly> staticReferences, string workingDirectory) : this( roslynHost, staticReferences?.Select(ass => roslynHost.CreateMetadataReference(ass.Location)), workingDirectory) { }
public AltaxoWorkspaceForCSharpRegularDll( RoslynHost roslynHost, string workingDirectory, IEnumerable <System.Reflection.Assembly> staticReferences) : base(roslynHost, staticReferences, workingDirectory) { }
public AltaxoWorkspaceForCSharpRegularDll( RoslynHost roslynHost, string workingDirectory, IEnumerable <MetadataReference> staticReferences) : base(roslynHost, staticReferences, workingDirectory) { }
/// <summary> /// Initializes a new instance of the <see cref="AltaxoWorkspaceBase"/> class. /// </summary> /// <param name="roslynHost">The roslyn host.</param> /// <param name="staticReferences">The static references, i.e. project references that are not stated in the code by #r statements.</param> /// <param name="workingDirectory">The working directory. Is used only for script workspaces, otherwise, it can be null.</param> public AltaxoWorkspaceBase(RoslynHost roslynHost, IEnumerable <MetadataReference> staticReferences, string workingDirectory) : base(roslynHost.MefHost, WorkspaceKind.Host) { RoslynHost = roslynHost; WorkingDirectory = workingDirectory; StaticReferences = staticReferences.ToImmutableArray(); PreprocessorSymbols = DefaultPreprocessorSymbols; ProjectId = CreateInitialProject(); }
public CodeEditorViewAdapterCSharp(AltaxoWorkspaceBase workspace, Microsoft.CodeAnalysis.DocumentId documentID, RoslynSourceTextContainerAdapter sourceText) { Workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); DocumentId = documentID ?? throw new ArgumentNullException(nameof(documentID)); SourceTextAdapter = sourceText ?? throw new ArgumentNullException(nameof(sourceText)); _roslynHost = workspace.RoslynHost; SourceTextAdapter.TextChanged += EhSourceTextAdapter_TextChanged; HighlightingColorizer = new SemanticHighlighting.SemanticHighlightingColorizer(Workspace, DocumentId); QuickInfoProvider = _roslynHost.GetService <QuickInfo.IQuickInfoProvider>(); FoldingStrategy = new SyntaxTreeFoldingStrategy(); BraceMatchingService = _roslynHost.GetService <IBraceMatchingService>(); ReferenceHighlightService = new ReferenceHighlighting.CSharp.CSharpDocumentHighlightsService(); CompletionProvider = new Completion.CodeEditorCompletionProvider(_roslynHost, Workspace, DocumentId); RenamingService = new Renaming.RenamingService(); IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(); LiveDocumentFormatter = new LiveDocumentFormatterCSharp(); ExternalHelpProvider = new ExternalHelp.ExternalHelpProvider(); Workspace.SubscribeToDiagnosticsUpdateNotification(DocumentId, EhDiagnosticsUpdated); }
protected virtual MetadataReference ResolveReference(string name) { if (File.Exists(name)) { return(RoslynHost.CreateMetadataReference(name)); } try { var assemblyName = GlobalAssemblyCache.Instance.ResolvePartialName(name); if (assemblyName == null) { return(null); } var assembly = Assembly.Load(assemblyName.ToString()); return(RoslynHost.CreateMetadataReference(assembly.Location)); } catch (Exception) { return(null); } }
public static void InitializeInstance(IEnumerable <Assembly> additionalAssembliesToIncludeInComposition = null) { Instance = new RoslynHost(additionalAssembliesToIncludeInComposition); }
public AltaxoWorkspaceForCSharpScripts(RoslynHost roslynHost, string workingDirectory, IEnumerable <MetadataReference> staticReferences) : base(roslynHost, staticReferences, workingDirectory) { _referencesDirectives = new ConcurrentDictionary <string, DirectiveInfo>(); }