Exemplo n.º 1
0
 internal static bool HasRange(this IFileRange range)
 {
     return(range.Start.Line != 0 &&
            range.Start.Column != 0 &&
            range.End.Line != 0 &&
            range.End.Column != 0);
 }
Exemplo n.º 2
0
 internal static BufferRange ToBufferRange(this IFileRange range)
 {
     return(new BufferRange(range.Start.ToBufferPosition(), range.End.ToBufferPosition()));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Inserts a text string to replace the specified range. Can be
 /// used to insert, replace, or delete text depending on the specified
 /// range and text to insert.
 /// </summary>
 /// <param name="textToInsert">The text string to insert.</param>
 /// <param name="insertRange">The buffer range which will be replaced by the string.</param>
 public void InsertText(string textToInsert, IFileRange insertRange)
 {
     this.editorOperations
     .InsertTextAsync(this.scriptFile.DocumentUri.ToString(), textToInsert, insertRange.ToBufferRange())
     .Wait();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Convert a 1-based file range to a 0-based file range.
 /// </summary>
 /// <param name="range">The 1-based file range to convert.</param>
 /// <returns>An equivalent 0-based file range.</returns>
 public static ILspFileRange ToLspRange(this IFileRange range)
 {
     return(new LspFileRange(range.Start.ToLspPosition(), range.End.ToLspPosition()));
 }
 /// <summary>
 /// Inserts a text string to replace the specified range. Can be
 /// used to insert, replace, or delete text depending on the specified
 /// range and text to insert.
 /// </summary>
 /// <param name="textToInsert">The text string to insert.</param>
 /// <param name="insertRange">The buffer range which will be replaced by the string.</param>
 public void InsertText(string textToInsert, IFileRange insertRange)
 {
     this.editorOperations
     .InsertTextAsync(this.scriptFile.ClientFilePath, textToInsert, insertRange.ToBufferRange())
     .Wait();
 }