[Sciviews-commits] r508 - komodo/SciViews-K komodo/SciViews-K/components komodo/SciViews-K/pylib komodo/SciViews-K/skin komodo/SciViews-K/skin/images pkg/svSweave pkg/svSweave/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 7 21:58:27 CET 2013


Author: phgrosjean
Date: 2013-01-07 21:58:27 +0100 (Mon, 07 Jan 2013)
New Revision: 508

Added:
   komodo/SciViews-K/components/component.manifest
   komodo/SciViews-K/skin/images/R_doc.png
Modified:
   komodo/SciViews-K/chrome.manifest
   komodo/SciViews-K/components/koRLinter.py
   komodo/SciViews-K/components/svRinterpreter.js
   komodo/SciViews-K/pylib/codeintel_r.py
   komodo/SciViews-K/skin/.DS_Store
   komodo/SciViews-K/skin/images/.DS_Store
   komodo/SciViews-K/skin/sciviewsk.css
   pkg/svSweave/DESCRIPTION
   pkg/svSweave/R/asciidoc.R
   pkg/svSweave/TODO
Log:
svRinterpreter update and partial restrauration of completion lists and calltips for Komodo 7

Modified: komodo/SciViews-K/chrome.manifest
===================================================================
--- komodo/SciViews-K/chrome.manifest	2013-01-06 22:26:18 UTC (rev 507)
+++ komodo/SciViews-K/chrome.manifest	2013-01-07 20:58:27 UTC (rev 508)
@@ -12,3 +12,5 @@
 locale  sciviewsk     fr-FR     jar:sciviewsk.jar!/locale/fr-FR/
 
 skin    sciviewsk  classic/1.0  jar:sciviewsk.jar!/skin/
+
+manifest components/component.manifest

Added: komodo/SciViews-K/components/component.manifest
===================================================================
--- komodo/SciViews-K/components/component.manifest	                        (rev 0)
+++ komodo/SciViews-K/components/component.manifest	2013-01-07 20:58:27 UTC (rev 508)
@@ -0,0 +1,12 @@
+contract @activestate.com/koLinter?language=R;1 {E5B7415C-81C6-4185-8B53-B527193D251E}
+category category-komodo-linter R @activestate.com/koLinter?language=R;1
+component {E5B7415C-81C6-4185-8B53-B527193D251E} koRLinter.py
+category komodo-language R @activestate.com/koLanguage?language=R;1
+component {4cc23d3b-52e2-426d-8a22-6d7eb2ba81ae} koR_UDL_Language.py
+contract @activestate.com/koLanguage?language=R;1 {4cc23d3b-52e2-426d-8a22-6d7eb2ba81ae}
+category komodo-language Rwiki @activestate.com/koLanguage?language=Rwiki;1
+component {7de21e4c-23d3-513c-9b31-6e8dc4ab72bf} koRwiki_UDL_Language.py
+contract @activestate.com/koLanguage?language=Rwiki;1 {7de21e4c-23d3-513c-9b31-6e8dc4ab72bf}
+contract @sciviews.org/svRinterpreter;1 {2f89ed9d-6dda-9a4e-a78f-29e4838dcd08}
+component {2f89ed9d-6dda-9a4e-a78f-29e4838dcd08} svRinterpreter.js
+interfaces svIRinterpreter.xpt

Modified: komodo/SciViews-K/components/koRLinter.py
===================================================================
--- komodo/SciViews-K/components/koRLinter.py	2013-01-06 22:26:18 UTC (rev 507)
+++ komodo/SciViews-K/components/koRLinter.py	2013-01-07 20:58:27 UTC (rev 508)
@@ -146,7 +146,8 @@
                 result.lineStart = result.lineEnd = lineNo
                 result.columnStart = columnNo
                 # TODO: this sometimes raises an error!?
-                result.columnEnd = len(datalines[result.lineEnd-1]) + 1
+                #result.columnEnd = len(datalines[result.lineEnd-1]) + 1
+                result.columnEnd = len(datalines[result.lineEnd]) + 1
                 # Get the error message
                 if items[3]:
                     result.description = items[3]

