// -------------------------------------------------------------------------------------------------------------------- public virtual InternalHandle this[string propertyName] { get { return(_Handle.GetProperty(propertyName)); } set { _Handle.SetProperty(propertyName, value); } }
/// <summary> /// Looks for tab stops in the specified content and returns a processed version with expanded /// placeholders and tab stops found. /// </summary> /// <param name="engine">V8 instance with Emmet engine compiled in it.</param> /// <param name="content">Expanded abbreviation content.</param> /// <exception cref="Exception{EmmetEngineExceptionArgs}"> /// Indicates that Emmet engine has failed to parse the specified content. /// </exception> public static TabStopsParser ParseContent(V8Engine engine, string content) { ObjectHandle tabStopsUtil = engine.DynamicGlobalObject.window.emmet.tabStops; Handle extractResult = tabStopsUtil.Call("extract", null, engine.CreateValue(content)); if (extractResult.IsError) { var ex = new EmmetEngineExceptionArgs( "Error while trying to extract tab stops.", extractResult); throw new Exception <EmmetEngineExceptionArgs>(ex); } TabStopsParser retVal = new TabStopsParser(); ObjectHandle tabStopsObj = (ObjectHandle)extractResult; retVal.Content = tabStopsObj.GetProperty(@"text").AsString; ObjectHandle tabStopsList = tabStopsObj.GetProperty(@"tabstops"); // Tab stops should be added before modifying document so that editor can track their position. int tabStopsCount = tabStopsList.ArrayLength; if (tabStopsCount > 0) { retVal.TabStops = new Range[tabStopsCount]; retVal.TabStopGroups = new int[tabStopsCount]; for (int i = 0; i < tabStopsCount; i++) { ObjectHandle tabStopObj = tabStopsList.GetProperty(i.ToString()); int start = tabStopObj.GetProperty("start").AsInt32; int end = tabStopObj.GetProperty("end").AsInt32; int group = tabStopObj.GetProperty("group").AsInt32; retVal.TabStops[i] = new Range(start, end); retVal.TabStopGroups[i] = group; } } return(retVal); }