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


C# IVsTextView.GetTextStream方法代码示例

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


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

示例1: FindConfigLine

        private static bool FindConfigLine(IVsTextView configTextView, out int configLineIndex, out string configLineText)
        {
            configLineText = null;

            for (configLineIndex = 0;
                 String.IsNullOrWhiteSpace(configLineText);
                 configLineIndex++)
            {
                int hr = configTextView.GetTextStream(
                    configLineIndex,
                    0,
                    configLineIndex + 1,
                    0,
                    out configLineText);

                if (hr != VSConstants.S_OK || configLineText == null)
                {
                    break;
                }

                if (IsConfigLine(configLineText))
                {
                    return true;
                }
            }

            configLineIndex = -1;
            configLineText = null;
            return false;
        }
开发者ID:nstanard,项目名称:WebPackTaskRunner,代码行数:30,代码来源:TaskRunnerFileBindingsHelper.cs

示例2: GetDeclarations

        public override Declarations GetDeclarations(IVsTextView view, int line, int col, TokenInfo info, ParseReason reason)
        {
            Debug.WriteLine("GetDeclarations token type: {0}", info.Type);

            string t = null;

            if (info.Type != TokenType.Delimiter)
            {
                info.Type = TokenType.Keyword;
                view.GetTextStream(line, col - (info.EndIndex - info.StartIndex + 1), line, col, out t);

                Debug.WriteLine("GetDeclarations text: {0}", t);
            }

            return new AphidDeclarations(this, t);
        }
开发者ID:John-Leitch,项目名称:Blue-Racer-CPU,代码行数:16,代码来源:AphidAuthoringScope.cs

示例3: GetTokenInfoOfFirstTokenOnLine

 private TokenInfo GetTokenInfoOfFirstTokenOnLine(IVsTextView view, int line, int col)
 {
     string source;
     view.GetTextStream(line, 0, line, col, out source);
     var scanner = new LineScanner(Grammar);
     scanner.SetSource(source, 0);
     var tokenInfo = new TokenInfo(0,0,Microsoft.VisualStudio.Package.TokenType.Unknown);
     int state = 0;
     scanner.ScanTokenAndProvideInfoAboutIt(tokenInfo, ref state);
     return tokenInfo;
 }
开发者ID:henritersteeg,项目名称:cuke4vs,代码行数:11,代码来源:AuthoringScope.cs

示例4: GetDeclarations

        // ParseReason.CompleteWord
        // ParseReason.DisplayMemberList
        // ParseReason.MemberSelect
        // ParseReason.MemberSelectAndHilightBraces
        /*
         * Visual Studio calls this function to get possible declarations and completions
         */
        public override Microsoft.VisualStudio.Package.Declarations GetDeclarations(IVsTextView view, int line, int col, TokenInfo info, ParseReason reason)
        {
            string currentCommand;
            string startChar;
            //int hResult = view.GetTextStream(line, info.StartIndex, line, info.EndIndex, out currentCommand);
            //int hResult = view.GetTextStream(line, info.StartIndex, line, col, out currentCommand);
            TextSpan[] ts = new TextSpan[1];
            ts[0] = new TextSpan();
            view.GetWordExtent(line, info.StartIndex, (uint)(WORDEXTFLAGS.WORDEXT_FINDTOKEN), ts);
            int hResult = view.GetTextStream(line, ts[0].iStartIndex, line, ts[0].iEndIndex, out currentCommand);
            if (ts[0].iStartIndex > 0)
            {
                view.GetTextStream(line, ts[0].iStartIndex - 1, line, ts[0].iStartIndex, out startChar);
                if (startChar.Equals("#"))
                    currentCommand = startChar;
            }

            ((HLSLResolver)resolver)._source = (HLSLSource)_source;
            if (_source.IsCompletorActive)
                return _source.CompletionSet.Declarations;

            IList<HLSLDeclaration> declarations;
            switch (reason)
            {
                case ParseReason.CompleteWord:
                    declarations = resolver.FindCompletions(currentCommand, line, col);
                    break;
                case ParseReason.DisplayMemberList:
                case ParseReason.MemberSelect:
                case ParseReason.MemberSelectAndHighlightBraces:
                    if(currentCommand.Equals("."))
                        declarations = resolver.FindMembers(parseResult, line, col);
                    else
                        declarations = resolver.FindCompletions(currentCommand, line, col);
                    break;
                default:
                    throw new ArgumentException("reason");
            }

            return new HLSLDeclarations(declarations);
        }
开发者ID:JohnLouderback,项目名称:shadersense,代码行数:48,代码来源:HLSLAuthoringScope.cs

示例5: GetWordExtent

 private String GetWordExtent(IVsTextView pView, int iLine, int iCol)
 {
     TextSpan[] span = new TextSpan[1];
     // get highlighted word
     string word = "";
     var currentLine = _fileContentCache[pView][iLine];
     if (!string.IsNullOrWhiteSpace(currentLine))
     {
         try
         {
             pView.GetWordExtent(iLine, iCol, (uint)(WORDEXTFLAGS.WORDEXT_CURRENT | WORDEXTFLAGS.WORDEXT_FINDWORD), span);
             pView.GetTextStream(iLine, span[0].iStartIndex, iLine, span[0].iEndIndex, out word);
         }
         catch (Exception ex)
         {
             // Can happen during copy+paste events of large text...
         }
     }
     return word;
 }
开发者ID:chrisparnin,项目名称:ganji,代码行数:20,代码来源:NavigateListener.cs


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