本文整理汇总了C#中Microsoft.CodeAnalysis.SolutionServices类的典型用法代码示例。如果您正苦于以下问题:C# SolutionServices类的具体用法?C# SolutionServices怎么用?C# SolutionServices使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SolutionServices类属于Microsoft.CodeAnalysis命名空间,在下文中一共展示了SolutionServices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRecoverableText
protected static ValueSource<TextAndVersion> CreateRecoverableText(TextLoader loader, DocumentId documentId, SolutionServices services)
{
return new RecoverableTextAndVersion(
new AsyncLazy<TextAndVersion>(c => LoadTextAsync(loader, documentId, services, c), cacheResult: false),
services.TemporaryStorage,
services.TextCache);
}
示例2: SolutionState
private SolutionState(
BranchId branchId,
int workspaceVersion,
SolutionServices solutionServices,
SolutionId id,
string filePath,
IEnumerable<ProjectId> projectIds,
ImmutableDictionary<ProjectId, ProjectState> idToProjectStateMap,
ImmutableDictionary<ProjectId, CompilationTracker> projectIdToTrackerMap,
ImmutableDictionary<string, ImmutableArray<DocumentId>> linkedFilesMap,
ProjectDependencyGraph dependencyGraph,
VersionStamp version,
Lazy<VersionStamp> lazyLatestProjectVersion)
{
_branchId = branchId;
_workspaceVersion = workspaceVersion;
_id = id;
_filePath = filePath;
_solutionServices = solutionServices;
_projectIds = projectIds.ToImmutableReadOnlyListOrEmpty();
_projectIdToProjectStateMap = idToProjectStateMap;
_projectIdToTrackerMap = projectIdToTrackerMap;
_linkedFilesMap = linkedFilesMap;
_dependencyGraph = dependencyGraph;
_version = version;
_lazyLatestProjectVersion = lazyLatestProjectVersion;
CheckInvariants();
}
示例3: SolutionState
private SolutionState(
BranchId branchId,
int workspaceVersion,
SolutionServices solutionServices,
SolutionInfo solutionInfo,
IEnumerable<ProjectId> projectIds,
ImmutableDictionary<ProjectId, ProjectState> idToProjectStateMap,
ImmutableDictionary<ProjectId, CompilationTracker> projectIdToTrackerMap,
ImmutableDictionary<string, ImmutableArray<DocumentId>> linkedFilesMap,
ProjectDependencyGraph dependencyGraph,
Lazy<VersionStamp> lazyLatestProjectVersion)
{
_branchId = branchId;
_workspaceVersion = workspaceVersion;
_solutionServices = solutionServices;
_solutionInfo = solutionInfo;
_projectIds = projectIds.ToImmutableReadOnlyListOrEmpty();
_projectIdToProjectStateMap = idToProjectStateMap;
_projectIdToTrackerMap = projectIdToTrackerMap;
_linkedFilesMap = linkedFilesMap;
_dependencyGraph = dependencyGraph;
_lazyLatestProjectVersion = lazyLatestProjectVersion;
// when solution state is changed, we re-calcuate its checksum
_lazyChecksums = new AsyncLazy<SolutionStateChecksums>(ComputeChecksumsAsync, cacheResult: true);
CheckInvariants();
}
示例4: Solution
private Solution(
BranchId branchId,
int workspaceVersion,
SolutionServices solutionServices,
SolutionId id,
string filePath,
ImmutableList<ProjectId> projectIds,
ImmutableDictionary<ProjectId, ProjectState> idToProjectStateMap,
ImmutableDictionary<ProjectId, CompilationTracker> projectIdToTrackerMap,
ProjectDependencyGraph dependencyGraph,
VersionStamp version,
Lazy<VersionStamp> lazyLatestProjectVersion)
{
this.branchId = branchId;
this.workspaceVersion = workspaceVersion;
this.id = id;
this.filePath = filePath;
this.solutionServices = solutionServices;
this.projectIds = projectIds;
this.projectIdToProjectStateMap = idToProjectStateMap;
this.projectIdToTrackerMap = projectIdToTrackerMap;
this.dependencyGraph = dependencyGraph;
this.projectIdToProjectMap = ImmutableHashMap<ProjectId, Project>.Empty;
this.version = version;
this.lazyLatestProjectVersion = lazyLatestProjectVersion;
CheckInvariants();
}
示例5: ProjectState
public ProjectState(ProjectInfo projectInfo, HostLanguageServices languageServices, SolutionServices solutionServices)
{
Contract.ThrowIfNull(projectInfo);
Contract.ThrowIfNull(languageServices);
Contract.ThrowIfNull(solutionServices);
_languageServices = languageServices;
_solutionServices = solutionServices;
_projectInfo = FixProjectInfo(projectInfo);
_documentIds = _projectInfo.Documents.Select(d => d.Id).ToImmutableArray();
_additionalDocumentIds = _projectInfo.AdditionalDocuments.Select(d => d.Id).ToImmutableArray();
var docStates = ImmutableDictionary.CreateRange<DocumentId, DocumentState>(
_projectInfo.Documents.Select(d =>
new KeyValuePair<DocumentId, DocumentState>(d.Id,
CreateDocument(_projectInfo, d, languageServices, solutionServices))));
_documentStates = docStates;
var additionalDocStates = ImmutableDictionary.CreateRange<DocumentId, TextDocumentState>(
_projectInfo.AdditionalDocuments.Select(d =>
new KeyValuePair<DocumentId, TextDocumentState>(d.Id, TextDocumentState.Create(d, solutionServices))));
_additionalDocumentStates = additionalDocStates;
_lazyLatestDocumentVersion = new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentVersionAsync(docStates, additionalDocStates, c), cacheResult: true);
_lazyLatestDocumentTopLevelChangeVersion = new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentTopLevelChangeVersionAsync(docStates, additionalDocStates, c), cacheResult: true);
// 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<ProjectStateChecksums>(ComputeChecksumsAsync, cacheResult: true);
}
示例6: 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);
}
示例7: ProjectState
internal ProjectState(ProjectInfo projectInfo, HostLanguageServices languageServices, SolutionServices solutionServices)
{
Contract.ThrowIfNull(projectInfo);
Contract.ThrowIfNull(languageServices);
Contract.ThrowIfNull(solutionServices);
_languageServices = languageServices;
_solutionServices = solutionServices;
_projectInfo = FixProjectInfo(projectInfo);
_documentIds = _projectInfo.Documents.Select(d => d.Id).ToImmutableArray();
_additionalDocumentIds = this.ProjectInfo.AdditionalDocuments.Select(d => d.Id).ToImmutableArray();
var docStates = ImmutableDictionary.CreateRange<DocumentId, DocumentState>(
_projectInfo.Documents.Select(d =>
new KeyValuePair<DocumentId, DocumentState>(d.Id,
CreateDocument(this.ProjectInfo, d, languageServices, solutionServices))));
_documentStates = docStates;
var additionalDocStates = ImmutableDictionary.CreateRange<DocumentId, TextDocumentState>(
_projectInfo.AdditionalDocuments.Select(d =>
new KeyValuePair<DocumentId, TextDocumentState>(d.Id, TextDocumentState.Create(d, solutionServices))));
_additionalDocumentStates = additionalDocStates;
_lazyLatestDocumentVersion = new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentVersionAsync(docStates, additionalDocStates, c), cacheResult: true);
_lazyLatestDocumentTopLevelChangeVersion = new AsyncLazy<VersionStamp>(c => ComputeLatestDocumentTopLevelChangeVersionAsync(docStates, additionalDocStates, c), cacheResult: true);
}
示例8: CreateValueSource
public static ValueSource<Compilation> CreateValueSource(
Compilation compilation,
SolutionServices services)
{
return services.SupportsCachingRecoverableObjects
? new WeakConstantValueSource<Compilation>(compilation)
: (ValueSource<Compilation>)new ConstantValueSource<Compilation>(compilation);
}
示例9: TextDocumentState
protected TextDocumentState(
SolutionServices solutionServices,
DocumentInfo info,
ValueSource<TextAndVersion> textSource)
{
this.solutionServices = solutionServices;
this.info = info;
this.textSource = textSource;
}
示例10: 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;
}
示例11: CreateLazyFullyParsedTree
private static ValueSource<TreeAndVersion> CreateLazyFullyParsedTree(
ValueSource<TextAndVersion> newTextSource,
ProjectId cacheKey,
string filePath,
ParseOptions options,
HostLanguageServices languageServices,
SolutionServices solutionServices,
PreservationMode mode = PreservationMode.PreserveValue)
{
return new AsyncLazy<TreeAndVersion>(
c => FullyParseTreeAsync(newTextSource, cacheKey, filePath, options, languageServices, solutionServices, mode, c),
cacheResult: true);
}
示例12: 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);
}
示例13: 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;
}
示例14: 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);
}
示例15: ProjectState
private ProjectState(
ProjectInfo projectInfo,
ILanguageServiceProvider languageServices,
SolutionServices solutionServices,
ImmutableList<DocumentId> documentIds,
ImmutableDictionary<DocumentId, DocumentState> documentStates,
AsyncLazy<VersionStamp> lazyLatestDocumentVersion,
AsyncLazy<VersionStamp> lazyLatestDocumentTopLevelChangeVersion)
{
this.projectInfo = projectInfo;
this.solutionServices = solutionServices;
this.languageServices = languageServices;
this.documentIds = documentIds;
this.documentStates = documentStates;
this.lazyLatestDocumentVersion = lazyLatestDocumentVersion;
this.lazyLatestDocumentTopLevelChangeVersion = lazyLatestDocumentTopLevelChangeVersion;
}