Modified: komodo/SciViews-K/components/svRinterpreter.js
===================================================================
--- komodo/SciViews-K/components/svRinterpreter.js	2013-01-06 22:26:18 UTC (rev 507)
+++ komodo/SciViews-K/components/svRinterpreter.js	2013-01-07 20:58:27 UTC (rev 508)
@@ -80,7 +80,8 @@
 					var kvSvc = Components
 						.classes["@activestate.com/koViewService;1"]
 						.getService(Components.interfaces.koIViewService);
-					var ke = kvSvc.currentView.document.getView().scimoz;
+					//var ke = kvSvc.currentView.document.getView().scimoz;
+					var ke = kvSvc.currentView.koDoc.getView().scimoz;
 					try {
 						if (ke.callTipActive()) ke.callTipCancel();
 						ke.callTipShow(ke.anchor, tip.replace(/[\r\n]+/g, "\n"));
@@ -105,7 +106,8 @@
 		var kvSvc = Components
 			.classes["@activestate.com/koViewService;1"]
 			.getService(Components.interfaces.koIViewService);
-		var ke = kvSvc.currentView.document.getView().scimoz;
+		//var ke = kvSvc.currentView.document.getView().scimoz;
+		var ke = kvSvc.currentView.koDoc.getView().scimoz;
 		// Record current position (could change, because asynch trigger of autoC)
 		var lastPos = ke.anchor;
 		var cmd = 'completion("' + code + '", print = TRUE, types = "scintilla", field.sep = "?")';
@@ -164,9 +166,16 @@
 
 //// XPCOM registration of the class ///////////////////////////////////////////
 var components = [svRinterpreter];
-function NSGetModule (compMgr, fileSpec) {
-    return XPCOMUtils.generateModule(components);
-}
+// function NSGetModule (compMgr, fileSpec) {
+	// XPCOMUtils.generateNSGetFactory was introduced in Mozilla 2
+	// XPCOMUtils.generateNSGetModule was introduced in Mozilla 1.9
+	if (XPCOMUtils.generateNSGetFactory) {
+		var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
+	} else {
+		var NSGetModule =  XPCOMUtils.generateNSGetModule(components);
+		//return XPCOMUtils.generateModule(components);
+	}
+//}
 
 
 //// Komodo logging service ////////////////////////////////////////////////////
@@ -181,7 +190,7 @@
 	koLogger.exception(e, msg);
 }
 
-//koLogger.setLevel(koLogging.DEBUG);
+koLogger.setLevel(koLogging.DEBUG);
 
 
 //// Komodo statusbar access ///////////////////////////////////////////////////
@@ -201,7 +210,8 @@
 		.classes["@mozilla.org/appshell/window-mediator;1"]
 		.getService(Components.interfaces.nsIWindowMediator)
 		.getMostRecentWindow("Komodo")
-		.document.getElementById('statusbar-message');
+//		.document.getElementById('statusbar-message');
+		.koDoc.getElementById('statusbar-message');
 	//messageWidget.setAttribute("category", sm.category);
 	//messageWidget.setAttribute("value", sm.msg);
 	//messageWidget.setAttribute("tooltiptext", sm.msg);
@@ -212,28 +222,53 @@
 
 
 //// Komodo preferences access /////////////////////////////////////////////////
