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


C# IVsTextLines.GetLanguageServiceID方法代码示例

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


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

示例1: IsCSharpOrCppOrC

 private static bool IsCSharpOrCppOrC(IVsTextLines textLines)
 {
     Guid languageServiceId;
     textLines.GetLanguageServiceID(out languageServiceId);
     //return GuidList.CSHARP_LANGUAGE_GUID.Equals(languageServiceId);
     return true;
 }
开发者ID:qianlifeng,项目名称:easyvsx,代码行数:7,代码来源:TextBufferDataEventSink.cs

示例2: InitializeLanguageService

        protected override void InitializeLanguageService(IVsTextLines textLines)
        {
            var userData = textLines as IVsUserData;
            if (userData == null) return;
            var langSid = typeof(PowerShellLanguageInfo).GUID;
            if (langSid == Guid.Empty) return;

            var vsCoreSid = new Guid("{8239bec4-ee87-11d0-8c98-00c04fc2ab22}");
            Guid currentSid;
            ErrorHandler.ThrowOnFailure(textLines.GetLanguageServiceID(out currentSid));
            // If the language service is set to the default SID, then
            // set it to our language
            if (currentSid == vsCoreSid)
            {
                ErrorHandler.ThrowOnFailure(textLines.SetLanguageServiceID(ref langSid));
            }
            else if (currentSid != langSid)
            {
                // Some other language service has it, so return VS_E_INCOMPATIBLEDOCDATA
                throw new COMException("Incompatible doc data", VSConstants.VS_E_INCOMPATIBLEDOCDATA);
            }

            var bufferDetectLang = VSConstants.VsTextBufferUserDataGuid.VsBufferDetectLangSID_guid;
            ErrorHandler.ThrowOnFailure(userData.SetData(ref bufferDetectLang, false));
        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:25,代码来源:PowerShellEditorFactory.cs

示例3: InitializeLanguageService

        protected void InitializeLanguageService(IVsTextLines textLines, Guid langSid) {
            IVsUserData userData = textLines as IVsUserData;
            if (userData != null) {
                if (langSid != Guid.Empty) {
                    Guid vsCoreSid = Guids.DefaultLanguageService;
                    Guid currentSid;
                    ErrorHandler.ThrowOnFailure(textLines.GetLanguageServiceID(out currentSid));
                    // If the language service is set to the default SID, then
                    // set it to our language
                    if (currentSid == vsCoreSid) {
                        ErrorHandler.ThrowOnFailure(textLines.SetLanguageServiceID(ref langSid));
                    } else if (currentSid != langSid) {
                        // Some other language service has it, so return VS_E_INCOMPATIBLEDOCDATA
                        throw new COMException("Incompatible doc data", VSConstants.VS_E_INCOMPATIBLEDOCDATA);
                    }

                    Guid bufferDetectLang = VSConstants.VsTextBufferUserDataGuid.VsBufferDetectLangSID_guid;
                    ErrorHandler.ThrowOnFailure(userData.SetData(ref bufferDetectLang, false));
                }
            }
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:21,代码来源:NodejsEditorFactory.cs


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