Implementation of IEmmetFile interface for JavaScript engine. See https://github.com/emmetio/emmet/blob/master/lib/interfaces/IEmmetFile.js for details.
        /// <summary>
        /// Registers the callbacks required by Emmet.
        /// </summary>
        /// <param name="editor">Callbacks handler.</param>
        public void RegisterCallbacks(EmmetEditorCallbacks editor)
        {
            ObjectHandle proxy = _engine.CreateObject();

            proxy.SetProperty("getSelectionRange", GetFunctionWrapper(editor.GetSelectionRange));
            proxy.SetProperty("createSelection", GetFunctionWrapper(editor.CreateSelection));
            proxy.SetProperty("getCurrentLineRange", GetFunctionWrapper(editor.GetCurrentLineRange));
            proxy.SetProperty("getCaretPos", GetFunctionWrapper(editor.GetCarretPos));
            proxy.SetProperty("setCaretPos", GetFunctionWrapper(editor.SetCarretPos));
            proxy.SetProperty("getCurrentLine", GetFunctionWrapper(editor.GetCurrentLine));
            proxy.SetProperty("replaceContent", GetFunctionWrapper(editor.ReplaceContent));
            proxy.SetProperty("getContent", GetFunctionWrapper(editor.GetContent));
            proxy.SetProperty("getSyntax", GetFunctionWrapper(editor.GetSyntax));
            proxy.SetProperty("getProfileName", GetFunctionWrapper(editor.GetProfileName));
            proxy.SetProperty("prompt", GetFunctionWrapper(editor.Prompt));
            proxy.SetProperty("getSelection", GetFunctionWrapper(editor.GetSelection));
            proxy.SetProperty("getFilePath", GetFunctionWrapper(editor.GetFilePath));

            _engine.DynamicGlobalObject.editor = proxy;

            this.Trace("IEmmetEditor callbacks successfully registered.");

            _fileCallbacks = new EmmetFileCallbacks();
            ObjectHandle file = _engine.CreateObject();

            file.SetProperty("read", GetFunctionWrapper(_fileCallbacks.Read));
            file.SetProperty("locateFile", GetFunctionWrapper(_fileCallbacks.LocateFile));
            file.SetProperty("createPath", GetFunctionWrapper(_fileCallbacks.CreatePath));
            file.SetProperty("save", GetFunctionWrapper(_fileCallbacks.Save));
            file.SetProperty("getExt", GetFunctionWrapper(_fileCallbacks.GetExtension));

            _engine.DynamicGlobalObject.window.emmet.file = file;

            this.Trace("IEmmetFile callbacks successfully registered.");
        }
        /// <summary>
        /// Registers the callbacks required by Emmet.
        /// </summary>
        /// <param name="editor">Callbacks handler.</param>
        public void RegisterCallbacks(EmmetEditorCallbacks editor)
        {
            ObjectHandle proxy = _engine.CreateObject();

            proxy.SetProperty("getSelectionRange", GetFunctionWrapper(editor.GetSelectionRange));
            proxy.SetProperty("createSelection", GetFunctionWrapper(editor.CreateSelection));
            proxy.SetProperty("getCurrentLineRange", GetFunctionWrapper(editor.GetCurrentLineRange));
            proxy.SetProperty("getCaretPos", GetFunctionWrapper(editor.GetCarretPos));
            proxy.SetProperty("setCaretPos", GetFunctionWrapper(editor.SetCarretPos));
            proxy.SetProperty("getCurrentLine", GetFunctionWrapper(editor.GetCurrentLine));
            proxy.SetProperty("replaceContent", GetFunctionWrapper(editor.ReplaceContent));
            proxy.SetProperty("getContent", GetFunctionWrapper(editor.GetContent));
            proxy.SetProperty("getSyntax", GetFunctionWrapper(editor.GetSyntax));
            proxy.SetProperty("getProfileName", GetFunctionWrapper(editor.GetProfileName));
            proxy.SetProperty("prompt", GetFunctionWrapper(editor.Prompt));
            proxy.SetProperty("getSelection", GetFunctionWrapper(editor.GetSelection));
            proxy.SetProperty("getFilePath", GetFunctionWrapper(editor.GetFilePath));

            _engine.DynamicGlobalObject.editor = proxy;

            this.Trace("IEmmetEditor callbacks successfully registered.");

            _fileCallbacks = new EmmetFileCallbacks();
            ObjectHandle file = _engine.CreateObject();

            file.SetProperty("read", GetFunctionWrapper(_fileCallbacks.Read));
            file.SetProperty("locateFile", GetFunctionWrapper(_fileCallbacks.LocateFile));
            file.SetProperty("createPath", GetFunctionWrapper(_fileCallbacks.CreatePath));
            file.SetProperty("save", GetFunctionWrapper(_fileCallbacks.Save));
            file.SetProperty("getExt", GetFunctionWrapper(_fileCallbacks.GetExtension));

            _engine.DynamicGlobalObject.window.emmet.file = file;

            this.Trace("IEmmetFile callbacks successfully registered.");
        }