-var prefsSvc = Components.classes["@activestate.com/koPrefService;1"]
-	.getService(Components.interfaces.koIPrefService);
-var prefs = prefsSvc.prefs;
-
-// Get a string preference, or default value
-function getPrefString (pref, def) {
-	if (prefs.hasStringPref(pref)) {
-		return(prefs.getStringPref(pref));
-	} else return(def);
+var prefset = Components.classes["@activestate.com/koPrefService;1"]
+	.getService(Components.interfaces.koIPrefService).prefs;
+	
+// Get a preference, or default value
+function getPref (prefName, defaultValue) {
+	var ret, typeName, type;
+	if (prefset.hasPref(prefName)) {
+		type = ['long', 'double', 'boolean', 'string']
+			.indexOf(prefset.getPrefType(prefName));
+		if (type == -1) return(undefined);
+		typeName = ['Long', 'Double', 'Boolean', 'String'][type];
+		ret = prefset['get' + typeName + 'Pref'](prefName);
+	} else ret = defaultValue;
+	return(ret);
 }
-
-// Set a string preference
-function setPrefString (pref, value, overwrite) {
-	if (overwrite == false & prefs.hasStringPref(pref)) return;
-	prefs.setStringPref(pref, value);
+	
+// Set a preference
+function setPref (prefName, value, overwrite, asInt) {
+	var typeName, type;
+	if (prefset.hasPref(prefName)) {
+		if (overwrite === false) return("");
+		type = prefset.getPrefType(prefName);
+	} else {
+		type = typeof(value);
+		if (type == 'number') type = asInt? "long" : "double";
+	}
+	type = ['double', 'long', 'boolean', 'string'].indexOf(type);
+	if (type == -1 || type == null) return(undefined);
+	typeName = ['Double', 'Long', 'Boolean', 'String'][type];
+	try {
+		prefset['set' + typeName + 'Pref'](prefName, value);
+	} catch (e) {
+		// If typeName is Long, try using Double instead
+		if (typeName == "Long") {
+			prefset['setDoublePref'](prefName, value);
+		} else { // Retry
+			prefset['set' + typeName + 'Pref'](prefName, value);
+		}
+	}
+	return(typeName);
 }
 
 
 //// R socket server ///////////////////////////////////////////////////////////
 if (typeof(sv) == "undefined") var sv = {};
-sv.clientType = getPrefString("sciviews.client.type", "socket");
-setPrefString("sciviews.client.currentType", sv.clientType, true);
+sv.clientType = getPref("sciviews.r.type", "http");
+setPref("sciviews.client.currentType", sv.clientType, true);
 
 // String converter used between Komodo and R (localeToCharset()[1] in R)
 var converter = Components
@@ -406,12 +441,13 @@
 
 // Send an R command through the socket
 function rCommand(cmd, procfun) {
-	var host = getPrefString("sciviews.server.host", "127.0.0.1");
-	var port = getPrefString("sciviews.client.socket", "8888");
-	var clientType = getPrefString("sciviews.client.currentType", "socket");
+	var host = getPref("sciviews.r.host", "127.0.0.1");
+	var port = getPref("sciviews.r.port", 8888);
+	var clientType = getPref("sciviews.client.currentType", "http");
 	var id = "<<<id=" +
-		getPrefString("sciviews.client.id", "SciViewsK") + ">>>";
+		getPref("sciviews.client.id", "SciViewsK") + ">>>";
 	cmd = cmd.replace(/(\r?\n|\r)/g, "<<<n>>>"); // Replace CRLF
+	
 	var listener;
 	if (procfun == null) {	// Do nothing at the end
 		listener = { finished: function(data) {} }
@@ -441,4 +477,7 @@
 	}
 	return(res);
 }
-//Test: rCommand("<<<q>>>cat('library = '); str(library)");
+
+// Test...
+//rCommand("<<<h>>>cat('library = '); str(library)", function (data) alert(data));
+//rCommand("<<<q>>>cat('library = '); str(library)");

Modified: komodo/SciViews-K/pylib/codeintel_r.py
===================================================================
--- komodo/SciViews-K/pylib/codeintel_r.py	2013-01-06 22:26:18 UTC (rev 507)
+++ komodo/SciViews-K/pylib/codeintel_r.py	2013-01-07 20:58:27 UTC (rev 508)
@@ -64,9 +64,9 @@
 except ImportError:
     _xpcom_ = False
 
-#####from xpcom import components
-#####R = components.classes["@sciviews.org/svRinterpreter;1"].\
-#####    getService(components.interfaces.svIRinterpreter)
+from xpcom import components
+R = components.classes["@sciviews.org/svRinterpreter;1"].\
+    getService(components.interfaces.svIRinterpreter)
 
 
 #---- Globals
@@ -74,7 +74,7 @@
 lang = "R"
 log = logging.getLogger("codeintel.r")
 #log.setLevel(logging.WARNING)
-#log.setLevel(logging.DEBUG)
+log.setLevel(logging.DEBUG)
 
 # These keywords and builtin functions are copied from "Rlex.udl".
 # Reserved keywords
@@ -2719,9 +2719,35 @@
 #
 # See other lang_*.py and codeintel_*.py files in your Komodo installation for
 # examples of usage.
-class RLangIntel(LangIntel):
+
+# PhG: replaced by:
+#class RLangIntel(LangIntel):
+class RLangIntel(LangIntel, ParenStyleCalltipIntelMixin, ProgLangTriggerIntelMixin):
     lang = lang
 
+    # PhG: added
+    # Used by ProgLangTriggerIntelMixin.preceding_trg_from_pos()
+    trg_chars = tuple('$@[( ')
+    calltip_trg_chars = tuple('(,')
+    
+    # named styles used by the class
+    whitespace_style = SCE_UDL_SSL_DEFAULT
+    operator_style   = SCE_UDL_SSL_OPERATOR
+    identifier_style = SCE_UDL_SSL_IDENTIFIER
+    keyword_style    = SCE_UDL_SSL_WORD
+    variable_style   = SCE_UDL_SSL_VARIABLE
+    string_style     = SCE_UDL_SSL_STRING
+    comment_styles   = (SCE_UDL_SSL_COMMENT, SCE_UDL_SSL_COMMENTBLOCK)
+    comment_styles_or_whitespace = comment_styles + (whitespace_style, )
+    word_styles      = ( variable_style, identifier_style, keyword_style)
+
+    type_sep = u'\u001e'
+    pathsep = os.sep + ("" if(os.altsep is None) else os.altsep)
+
+
+    koPrefs = components.classes["@activestate.com/koPrefService;1"] \
+        .getService(components.interfaces.koIPrefService).prefs
+
     ##
     # Implicit codeintel triggering event, i.e. when typing in the editor.
     #
@@ -2730,7 +2756,7 @@
     # @param implicit {bool} Automatically called, else manually called?
     #
     def trg_from_pos(self, buf, pos, implicit=True, DEBUG=False, ac=None):
-        #DEBUG = True
+        DEBUG = True
         if pos < 1:
             return None
 
@@ -2741,7 +2767,67 @@
         style = accessor.style_at_pos(last_pos)
         if DEBUG:
             print "trg_from_pos: char: %r, style: %d" % (char, accessor.style_at_pos(last_pos), )
-        if style in (SCE_UDL_SSL_WORD, SCE_UDL_SSL_IDENTIFIER):
+        
+        # PhG: next paragraph replaced by...
+        #if style in (SCE_UDL_SSL_WORD, SCE_UDL_SSL_IDENTIFIER):
+        #    # Functions/builtins completion trigger.
+        #    start, end = accessor.contiguous_style_range_from_pos(last_pos)
+        #    if DEBUG:
+        #        print "identifier style, start: %d, end: %d" % (start, end)
+        #    # Trigger when two characters have been typed.
+        #    if (last_pos - start) == 1:
+        #        if DEBUG:
+        #            print "triggered:: complete identifiers"
+        #        return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
+        #                       start, implicit,
+        #                       word_start=start, word_end=end)
+        if char == " " and (not (style in (SCE_UDL_SSL_COMMENT, SCE_UDL_SSL_COMMENTBLOCK))):
+            # Look the char just before all spaces, tabs or carriage return
+            # We do not trigger it if we are in a comment!
+            p = last_pos-1
+            min_p = max(0, p-500)      # Don't bother looking more than 500 chars
+            if DEBUG:
+                print "Checking char just before spaces"
+            while p >= min_p:
+                #accessor.style_at_pos(p) in jsClassifier.comment_styles:
+                ch = accessor.char_at_pos(p)
+                st = accessor.style_at_pos(p)
+                p -= 1
+                if (not (ch in " \t\v\r\n")) and \
+                (not (st in (SCE_UDL_SSL_COMMENT, SCE_UDL_SSL_COMMENTBLOCK))):
+                    break
+            if ch == ",":
+                # Calculate a completion list for function arguments
+                if DEBUG:
+                    print "triggered:: complete arguments"
+                return Trigger(self.lang, TRG_FORM_CPLN, "arguments",
+                               pos, implicit)
+            elif ch == "=":
+                # TODO: Try to provide correct completion for function arguments
+                if DEBUG:
+                    print "triggered:: complete identifiers"
+                return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
+                               pos, implicit)
+            return None
+        if char == '$' or char == '@':
+            # Variable completion trigger.
+            if DEBUG:
+                print "triggered:: complete variables"
+            return Trigger(self.lang, TRG_FORM_CPLN, "variables",
+                           pos, implicit)
+        elif char == '[':
+            # Quoted variable completion trigger.
+            if DEBUG:
+                print "triggered:: complete quoted variables"
+            return Trigger(self.lang, TRG_FORM_CPLN, "quotevariables",
+                           pos, implicit)            
+        elif char == '(' or char == ',':
+            # Function calltip trigger.
+            if DEBUG:
+                print "triggered:: function calltip"
+            return Trigger(self.lang, TRG_FORM_CALLTIP,
+                           "call-signature", pos, implicit)
+        elif style in (SCE_UDL_SSL_WORD, SCE_UDL_SSL_IDENTIFIER):
             # Functions/builtins completion trigger.
             start, end = accessor.contiguous_style_range_from_pos(last_pos)
             if DEBUG:
@@ -2751,8 +2837,8 @@
                 if DEBUG:
                     print "triggered:: complete identifiers"
                 return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
-                               start, implicit,
-                               word_start=start, word_end=end)
+                               start, implicit)
+        
         return None
 
     ##
