本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}