当前位置: 首页>>代码示例>>C#>>正文


C# ITextBuffer.GetFileName方法代码示例

本文整理汇总了C#中ITextBuffer.GetFileName方法的典型用法代码示例。如果您正苦于以下问题:C# ITextBuffer.GetFileName方法的具体用法?C# ITextBuffer.GetFileName怎么用?C# ITextBuffer.GetFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITextBuffer的用法示例。


在下文中一共展示了ITextBuffer.GetFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSmartTagActions

        public override IEnumerable<ISmartTagAction> GetSmartTagActions(JSONMember item, ITextBuffer buffer)
        {
            string directory = Path.GetDirectoryName(buffer.GetFileName());

            if (item.Value != null && item.Value.Text.Trim('"').Length > 0)
                yield return new UpdatePackageAction(item.UnquotedNameText, directory);
        }
开发者ID:XmlmXmlmX,项目名称:JSON-Intellisense,代码行数:7,代码来源:BowerUpdatePackage.cs

示例2: GetVersion

 public Version GetVersion(ITextBuffer textBuffer)
 {
     Version version = null;
     if (textBuffer != null)
     {
         bool fromCache = false;
         foreach (var buffer in textBuffer.GetContributingBuffers())
         {
             if (buffer.Properties.TryGetProperty(RazorSupportedRuntimeVersion2, out version))
             {
                 fromCache = true;
                 break;
             }
         }
         if (!fromCache)
         {
             var getExplicitWebPagesVersionMethod = _getExplicitWebPagesVersionMethod.Value;
             if (getExplicitWebPagesVersionMethod != null)
             {
                 var fileName = textBuffer.GetFileName();
                 var projectData = Microsoft.VisualStudio.Html.Package.Project.ProjectData.FromFileNameAndPath(fileName);
                 if (projectData != null)
                 {
                     var absolutePath = VsWebUrl.CreateAppUrl(projectData.Hierarchy, projectData.ItemID).AbsolutePath;
                     try
                     {
                         version = (Version)getExplicitWebPagesVersionMethod.Invoke(null, new object[] { absolutePath });
                     }
                     catch
                     {
                     }
                 }
             }
             textBuffer.Properties[RazorSupportedRuntimeVersion2] = version;
         }
         if (version != null)
         {
             if (_inner != null)
             {
                 var innerType = _inner.GetType();
                 var setCachedVersionMethod = _setCachedVersionMethodCache.GetOrAdd(innerType,
                     type => type.GetMethod("SetCachedVersion", BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(ITextBuffer), typeof(Version) }, null));
                 if (setCachedVersionMethod != null)
                 {
                     try
                     {
                         setCachedVersionMethod.Invoke(_inner, new object[] { textBuffer, version });
                     }
                     catch (TargetInvocationException)
                     {
                     }
                 }
             }
             return version;
         }
     }
     if (_inner != null)
         version = _inner.GetVersion(textBuffer);
     return version;
 }
开发者ID:drivenet,项目名称:aspnetrazor,代码行数:60,代码来源:RazorVersionDetector.cs

示例3: GetSmartTagActions

        public override IEnumerable<ISmartTagAction> GetSmartTagActions(JSONMember item, ITextBuffer buffer)
        {
            string directory = Path.GetDirectoryName(buffer.GetFileName());
            string node_module = Path.Combine(directory, "node_modules", item.UnquotedNameText);

            if (item.Value != null && item.Value.Text.Trim('"').Length > 0 && Directory.Exists(node_module))
            yield return new UpdatePackageAction(item.UnquotedNameText, directory);
        }
开发者ID:XmlmXmlmX,项目名称:JSON-Intellisense,代码行数:8,代码来源:NpmUpdatePackage.cs

示例4: GetErrors

        /// <summary>
        /// Gets the errors of the text buffer
        /// </summary>
        /// <param name="textBuffer"></param>
        /// <returns></returns>
        internal IList<ValidationError> GetErrors(ITextBuffer textBuffer)
        {
            var sink = new PyErrorListCompilerSink(textBuffer);
            var modules = new Microsoft.VisualStudio.IronPythonInference.Modules();
            modules.AnalyzeModule(sink, textBuffer.GetFileName(), textBuffer.CurrentSnapshot.GetText());

            return sink.Errors.ToList();
        }
开发者ID:kageyamaginn,项目名称:VSSDK-Extensibility-Samples,代码行数:13,代码来源:PyErrorListProvider.cs

示例5: GetSmartTagActions

        public override IEnumerable<ISmartTagAction> GetSmartTagActions(JSONMember item, ITextBuffer buffer)
        {
            // TODO: Check if the bower package is already installed and if so, don't show this SmartTag

            string directory = Path.GetDirectoryName(buffer.GetFileName());

            if (item.Value != null && item.Value.Text.Trim('"').Length > 0)
                yield return new InstallPackageAction(item, directory);
        }
开发者ID:XmlmXmlmX,项目名称:JSON-Intellisense,代码行数:9,代码来源:BowerInstallPackage.cs

示例6: TryCreateCompletionSource

 public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer) {
     var filename = textBuffer.GetFileName();
     if (filename != null) {
         var project = DjangoPackage.GetProject(_serviceProvider, filename);
         if (project != null) {
             return new DjangoCompletionSource(_glyphService, project.Analyzer, _serviceProvider, textBuffer);
         }
     }
     return null;
 }
开发者ID:RussBaz,项目名称:PTVS,代码行数:10,代码来源:DjangoCompletionSourceProvider.cs