@@ -2764,8 +2850,8 @@
     #
     def preceding_trg_from_pos(self, buf, pos, curr_pos,
                                preceding_trg_terminators=None, DEBUG=False):
-        #DEBUG = True
-        if pos < 1:
+        DEBUG = True
+        if pos < 3:
             return None
 
         # accessor {codeintel2.accessor.Accessor} - Examine text and styling.
@@ -2776,14 +2862,78 @@
         if DEBUG:
             print "pos: %d, curr_pos: %d" % (pos, curr_pos)
             print "char: %r, style: %d" % (char, style)
-        if style in (SCE_UDL_SSL_WORD, SCE_UDL_SSL_IDENTIFIER):
+        
+        # PhG: next paragraph replaced by...
+        #if style in (SCE_UDL_SSL_WORD, SCE_UDL_SSL_IDENTIFIER):
+        #    # Functions/builtins completion trigger.
+        #    start, end = accessor.contiguous_style_range_from_pos(last_pos)
+        #    if DEBUG:
+        #        print "triggered:: complete identifiers"
+        #    return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
+        #                   start, implicit=False,
+        #                   word_start=start, word_end=end)
+        
+        if char == " " and (not (style in (SCE_UDL_SSL_COMMENT, SCE_UDL_SSL_COMMENTBLOCK))):
+            # Look the char just before all spaces, tabs or carriage return
+            # We do not trigger it if we are in a comment!
+            p = last_pos-1
+            min_p = max(0, p-500)      # Don't bother looking more than 500 chars
+            if DEBUG:
+                print "Checking char just before spaces"
+            while p >= min_p:
+                #accessor.style_at_pos(p) in jsClassifier.comment_styles:
+                ch = accessor.char_at_pos(p)
+                st = accessor.style_at_pos(p)
+                p -= 1
+                if (not (ch in " \t\v\r\n")) and \
+                (not (st in (SCE_UDL_SSL_COMMENT, SCE_UDL_SSL_COMMENTBLOCK))):
+                    break
+            if ch == ",":
+                # Calculate a completion list for function arguments
+                if DEBUG:
+                    print "triggered:: complete arguments"
+                return Trigger(self.lang, TRG_FORM_CPLN, "arguments",
+                               pos, implicit=False)
+            elif ch == "=":
+                # TODO: Try to provide correct completion for function arguments
+                if DEBUG:
+                    print "triggered:: complete identifiers"
+                return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
+                               pos, implicit=False)
+            return None
+        if char == '$'or char == '@':
+            return Trigger(self.lang, TRG_FORM_CPLN, "variables",
+                            pos, implicit=False)
+        elif char == '[':
+            return Trigger(self.lang, TRG_FORM_CPLN, "quotevariables",
+                            pos, implicit=False)
+        elif char == '(' or char == ',':
+            # Function calltip trigger.
+            if DEBUG:
+                print "triggered:: function calltip"
+            return Trigger(self.lang, TRG_FORM_CALLTIP,
+                           "call-signature", pos, implicit=False)
+        elif style in (SCE_UDL_SSL_VARIABLE, ):
+            start, end = accessor.contiguous_style_range_from_pos(last_pos)
+            if DEBUG:
+                print "triggered:: complete variables"
+            return Trigger(self.lang, TRG_FORM_CPLN, "variables",
+                           start+1, implicit=False)
+        elif style in (SCE_UDL_SSL_WORD, SCE_UDL_SSL_IDENTIFIER):
             # Functions/builtins completion trigger.
             start, end = accessor.contiguous_style_range_from_pos(last_pos)
             if DEBUG:
                 print "triggered:: complete identifiers"
             return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
