當前位置: 首頁>>代碼示例>>C#>>正文


C# CodeAnalysis.DocumentInfo類代碼示例

本文整理匯總了C#中Microsoft.CodeAnalysis.DocumentInfo的典型用法代碼示例。如果您正苦於以下問題:C# DocumentInfo類的具體用法?C# DocumentInfo怎麽用?C# DocumentInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DocumentInfo類屬於Microsoft.CodeAnalysis命名空間,在下文中一共展示了DocumentInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Microsoft.CodeAnalysis.DocumentInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。