//
//  EditorRequest.swift
//  SwiftSourceKit
//

import sourcekitd

extension Request {
    public static func createEditorOpenRequest(filename: String, sourceText: String, enableSyntaxMap: Bool = true, enableSubStructure: Bool = false, compilerArgs: [String] = []) -> Request {
        return Request(dictionary: [
            KeyRequest: .UID(RequestEditorOpen),
            KeyName: .Str(filename),
            KeySourceText: .Str(sourceText),
            KeyEnableSyntaxMap: .Boolean(enableSyntaxMap),
            KeyEnableSubStructure: .Boolean(enableSubStructure),
            ], compilerArgs: compilerArgs)
    }

    public static func createEditorCloseRequest(filename: String) -> Request {
        return Request(dictionary: [
            KeyRequest: .UID(RequestEditorClose),
            KeyName: .Str(filename),
            KeySourceText: .Str(""),
        ])
    }

    public static func createEditorReplaceTextRequest(name: String, offset: Int, length: Int, sourceText: String) -> Request {
        return Request(dictionary: [
            KeyRequest: .UID(RequestEditorReplaceText),
            KeyName: .Str(name),
            KeyOffset: .Integer(offset),
            KeyLength: .Integer(length),
            KeySourceText: .Str(sourceText),
        ])
    }
}

//
//  EditorRequest.swift
//  SwiftSourceKit
//

import sourcekitd

extension Request {
    public static func createEditorOpenRequest(filename: String, sourceText: String, enableSyntaxMap: Bool = true, enableSubStructure: Bool = false, compilerArgs: [String] = []) -> Request {
        return Request(dictionary: [
            KeyRequest: .UID(RequestEditorOpen),
            KeyName: .Str(filename),
            KeySourceText: .Str(sourceText),
            KeyEnableSyntaxMap: .Boolean(enableSyntaxMap),
            KeyEnableSubStructure: .Boolean(enableSubStructure),
            ], compilerArgs: compilerArgs)
    }

    public static func createEditorCloseRequest(filename: String) -> Request {
        return Request(dictionary: [
            KeyRequest: .UID(RequestEditorClose),
            KeyName: .Str(filename),
            KeySourceText: .Str(""),
        ])
    }
}

--- 
+++ 
@@ -23,4 +23,14 @@
             KeySourceText: .Str(""),
         ])
     }
+
+    public static func createEditorReplaceTextRequest(name: String, offset: Int, length: Int, sourceText: String) -> Request {
+        return Request(dictionary: [
+            KeyRequest: .UID(RequestEditorReplaceText),
+            KeyName: .Str(name),
+            KeyOffset: .Integer(offset),
+            KeyLength: .Integer(length),
+            KeySourceText: .Str(sourceText),
+        ])
+    }
 }
Add a method that creates a replace text request