示例7: TryCreateCompletionSource

 public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
 {
     string filename = System.IO.Path.GetFileName(textBuffer.GetFileName());
     var textType = RobotsTxtClassifierProvider.GetTextType(filename);
     if (textType == TextType.Robots || textType == TextType.Humans)
     {
         return new RobotsTxtCompletionSource(textBuffer);
     }
     return null;
 }
开发者ID:venux,项目名称:WebEssentials2015,代码行数:10,代码来源:RobotsCompletionSource.cs

示例8: TryCreateCompletionSource

 public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
 {
     string filename = System.IO.Path.GetFileName(textBuffer.GetFileName());
     var textType = DockerfileClassifierProvider.GetTextType(filename);
     if (textType == TextType.Dockerfile)
     {
         return new DockerfileCompletionSource(textBuffer);
     }
     return null;
 }
开发者ID:venux,项目名称:WebEssentials2015,代码行数:10,代码来源:DockerfileCompletionSource.cs

示例9: UnusedCssClassifier

        internal UnusedCssClassifier(IClassificationTypeRegistryService registry, ITextBuffer buffer)
        {
            var currentFile = buffer.GetFileName().ToLowerInvariant();
            _buffer = buffer;
            _decClassification = registry.GetClassificationType(UnusedCssClassificationTypes.Declaration);

            if (!string.IsNullOrEmpty(currentFile))
            {
                UsageRegistry.UsageDataUpdated += ResyncClassificationSpans;
            }
        }
开发者ID:robert-hoffmann,项目名称:WebEssentials2013,代码行数:11,代码来源:UnusedRuleClassifier.cs

示例10: TryCreateCompletionSource

        public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
        {
            string filename = System.IO.Path.GetFileName(textBuffer.GetFileName());

            if (PaketClassifierProvider.IsPaketFile(filename))
            {
                return new PaketCompletionSource(glyphService, textBuffer, NavigatorService.GetTextStructureNavigator(textBuffer));
            }

            return null;
        }
开发者ID:dungpa,项目名称:Paket.VisualStudio,代码行数:11,代码来源:PaketCompletionSourceProvider.cs

示例11: AddItem

        public SourceItem AddItem(ITextBuffer textBuffer)
        {
            SourceItem srcItem = null;

            if (textBuffer == null)
                return null;

            string filepath = textBuffer.GetFileName();
            if (!_sources.ContainsKey(filepath))
            {
                srcItem = new SourceItem(textBuffer);
                _sources.Add(filepath, srcItem);
            }

            return srcItem;
        }
开发者ID:smartmobili,项目名称:parsing,代码行数:16,代码来源:SourceAnalyzer.cs

示例12: GetClassifier

        public IClassifier GetClassifier(ITextBuffer textBuffer)
        {
            string fileName = textBuffer.GetFileName();

            if (string.IsNullOrEmpty(fileName))
                return null;

            if (Path.GetFileName(fileName).Equals("gulpfile.js", StringComparison.OrdinalIgnoreCase))
            {
                return textBuffer.Properties.GetOrCreateSingletonProperty(() => new TaskClassifier(Registry, "gulp.task(", _gulp));
            }
            else if (Path.GetFileName(fileName).Equals("gruntfile.js", StringComparison.OrdinalIgnoreCase))
            {
                return textBuffer.Properties.GetOrCreateSingletonProperty(() => new TaskClassifier(Registry, "grunt.registerTask(", _grunt));
            }

            return null;
        }
开发者ID:venux,项目名称:WebEssentials2015,代码行数:18,代码来源:TaskClassifierProvider.cs

示例13: ProjectBlockCompletionContext

        public ProjectBlockCompletionContext(DjangoAnalyzer analyzer, ITextBuffer buffer)
            : base(analyzer, buffer, buffer.GetFileName()) {

            var doc = HtmlEditorDocument.FromTextBuffer(buffer);
            if (doc == null) {
                return;
            }

            var artifacts = doc.HtmlEditorTree.ArtifactCollection;
            foreach (var artifact in artifacts.OfType<TemplateBlockArtifact>()) {
                var artifactText = doc.HtmlEditorTree.ParseTree.Text.GetText(artifact.InnerRange);
                artifact.Parse(artifactText);
                if (artifact.Block != null) {
                    var varNames = artifact.Block.GetVariables();
                    foreach (var varName in varNames) {
                        AddLoopVariable(varName);
                    }
                }
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:20,代码来源:ProjectBlockCompletionContext.cs

示例14: GetSmartTagActions

 public override IEnumerable<ISmartTagAction> GetSmartTagActions(JSONMember item, ITextBuffer buffer)
 {
     string directory = Path.GetDirectoryName(buffer.GetFileName());
     yield return new UpdatePackageAction(item.UnquotedNameText, directory);
 }
开发者ID:nycdotnet,项目名称:JSON-Intellisense,代码行数:5,代码来源:BowerUpdatePackage.cs

示例15: ReplaceUrlValue

 private static void ReplaceUrlValue(string fileName, ITextBuffer buffer, AttributeNode src)
 {
     string relative = FileHelpers.RelativePath(buffer.GetFileName(), fileName);
     Span span = new Span(src.ValueRangeUnquoted.Start, src.ValueRangeUnquoted.Length);
     buffer.Replace(span, relative.ToLowerInvariant());
 }
开发者ID:Gordon-Beeming,项目名称:WebEssentials2013,代码行数:6,代码来源:Base64DecodeSmartTag.cs


注:本文中的ITextBuffer.GetFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。