public int GetWordExtent(IVsTextLayer textLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] textSpan) => VSConstants.E_NOTIMPL;
static bool MatchToken( WORDEXTFLAGS flags, TokenInfo info ) { if ((flags & WORDEXTFLAGS.WORDEXT_FINDTOKEN) != 0) return !(info.type == TokenType.Comment || info.type == TokenType.LineComment || info.type == TokenType.Embedded); else return (info.type == TokenType.Keyword || info.type == TokenType.Identifier || info.type == TokenType.String || info.type == TokenType.Literal ); }
public int GetWordExtent(IVsTextLayer pTextLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] pts) { return(failed); }
public int GetWordExtent(IVsTextLayer pTextLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] pts) { return(VSConstants.E_NOTIMPL); }
public bool GetWordExtent(int line, int idx, WORDEXTFLAGS flags, out int startIdx, out int endIdx) { Debug.Assert(line >=0 && idx >= 0); startIdx = endIdx = 0; //get the character classes TokenInfo[] lineInfo = this.colorizer.GetLineInfo(line, this.colorState); if (lineInfo == null) return false; int count = lineInfo.Length; TokenInfo info = new TokenInfo(); int index = this.GetTokenInfoAt(lineInfo, idx, ref info); if (index<0) return false; //don't do anything in comment or text or literal space if (info.type == TokenType.Comment || info.type == TokenType.LineComment || info.type == TokenType.Embedded || info.type == TokenType.Text || info.type == TokenType.String || info.type == TokenType.Literal ) return false; //search for a token switch (flags & WORDEXTFLAGS.WORDEXT_MOVETYPE_MASK) { case WORDEXTFLAGS.WORDEXT_PREVIOUS: index--; while (index >= 0 && ! MatchToken(flags, lineInfo[index])) index--; if (idx < 0) return false; break; case WORDEXTFLAGS.WORDEXT_NEXT: idx++; while (index < count && !MatchToken(flags,lineInfo[index])) index++; if (index >= count) return false; break; case WORDEXTFLAGS.WORDEXT_NEAREST: { int prevIdx = index; prevIdx--; while (prevIdx >= 0 && !MatchToken(flags,lineInfo[prevIdx])) prevIdx--; int nextIdx = index; while (nextIdx < count && !MatchToken(flags,lineInfo[nextIdx])) nextIdx++; if (prevIdx < 0 && nextIdx >= count) return false; else if (nextIdx >= count) index = prevIdx; else if (prevIdx < 0) index = nextIdx; else if (index - prevIdx < nextIdx - index) index = prevIdx; else index = nextIdx; break; } case WORDEXTFLAGS.WORDEXT_CURRENT: default: if (!MatchToken(flags, info)) return false; break; } info = lineInfo[index]; //we found something, set the span startIdx = info.startIndex; endIdx = info.endIndex; if (index<lineInfo.Length) endIdx = lineInfo[index+1].startIndex; return true; }
public bool GetWordExtent(int line, int idx, WORDEXTFLAGS flags, out int startIdx, out int endIdx) { Debug.Assert(line >= 0 && idx >= 0); startIdx = endIdx = idx; int length; NativeMethods.ThrowOnFailure(this.textLines.GetLengthOfLine(line, out length)); // pin to length of line just in case we return false and skip pinning at the end of this method. startIdx = endIdx = Math.Min(idx, length); if (length == 0) { return false; } //get the character classes TokenInfo[] lineInfo = this.colorizer.GetLineInfo(this.textLines, line, this.colorState); if (lineInfo == null || lineInfo.Length == 0) return false; int count = lineInfo.Length; TokenInfo info = new TokenInfo(); int index = this.GetTokenInfoAt(lineInfo, idx, ref info); if (index < 0) return false; // don't do anything in comment or text or literal space, unless we // are doing intellisense in which case we want to match the entire value // of quoted strings. TokenType type = info.Type; if ((flags != SourceImpl.WholeToken || type != TokenType.String) && (type == TokenType.Comment || type == TokenType.LineComment || type == TokenType.Text || type == TokenType.String || type == TokenType.Literal)) return false; //search for a token switch (flags & WORDEXTFLAGS.WORDEXT_MOVETYPE_MASK) { case WORDEXTFLAGS.WORDEXT_PREVIOUS: index--; while (index >= 0 && !MatchToken(flags, lineInfo[index])) index--; if (index < 0) return false; break; case WORDEXTFLAGS.WORDEXT_NEXT: index++; while (index < count && !MatchToken(flags, lineInfo[index])) index++; if (index >= count) return false; break; case WORDEXTFLAGS.WORDEXT_NEAREST: { int prevIdx = index; prevIdx--; while (prevIdx >= 0 && !MatchToken(flags, lineInfo[prevIdx])) prevIdx--; int nextIdx = index; while (nextIdx < count && !MatchToken(flags, lineInfo[nextIdx])) nextIdx++; if (prevIdx < 0 && nextIdx >= count) return false; else if (nextIdx >= count) index = prevIdx; else if (prevIdx < 0) index = nextIdx; else if (index - prevIdx < nextIdx - index) index = prevIdx; else index = nextIdx; break; } case WORDEXTFLAGS.WORDEXT_CURRENT: default: if (!MatchToken(flags, info)) return false; break; } info = lineInfo[index]; // We found something, set the span, pinned to the valid coordinates for the // current line. startIdx = Math.Min(length, info.StartIndex); endIdx = Math.Min(length, info.EndIndex); // The scanner endIndex is the last char of the symbol, but // GetWordExtent wants it to be the next char after that, so // we increment the endIdx (if we can). if (endIdx < length) endIdx++; return true; }
public int GetWordExtent(IVsTextLayer pTextLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] pts) { return FAILED; }
int IVsLanguageTextOps.GetWordExtent(IVsTextLayer pTextLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] pts) { return VSConstants.E_NOTIMPL; }
public virtual int GetWordExtent(IVsTextLayer textLayer, TextAddress textAddress, WORDEXTFLAGS flags, TextSpan[] span) { return VSConstants.E_NOTIMPL; }
int IVsLanguageTextOps.GetWordExtent(IVsTextLayer pTextLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] pts) { return(VSConstants.E_NOTIMPL); }
public int GetWordExtent(IVsTextLayer pTextLayer, TextAddress ta, WORDEXTFLAGS flags, TextSpan[] pts) { return VSConstants.E_NOTIMPL; }
public virtual int GetWordExtent(IVsTextLayer textLayer, TextAddress textAddress, WORDEXTFLAGS flags, TextSpan[] span) { return(VSConstants.E_NOTIMPL); }