// Called by us to update entries public override void UpdateFileInfo(string projectFilePath, DynamicDocumentContainer documentContainer) { if (projectFilePath == null) { throw new ArgumentNullException(nameof(projectFilePath)); } if (documentContainer == null) { throw new ArgumentNullException(nameof(documentContainer)); } // There's a possible race condition here where we're processing an update // and the project is getting unloaded. So if we don't find an entry we can // just ignore it. var key = new Key(projectFilePath, documentContainer.FilePath); if (_entries.TryGetValue(key, out var entry)) { lock (entry.Lock) { entry.SupportsSuppression = true; entry.Current = CreateInfo(key, documentContainer); } Updated?.Invoke(this, documentContainer.FilePath); } }
private DynamicFileInfo CreateInfo(Key key, DynamicDocumentContainer document) { var filename = key.FilePath + ".g.cs"; var textLoader = document.GetTextLoader(filename); return(new DynamicFileInfo(filename, SourceCodeKind.Regular, textLoader, _factory.Create(document))); }
public override IDocumentServiceProvider Create(DynamicDocumentContainer documentContainer) { if (documentContainer == null) { throw new ArgumentNullException(nameof(documentContainer)); } return(new RazorDocumentServiceProvider(documentContainer)); }
// Called by us to update LSP document entries public override void UpdateLSPFileInfo(Uri documentUri, DynamicDocumentContainer documentContainer) { if (documentUri is null) { throw new ArgumentNullException(nameof(documentUri)); } if (documentContainer is null) { throw new ArgumentNullException(nameof(documentContainer)); } var filePath = documentUri.GetAbsoluteOrUNCPath().Replace('/', '\\'); KeyValuePair <Key, Entry>?associatedKvp = null; foreach (var entry in _entries) { if (FilePathComparer.Instance.Equals(filePath, entry.Key.FilePath)) { associatedKvp = entry; break; } } if (associatedKvp == null) { return; } var associatedKey = associatedKvp.Value.Key; var associatedEntry = associatedKvp.Value.Value; lock (associatedEntry.Lock) { associatedEntry.SupportsSuppression = false; associatedEntry.Current = CreateInfo(associatedKey, documentContainer); } Updated?.Invoke(this, filePath); }
public abstract IDocumentServiceProvider Create(DynamicDocumentContainer documentContainer);
public override void UpdateLSPFileInfo(Uri documentUri, DynamicDocumentContainer documentContainer) { _dynamicDocuments[documentContainer.FilePath] = documentContainer; }
public override void UpdateFileInfo(string projectFilePath, DynamicDocumentContainer documentContainer) { _dynamicDocuments[documentContainer.FilePath] = documentContainer; }
public RazorDocumentServiceProvider(DynamicDocumentContainer documentContainer) { _documentContainer = documentContainer; _lock = new object(); }
public override void UpdateLSPFileInfo(Uri documentUri, DynamicDocumentContainer documentContainer) => throw new NotImplementedException();