-                           start, implicit=False,
-                           word_start=start, word_end=end)
+                           start, implicit=False)
+        else:
+            # Functions/builtins completion trigger.
+            start, end = accessor.contiguous_style_range_from_pos(last_pos)
+            if DEBUG:
+                print "triggered:: complete identifiers"
+            return Trigger(self.lang, TRG_FORM_CPLN, "identifiers",
+                           start, implicit=False)
+        
         return None
 
     ##
@@ -2799,21 +2949,111 @@
         ctlr.start(buf, trg)
 
         if trg.id == (self.lang, TRG_FORM_CPLN, "identifiers"):
-            word_start = trg.extra.get("word_start")
-            word_end = trg.extra.get("word_end")
-            if word_start is not None and word_end is not None:
-                # Only return keywords that start with the given 2-char prefix.
-                prefix = buf.accessor.text_range(word_start, word_end)[:2]
-                cplns = [x for x in keywords if x.startswith(prefix)]
-                cplns = [("keyword", x) for x in sorted(cplns, cmp=CompareNPunctLast)]
-                ctlr.set_cplns(cplns)
-                ctlr.done("success")
-                return
+# First, check if there is an abbreviation
+            
+# TODO: convert this into Python and integrate
+#            		var ke = ko.views.manager.currentView.scimoz;
+#		var sel = ke.selText;
+#		if (sv.abbrev.callTipActive & ke.callTipActive()) { ke.callTipCancel(); }
+#		// Only activate tip if current selection is empty!
+#		if (sel == "") {
+#			var trig = ko.interpolate.getWordUnderCursor(ke);
+#			var snip = sv.abbrev.findAbbrevSnippet(trig);
+#			if(snip) {
+#				var tip = snip.value;
+#				tip = tip.replace("!@#_anchor", "");
+#				tip = tip.replace("!@#_currentPos", "");
+#				ke.callTipShow(ke.anchor, "Meta+T expands:\n" + tip);
+#				sv.abbrev.callTipActive = true;
+#			}
+#		}
+#	} catch(e) { log.exception(e); }   
+            # Return all known keywords and builtins.
+            #ctlr.set_cplns(self._get_all_known_identifiers(buf))
+            start, end = buf.accessor.contiguous_style_range_from_pos(pos)
+            self._autocomplete(buf, start, end)
+            ctlr.done("success")
+            return
+            
+            
+#            word_start = trg.extra.get("word_start")
+#            word_end = trg.extra.get("word_end")
+#            if word_start is not None and word_end is not None:
+#                # Only return keywords that start with the given 2-char prefix.
+#                prefix = buf.accessor.text_range(word_start, word_end)[:2]
+#                cplns = [x for x in keywords if x.startswith(prefix)]
+#                cplns = [("keyword", x) for x in sorted(cplns, cmp=CompareNPunctLast)]
+#                ctlr.set_cplns(cplns)
+#                ctlr.done("success")
+#                return
+        
+        #PhG: added!
+        if trg.id == (self.lang, TRG_FORM_CPLN, "variables"):
+            # Find all variables in the current file, complete using them.
+            #ctlr.set_cplns(self._get_all_variables_in_buffer(buf))
+            self._autocomplete(buf, pos, pos)
+            ctlr.done("success")
+            return
 
