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


C# TextDocument.GetCodeLanguage方法代码示例

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


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

示例1: CodeComment

        /// <summary>
        /// Initializes a new instance of the <see cref="CodeComment" /> class.
        /// </summary>
        public CodeComment(TextPoint point, int tabSize)
        {
            if (point == null)
            {
                throw new ArgumentNullException(nameof(point));
            }

            _document = point.Parent;
            _commentLineRegex = CodeCommentHelper.GetCommentRegex(_document.GetCodeLanguage());
            _tabSize = tabSize;

            Expand(point);
        }
开发者ID:reima,项目名称:codemaid,代码行数:16,代码来源:CodeComment.cs

示例2: GetFileHeaderFromSettings

 /// <summary>
 /// Gets the file header from settings based on the language of the specified document.
 /// </summary>
 /// <param name="textDocument">The text document.</param>
 /// <returns>A file header from settings.</returns>
 private static string GetFileHeaderFromSettings(TextDocument textDocument)
 {
     switch (textDocument.GetCodeLanguage())
     {
         case CodeLanguage.CPlusPlus: return Settings.Default.Cleaning_UpdateFileHeaderCPlusPlus;
         case CodeLanguage.CSharp: return Settings.Default.Cleaning_UpdateFileHeaderCSharp;
         case CodeLanguage.CSS: return Settings.Default.Cleaning_UpdateFileHeaderCSS;
         case CodeLanguage.FSharp: return Settings.Default.Cleaning_UpdateFileHeaderFSharp;
         case CodeLanguage.HTML: return Settings.Default.Cleaning_UpdateFileHeaderHTML;
         case CodeLanguage.JavaScript: return Settings.Default.Cleaning_UpdateFileHeaderJavaScript;
         case CodeLanguage.JSON: return Settings.Default.Cleaning_UpdateFileHeaderJSON;
         case CodeLanguage.LESS: return Settings.Default.Cleaning_UpdateFileHeaderLESS;
         case CodeLanguage.PHP: return Settings.Default.Cleaning_UpdateFileHeaderPHP;
         case CodeLanguage.PowerShell: return Settings.Default.Cleaning_UpdateFileHeaderPowerShell;
         case CodeLanguage.R: return Settings.Default.Cleaning_UpdateFileHeaderR;
         case CodeLanguage.SCSS: return Settings.Default.Cleaning_UpdateFileHeaderSCSS;
         case CodeLanguage.TypeScript: return Settings.Default.Cleaning_UpdateFileHeaderTypeScript;
         case CodeLanguage.VisualBasic: return Settings.Default.Cleaning_UpdateFileHeaderVB;
         case CodeLanguage.XAML: return Settings.Default.Cleaning_UpdateFileHeaderXAML;
         case CodeLanguage.XML: return Settings.Default.Cleaning_UpdateFileHeaderXML;
         default: return null;
     }
 }
开发者ID:reima,项目名称:codemaid,代码行数:28,代码来源:FileHeaderLogic.cs

示例3: GetCommentPrefix

 /// <summary>
 /// Get the comment prefix (regex) for the given document's language.
 /// </summary>
 /// <param name="document">The document.</param>
 /// <returns>The comment prefix regex, without trailing spaces.</returns>
 internal static string GetCommentPrefix(TextDocument document)
 {
     return GetCommentPrefixForLanguage(document.GetCodeLanguage());
 }
开发者ID:reima,项目名称:codemaid,代码行数:9,代码来源:CodeCommentHelper.cs

示例4: RemoveEOFTrailingNewLine

        /// <summary>
        /// Removes the trailing newline from the end of the specified text document.
        /// </summary>
        /// <param name="textDocument">The text document to cleanup.</param>
        internal void RemoveEOFTrailingNewLine(TextDocument textDocument)
        {
            if (!Settings.Default.Cleaning_RemoveEndOfFileTrailingNewLine) return;

            EditPoint cursor = textDocument.EndPoint.CreateEditPoint();

            if (cursor.AtEndOfDocument && cursor.AtStartOfLine && cursor.AtEndOfLine)
            {
                // Make an exception for C++ resource files to work-around known EOF issue: http://connect.microsoft.com/VisualStudio/feedback/details/173903/resource-compiler-returns-a-rc1004-unexpected-eof-found-error#details
                if (textDocument.GetCodeLanguage() == CodeLanguage.CPlusPlus &&
                    (textDocument.Parent.FullName.EndsWith(".h") || textDocument.Parent.FullName.EndsWith(".rc2")))
                {
                    return;
                }

                var backCursor = cursor.CreateEditPoint();
                backCursor.CharLeft();
                backCursor.Delete(cursor);
            }
        }
开发者ID:reima,项目名称:codemaid,代码行数:24,代码来源:RemoveWhitespaceLogic.cs


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