About Monkey 2 › Forums › Monkey 2 Development › quick help mods
This topic contains 1 reply, has 1 voice, and was last updated by
Simon Armstrong 1 year, 7 months ago.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
August 26, 2017 at 10:30 pm #10016
After getting frustrated with quick help (F1 key in Ted2) I modified the source in the hope of improvement. Testing now.
This patch makes monkey std and mojo modules have priority and a period is prepended to the search term.
Hard coded keywords and more advanced context sensitive module filter would be nice.
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970diff --git a/src/ted2/helptree.monkey2 b/src/ted2/helptree.monkey2index 57d01b0..cd13a7a 100644--- a/src/ted2/helptree.monkey2+++ b/src/ted2/helptree.monkey2@@ -6,6 +6,11 @@ PrivateFunction EnumModules:String[]()Local mods:=New StringStack++ mods.Add("monkey")+ mods.Add("std")+ mods.Add("mojo")+ mods.Add("mojox")For Local f:=Eachin LoadDir( "modules" )@@ -19,8 +24,8 @@ Function EnumModules:String[]()If Not obj ContinueLocal jname:=obj["module"]- If Not jname Or Not Cast<JsonString>( jname ) Continue-+ If Not jname Or Not Cast<JsonString>( jname ) Or mods.Contains(jname.ToString()) Continue+mods.Push( jname.ToString() )Next@@ -125,8 +130,10 @@ Class HelpTree Extends TreeViewLocal page:=data["page"].ToString()- tree._index[page.ToLower()]=Self-+ Local key:=page.ToLower()+ tree._index[key]=Self+ tree._contents.Push(key)+_page=pageEndif@@ -160,14 +167,16 @@ Class HelpTree Extends TreeViewtext=text.ToLower()_matches.Clear()++ Local term:="."+textLocal selected:=New Map<Node,Bool>- For Local it:=Eachin _index+ For Local key:=Eachin _contents- If Not it.Key.Contains( text ) Continue-- Local node:=it.Value+ If Not key.Contains( term ) Continue++ Local node:=_index[key]_matches.Push( node )@@ -254,5 +263,7 @@ Class HelpTree Extends TreeViewField _selected:=New Map<Node,Bool>Field _index:=New Map<String,Node>++ Field _contents:=New Stack<String>EndAugust 27, 2017 at 7:24 am #10027Hmm, in hindsight just prepending period to text variable should fix quick help.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.