+        if trg.id == (self.lang, TRG_FORM_CPLN, "quotevariables"):
+            # Find all variables in the current file, complete using them.
+            #ctlr.set_cplns(self._get_all_variables_in_buffer(buf))
+            self._autocomplete(buf, pos, pos)
+            ctlr.done("success")
+            return
+        
+        if trg.id == (self.lang, TRG_FORM_CPLN, "arguments"):
+            # Return all arguments of current function.
+            #ctlr.set_cplns(self._get_all_known_arguments(buf))
+            self._autocomplete(buf, pos, pos)
+            ctlr.done("success")
+            return
+
+        if trg.id == (self.lang, TRG_FORM_CALLTIP, "call-signature"):
+            # Get function calltip.
+            working_text = buf.accessor.text_range(max(0, pos-500), pos)
+            complete_zone = buf.accessor.text_range(pos, pos)
+            calltip = R.calltip(working_text)
+            # This is done asynchronously by the R.calltip() function
+            #if calltip:
+            #    ctlr.set_calltips([calltip])
+            ctlr.done("success")
+            return
+        # PhG: ennd of additions
+
         ctlr.error("Unknown trigger type: %r" % (trg, ))
         ctlr.done("error")
+        
 
+    # PhG: added...
+        ##
+    # Internal functions
+    #
 
