/// <include file='doc\Colorizer.uex' path='docs/doc[@for="Colorizer.GetLineInfo"]/*' /> public virtual TokenInfo[] GetLineInfo(IVsTextLines buffer, int line, IVsTextColorState colorState) { int length; NativeMethods.ThrowOnFailure(buffer.GetLengthOfLine(line, out length)); if (length == 0) { return(null); } string text; NativeMethods.ThrowOnFailure(buffer.GetLineText(line, 0, line, length, out text)); int state; NativeMethods.ThrowOnFailure(colorState.GetColorStateAtStartOfLine(line, out state)); if (this.cachedLine == line && this.cachedLineText == text && this.cachedLineState == state && this.cachedLineInfo != null) { return(this.cachedLineInfo); } // recolorize the line, and cache the results this.cachedLineInfo = null; this.cachedLine = line; this.cachedLineText = text; this.cachedLineState = state; NativeMethods.ThrowOnFailure(GetColorInfo(text, length, state)); //now it should be in the cache return(this.cachedLineInfo); }
// used by intellisense mechanisms. public virtual TokenInfo[] GetLineInfo(int line, IVsTextColorState colorState) { int length; buffer.GetLengthOfLine(line, out length); string text; buffer.GetLineText(line, 0, line, length, out text); int state; colorState.GetColorStateAtStartOfLine(line, out state); if (this.cachedLine == line && this.cachedLineText == text && this.cachedLineState == state && this.cachedLineInfo != null) { return(this.cachedLineInfo); } // recolorize the line, and cache the results this.cachedLineInfo = null; this.cachedLine = line; this.cachedLineText = text; this.cachedLineState = state; GetColorInfo(text, length, state); //now it should be in the cache return(this.cachedLineInfo); }
/// <summary>Return colorer lexer state for specified line.</summary> private ScanState GetLineState(int line) { int state; ErrorHandler.ThrowOnFailure( ColorState.GetColorStateAtStartOfLine(line, out state)); return((ScanState)state); }
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="Colorizer.GetLineInfo"]/*' /> public virtual TokenInfo[] GetLineInfo(IVsTextLines buffer, int line, IVsTextColorState colorState) { int length; NativeMethods.ThrowOnFailure(buffer.GetLengthOfLine(line, out length)); if (length == 0) { return(null); } string text; NativeMethods.ThrowOnFailure(buffer.GetLineText(line, 0, line, length, out text)); int state; NativeMethods.ThrowOnFailure(colorState.GetColorStateAtStartOfLine(line, out state)); if (this.cachedLine == line && this.cachedLineText == text && this.cachedLineState == state && this.cachedLineInfo != null) { return(this.cachedLineInfo); } // recolorize the line, and cache the results this.cachedLineInfo = null; this.cachedLine = line; this.cachedLineText = text; this.cachedLineState = state; // GetColorInfo will update the cache. Note that here we don't use NativeMethods.ThrowOnFailure // because the return code is the current parsing state, not an HRESULT. GetColorInfo(text, length, state); //now it should be in the cache return(this.cachedLineInfo); }
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="Colorizer.GetLineInfo"]/*' /> public virtual TokenInfo[] GetLineInfo(IVsTextLines buffer, int line, IVsTextColorState colorState) { int length; NativeMethods.ThrowOnFailure(buffer.GetLengthOfLine(line, out length)); if (length == 0) return null; string text; NativeMethods.ThrowOnFailure(buffer.GetLineText(line, 0, line, length, out text)); int state; NativeMethods.ThrowOnFailure(colorState.GetColorStateAtStartOfLine(line, out state)); if (this.cachedLine == line && this.cachedLineText == text && this.cachedLineState == state && this.cachedLineInfo != null) { return this.cachedLineInfo; } // recolorize the line, and cache the results this.cachedLineInfo = null; this.cachedLine = line; this.cachedLineText = text; this.cachedLineState = state; NativeMethods.ThrowOnFailure(GetColorInfo(text, length, state)); //now it should be in the cache return this.cachedLineInfo; }
/// <include file='doc\Colorizer.uex' path='docs/doc[@for="Colorizer.GetLineInfo"]/*' /> public virtual TokenInfo[] GetLineInfo(IVsTextLines buffer, int line, IVsTextColorState colorState) { int length; NativeMethods.ThrowOnFailure(buffer.GetLengthOfLine(line, out length)); if (length == 0) return null; string text; NativeMethods.ThrowOnFailure(buffer.GetLineText(line, 0, line, length, out text)); int state; NativeMethods.ThrowOnFailure(colorState.GetColorStateAtStartOfLine(line, out state)); if (this.cachedLine == line && this.cachedLineText == text && this.cachedLineState == state && this.cachedLineInfo != null) { return this.cachedLineInfo; } // recolorize the line, and cache the results this.cachedLineInfo = null; this.cachedLine = line; this.cachedLineText = text; this.cachedLineState = state; // GetColorInfo will update the cache. Note that here we don't use NativeMethods.ThrowOnFailure // because the return code is the current parsing state, not an HRESULT. GetColorInfo(text, length, state); //now it should be in the cache return this.cachedLineInfo; }
// used by intellisense mechanisms. public virtual TokenInfo[] GetLineInfo(int line, IVsTextColorState colorState) { int length; buffer.GetLengthOfLine(line, out length); string text; buffer.GetLineText(line, 0, line, length, out text); int state; colorState.GetColorStateAtStartOfLine(line, out state); if (this.cachedLine == line && this.cachedLineText == text && this.cachedLineState == state && this.cachedLineInfo != null) { return this.cachedLineInfo; } // recolorize the line, and cache the results this.cachedLineInfo = null; this.cachedLine = line; this.cachedLineText = text; this.cachedLineState = state; GetColorInfo(text, length, state); //now it should be in the cache return this.cachedLineInfo; }