本文整理汇总了C#中Microsoft.CodeAnalysis.DocumentInfo类的典型用法代码示例。如果您正苦于以下问题:C# DocumentInfo类的具体用法?C# DocumentInfo怎么用?C# DocumentInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentInfo类属于Microsoft.CodeAnalysis命名空间,在下文中一共展示了DocumentInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddAdditionalDocumentUndoUnit
public AddAdditionalDocumentUndoUnit(
VisualStudioWorkspaceImpl workspace,
DocumentInfo docInfo,
SourceText text)
: base(workspace, docInfo, text)
{
}
开发者ID:TyOverby,项目名称:roslyn,代码行数:7,代码来源:VisualStudioWorkspaceImpl.AddAdditionalDocumentUndoUnit.cs
示例2: Create
public static DocumentState Create(
DocumentInfo info,
ParseOptions options,
HostLanguageServices language,
SolutionServices services)
{
var textSource = info.TextLoader != null
? CreateRecoverableText(info.TextLoader, info.Id, services)
: CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));
var treeSource = CreateLazyFullyParsedTree(
textSource,
GetSyntaxTreeFilePath(info),
options,
languageServices: language);
// remove any initial loader so we don't keep source alive
info = info.WithTextLoader(null);
return new DocumentState(
languageServices: language,
solutionServices: services,
info: info,
options: options,
textSource: textSource,
treeSource: treeSource);
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:27,代码来源:DocumentState.cs
示例3: AbstractAddDocumentUndoUnit
protected AbstractAddDocumentUndoUnit(
VisualStudioWorkspaceImpl workspace,
DocumentInfo docInfo,
SourceText text)
: base(workspace, docInfo.Id.ProjectId)
{
DocumentInfo = docInfo;
Text = text;
}
开发者ID:TyOverby,项目名称:roslyn,代码行数:9,代码来源:VisualStudioWorkspaceImpl.AbstractAddDocumentUndoUnit.cs
示例4: TextDocumentState
protected TextDocumentState(
SolutionServices solutionServices,
DocumentInfo info,
ValueSource<TextAndVersion> textSource)
{
this.solutionServices = solutionServices;
this.info = info;
this.textSource = textSource;
}
开发者ID:daking2014,项目名称:roslyn,代码行数:9,代码来源:TextDocumentState.cs
示例5: DocumentState
private DocumentState(
HostLanguageServices languageServices,
SolutionServices solutionServices,
DocumentInfo info,
ParseOptions options,
ValueSource<TextAndVersion> textSource,
ValueSource<TreeAndVersion> treeSource)
: base(solutionServices, info, textSource)
{
_languageServices = languageServices;
_options = options;
_treeSource = treeSource;
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:13,代码来源:DocumentState.cs
示例6: Create
public static TextDocumentState Create(DocumentInfo info, SolutionServices services)
{
var textSource = info.TextLoader != null
? CreateRecoverableText(info.TextLoader, info.Id, services, reportInvalidDataException: false)
: CreateStrongText(TextAndVersion.Create(SourceText.From(string.Empty, Encoding.UTF8), VersionStamp.Default, info.FilePath));
// remove any initial loader so we don't keep source alive
info = info.WithTextLoader(null);
return new TextDocumentState(
solutionServices: services,
info: info,
textSource: textSource);
}
开发者ID:daking2014,项目名称:roslyn,代码行数:14,代码来源:TextDocumentState.cs
示例7: DocumentState
private DocumentState(
HostLanguageServices languageServices,
SolutionServices solutionServices,
DocumentInfo info,
ParseOptions options,
ValueSource<TextAndVersion> textSource,
ValueSource<TreeAndVersion> treeSource)
{
this.languageServices = languageServices;
this.solutionServices = solutionServices;
this.info = info;
this.options = options;
this.textSource = textSource;
this.treeSource = treeSource;
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:15,代码来源:DocumentState.cs
示例8: CreateSimpleWorkspace
private void CreateSimpleWorkspace(out OmnisharpWorkspace workspace, out ChangeBufferService controller, out DocumentInfo document, string filename, string contents)
{
workspace = new OmnisharpWorkspace(new HostServicesBuilder(Enumerable.Empty<ICodeActionProvider>()));
controller = new ChangeBufferService(workspace);
var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(),
"ProjectNameVal", "AssemblyNameVal", LanguageNames.CSharp);
document = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), filename,
null, SourceCodeKind.Regular,
TextLoader.From(TextAndVersion.Create(SourceText.From(contents), VersionStamp.Create())),
filename);
workspace.AddProject(projectInfo);
workspace.AddDocument(document);
}
开发者ID:robbert229,项目名称:omnisharp-roslyn,代码行数:16,代码来源:BufferFacts.cs
示例9: CreateSimpleWorkspace
private void CreateSimpleWorkspace(out OmnisharpWorkspace workspace, out OmnisharpController controller, out DocumentInfo document, string filename, string contents)
{
workspace = new OmnisharpWorkspace();
controller = new OmnisharpController(workspace, null);
var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(),
"ProjectNameVal", "AssemblyNameVal", LanguageNames.CSharp);
document = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), filename,
null, SourceCodeKind.Regular,
TextLoader.From(TextAndVersion.Create(SourceText.From(contents), VersionStamp.Create())),
filename);
workspace.AddProject(projectInfo);
workspace.AddDocument(document);
}
开发者ID:tugberkugurlu,项目名称:omnisharp-roslyn,代码行数:16,代码来源:OmnisharpControllerFacts.cs
示例10: TextDocumentState
protected TextDocumentState(
SolutionServices solutionServices,
DocumentInfo info,
SourceText sourceTextOpt,
ValueSource<TextAndVersion> textAndVersionSource,
ValueSource<DocumentStateChecksums> lazyChecksums)
{
this.solutionServices = solutionServices;
this.info = info;
this.sourceTextOpt = sourceTextOpt;
this.textAndVersionSource = textAndVersionSource;
// for now, let it re-calculate if anything changed.
// TODO: optimize this so that we only re-calcuate checksums that are actually changed
_lazyChecksums = new AsyncLazy<DocumentStateChecksums>(ComputeChecksumsAsync, cacheResult: true);
}
开发者ID:TyOverby,项目名称:roslyn,代码行数:16,代码来源:TextDocumentState.cs
示例11: DocumentState
private DocumentState(
HostLanguageServices languageServices,
SolutionServices solutionServices,
DocumentInfo info,
ParseOptions options,
ValueSource<TextAndVersion> textSource,
ValueSource<TreeAndVersion> treeSource)
: base(solutionServices, info, textSource)
{
_languageServices = languageServices;
_options = options;
// If this is document that doesn't support syntax, then don't even bother holding
// onto any tree source. It will never be used to get a tree, and can only hurt us
// by possibly holding onto data that might cause a slow memory leak.
_treeSource = this.SupportsSyntaxTree
? treeSource
: ValueSource<TreeAndVersion>.Empty;
}
开发者ID:daking2014,项目名称:roslyn,代码行数:19,代码来源:DocumentState.cs
示例12: AddDocument
/// <summary>
/// Adds a document to the workspace.
/// </summary>
public Document AddDocument(DocumentInfo documentInfo)
{
if (documentInfo == null)
{
throw new ArgumentNullException(nameof(documentInfo));
}
this.OnDocumentAdded(documentInfo);
return this.CurrentSolution.GetDocument(documentInfo.Id);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:14,代码来源:AdhocWorkspace.cs
示例13: ApplyDocumentAdded
protected override void ApplyDocumentAdded(DocumentInfo info, SourceText text)
{
System.Diagnostics.Debug.Assert(_applyChangesProjectFile != null);
var project = this.CurrentSolution.GetProject(info.Id.ProjectId);
IProjectFileLoader loader;
if (this.TryGetLoaderFromProjectPath(project.FilePath, ReportMode.Ignore, out loader))
{
var extension = _applyChangesProjectFile.GetDocumentExtension(info.SourceCodeKind);
var fileName = Path.ChangeExtension(info.Name, extension);
var relativePath = (info.Folders != null && info.Folders.Count > 0)
? Path.Combine(Path.Combine(info.Folders.ToArray()), fileName)
: fileName;
var fullPath = GetAbsolutePath(relativePath, Path.GetDirectoryName(project.FilePath));
var newDocumentInfo = info.WithName(fileName)
.WithFilePath(fullPath)
.WithTextLoader(new FileTextLoader(fullPath, text.Encoding));
// add document to project file
_applyChangesProjectFile.AddDocument(relativePath);
// add to solution
this.OnDocumentAdded(newDocumentInfo);
// save text to disk
if (text != null)
{
this.SaveDocumentText(info.Id, fullPath, text, text.Encoding ?? Encoding.UTF8);
}
}
}
开发者ID:furesoft,项目名称:roslyn,代码行数:35,代码来源:MSBuildWorkspace.cs
示例14: OnAdditionalDocumentAdded
public void OnAdditionalDocumentAdded(DocumentInfo documentInfo) { }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:1,代码来源:ServiceHubRemoteHostClient.WorkspaceHost.cs
示例15: AddAdditionalDocument
public Solution AddAdditionalDocument(DocumentInfo documentInfo)
{
var newState = _state.AddAdditionalDocument(documentInfo);
if (newState == _state)
{
return this;
}
return new Solution(newState);
}
开发者ID:jkotas,项目名称:roslyn,代码行数:10,代码来源:Solution.cs
示例16: OnDocumentAdded
public void OnDocumentAdded(DocumentInfo documentInfo) { }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:1,代码来源:ServiceHubRemoteHostClient.WorkspaceHost.cs
示例17: AddDocument
/// <summary>
/// Adds a document to the workspace.
/// </summary>
public void AddDocument(DocumentInfo documentInfo)
{
if (documentInfo == null)
{
throw new ArgumentNullException("documentInfo");
}
this.OnDocumentAdded(documentInfo);
}
开发者ID:nagyist,项目名称:roslyn,代码行数:12,代码来源:CustomWorkspace.cs
示例18: GetSyntaxTreeFilePath
// This is the string used to represent the FilePath property on a SyntaxTree object.
// if the document does not yet have a file path, use the document's name instead in regular code
// or an empty string in script code.
private static string GetSyntaxTreeFilePath(DocumentInfo info)
{
if (info.FilePath != null)
{
return info.FilePath;
}
return info.SourceCodeKind == SourceCodeKind.Regular
? info.Name
: "";
}
开发者ID:RoryVL,项目名称:roslyn,代码行数:13,代码来源:DocumentState.cs
示例19: AddAdditionalDocument
public SolutionState AddAdditionalDocument(DocumentInfo documentInfo)
{
if (documentInfo == null)
{
throw new ArgumentNullException(nameof(documentInfo));
}
CheckContainsProject(documentInfo.Id.ProjectId);
CheckNotContainsAdditionalDocument(documentInfo.Id);
var oldProject = this.GetProjectState(documentInfo.Id.ProjectId);
var state = TextDocumentState.Create(
documentInfo,
_solutionServices);
var newProject = oldProject.AddAdditionalDocument(state);
return this.ForkProject(newProject);
}
开发者ID:tvsonar,项目名称:roslyn,代码行数:20,代码来源:SolutionState.cs
示例20: CreateRecoverableTextAndTree
// use static method so we don't capture references to this
private static Tuple<ValueSource<TextAndVersion>, TreeAndVersion> CreateRecoverableTextAndTree(
SyntaxNode newRoot, VersionStamp textVersion, VersionStamp treeVersion, Encoding encoding,
DocumentInfo info, ParseOptions options, ISyntaxTreeFactoryService factory, PreservationMode mode, SolutionServices solutionServices)
{
string filePath = info.FilePath;
SyntaxTree tree = null;
ValueSource<TextAndVersion> lazyTextAndVersion = null;
if ((mode == PreservationMode.PreserveIdentity) || !factory.CanCreateRecoverableTree(newRoot))
{
// its okay to use a strong cached AsyncLazy here because the compiler layer SyntaxTree will also keep the text alive once its built.
lazyTextAndVersion = new TreeTextSource(
new AsyncLazy<SourceText>(
c => tree.GetTextAsync(c),
c => tree.GetText(c),
cacheResult: true),
textVersion,
filePath);
tree = factory.CreateSyntaxTree(GetSyntaxTreeFilePath(info), options, encoding, newRoot);
}
else
{
// uses CachedWeakValueSource so the document and tree will return the same SourceText instance across multiple accesses as long
// as the text is referenced elsewhere.
lazyTextAndVersion = new TreeTextSource(
new CachedWeakValueSource<SourceText>(
new AsyncLazy<SourceText>(
c => BuildRecoverableTreeTextAsync(tree, encoding, c),
c => BuildRecoverableTreeText(tree, encoding, c),
cacheResult: false)),
textVersion,
filePath);
tree = factory.CreateRecoverableTree(info.Id.ProjectId, GetSyntaxTreeFilePath(info), options, lazyTextAndVersion, encoding, newRoot);
}
return Tuple.Create(lazyTextAndVersion, TreeAndVersion.Create(tree, treeVersion));
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:40,代码来源:DocumentState.cs
注:本文中的Microsoft.CodeAnalysis.DocumentInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论