+    def _autocomplete(self, buf, start, end):
+        # Get autocompletion list.
+        # TODO: a more sensible way to get the piece of code to complete!
+        working_text = buf.accessor.text_range(max(0, start-200), end)
+        complete_zone = buf.accessor.text_range(start, end)
+        complete = R.complete(working_text)
+        return complete
+    
+    # Not used for R autocomplete, but good to keep
+    #def _get_all_variables_in_buffer(self, buf):
+    #    all_variables = set()
+    #    for token in buf.accessor.gen_tokens():
+    #        if token.get('style') == SCE_UDL_SSL_VARIABLE:
+    #            all_variables.add(token.get('text')[0:])
+    #    return [("variable", x) for x in sorted(all_variables, cmp=CompareNPunctLast)]
+
+    #_identifier_cplns = None
+    #def _get_all_known_identifiers(self, buf):
+    #    if RLangIntel._identifier_cplns is None:
+    #        cplns = [("keyword", x) for x in keywords]
+    #        cplns += [("function", x) for x in builtins]
+    #        RLangIntel._identifier_cplns = sorted(cplns, cmp=CompareNPunctLast, key=operator.itemgetter(1))
+    #    return RLangIntel._identifier_cplns
+
 #---- Buffer class
 
 # Dev Notes:
@@ -2849,13 +3089,17 @@
     #m_lang = "XML"
     #css_lang = "CSS"
     #csl_lang = "JavaScript"
-    ssl_lang = "Rd"
+    m_lang = "Rwiki"
+    ssl_lang = "R"
     #tpl_lang = "Rd"
 
     cb_show_if_empty = True
 
     # Close the completion dialog when encountering any of these chars.
-    cpln_stop_chars = "_ ()*-=+<>{}[]^&|;:'\",?~`!@#%\\/"
+    #PhG: changed...
+    #cpln_stop_chars = "_ ()*-=+<>{}[]^&|;:'\",?~`!@#%\\/"
+    cpln_fillup_chars = "\t" #"~`!$@#%^&*()-=+{}[]|\\;:'\",<>?/\t\n\r"
+    cpln_stop_chars = "~`!$@#%^&*()-=+{}[]|\\;:'\",<>?/ "
 
 
 #---- CILE Driver class

Modified: komodo/SciViews-K/skin/.DS_Store
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/skin/images/.DS_Store
===================================================================
(Binary files differ)

Added: komodo/SciViews-K/skin/images/R_doc.png
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/skin/images/R_doc.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: komodo/SciViews-K/skin/sciviewsk.css
===================================================================
--- komodo/SciViews-K/skin/sciviewsk.css	2013-01-06 22:26:18 UTC (rev 507)
+++ komodo/SciViews-K/skin/sciviewsk.css	2013-01-07 20:58:27 UTC (rev 508)
@@ -331,3 +331,18 @@
   list-style-image: url("chrome://sciviewsk/skin/images/R.png");
 }
 
+/*.tab-icon {
+    display: none;
+}*/
+/*.tab-image-left {
+    background-image: url("chrome://famfamfamsilk/skin/icons/page.png") !important;
+    width: 16px !important;
+    height: 16px !important;
+}
+#tabbed-view tabs > tab[label$=".R"] .tab-image-left {
+    background-image: url("chrome://sciviewsk/skin/images/R_doc.png") !important;
+}*/
+/* This does not work!
+#tabbed-view tabs > tab[label$=".R"] .tab-icon {
+    background-image: url("chrome://sciviewsk/skin/images/R_doc.png") !important;
+}*/

Modified: pkg/svSweave/DESCRIPTION
===================================================================
--- pkg/svSweave/DESCRIPTION	2013-01-06 22:26:18 UTC (rev 507)
+++ pkg/svSweave/DESCRIPTION	2013-01-07 20:58:27 UTC (rev 508)
@@ -7,8 +7,8 @@
   email = "phgrosjean at sciviews.org"))
 Author: Philippe Grosjean
 Maintainer: Philippe Grosjean <phgrosjean at sciviews.org>
-Depends: R (>= 2.6.0), svMisc
-Imports: utils, ascii, knitr
+Depends: R (>= 2.6.0), svMisc, ascii, knitr
+Imports: utils
 SystemRequirements: Python (>= 2.4) to run Asciidoc (http://www.python.org/)
 Description: Supporting functions for the GUI API (Sweave functions)
 License: file LICENSE

Modified: pkg/svSweave/R/asciidoc.R
===================================================================
--- pkg/svSweave/R/asciidoc.R	2013-01-06 22:26:18 UTC (rev 507)
+++ pkg/svSweave/R/asciidoc.R	2013-01-07 20:58:27 UTC (rev 508)
@@ -206,9 +206,8 @@
 	} else RnwFile2 <- RnwFile
 	
 	## Sweave that document to .txt file
-# No, we just import its namespace now
-#	## Note that the ascii package must be loaded first!
-#	require(ascii, quietly = TRUE, warn.conflicts = FALSE)
+	## Note that the ascii package must be loaded first!
+	require(ascii, quietly = TRUE, warn.conflicts = FALSE)
 	odir <- setwd(dirname(RnwFile2)) # Work now relative to destination file
 	## Also display warnings immediately
 	owarn <- options(warn = 1)

Modified: pkg/svSweave/TODO
===================================================================
--- pkg/svSweave/TODO	2013-01-06 22:26:18 UTC (rev 507)
+++ pkg/svSweave/TODO	2013-01-07 20:58:27 UTC (rev 508)
@@ -46,4 +46,12 @@
 
 * Something similar to runExample() & runGist() in shiny
 
-* Move the definition of `!` here from SciViews? Or put in svMisc?
\ No newline at end of file
+* Move the definition of `!` here from SciViews? Or put in svMisc?
+
+* In shiny, when ui.R or server.R is updated, the app is also updated. Do the
+  same here?
+  
+* Add an option(dynamic.trace = TRUE) to trace calls to dynamicXXX() functions.
+
+* In presentation or screencast mode: have a series of premared snippets to help
+  construct the SciViews Rdoc in live.



More information about the Sciviews-commits mailing list