[Sciviews-commits] r500 - komodo/SciViews-K komodo/SciViews-K/components komodo/SciViews-K/defaults komodo/SciViews-K/pylib komodo/SciViews-K/udl pkg/SciViews pkg/SciViews/R pkg/SciViews/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 18 15:07:03 CET 2012


Author: phgrosjean
Date: 2012-12-18 15:07:03 +0100 (Tue, 18 Dec 2012)
New Revision: 500

Added:
   komodo/SciViews-K/defaults/R reference (0.9.29).kpz
   komodo/SciViews-K/defaults/SciViews_0.9-10.tar.gz
   komodo/SciViews-K/defaults/SciViews_0.9-10.zip
Removed:
   komodo/SciViews-K/components/Conscript
   komodo/SciViews-K/defaults/R reference (0.9.28).kpz
   komodo/SciViews-K/defaults/SciViews_0.9-8.tar.gz
   komodo/SciViews-K/defaults/SciViews_0.9-8.zip
   komodo/SciViews-K/defaults/data.table_1.8.6.tar.gz
   komodo/SciViews-K/defaults/data.table_1.8.6.zip
Modified:
   komodo/SciViews-K/.DS_Store
   komodo/SciViews-K/components/component.manifest
   komodo/SciViews-K/components/svIRinterpreter.idl
   komodo/SciViews-K/components/svRinterpreter.js
   komodo/SciViews-K/defaults/svStart.R
   komodo/SciViews-K/defaults/toolbox.zip
   komodo/SciViews-K/pylib/lang_r.py
   komodo/SciViews-K/pylib/langinfo_r.py
   komodo/SciViews-K/udl/R-mainlex.udl
   komodo/SciViews-K/udl/Rlex.udl
   pkg/SciViews/DESCRIPTION
   pkg/SciViews/NAMESPACE
   pkg/SciViews/NEWS
   pkg/SciViews/R/misc.R
   pkg/SciViews/man/SciViews-package.Rd
Log:
Further reworking of R language intelligence in SciViews-K + elimination of data.table dependence for SciViews R package

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

Deleted: komodo/SciViews-K/components/Conscript
===================================================================
--- komodo/SciViews-K/components/Conscript	2012-12-18 07:06:58 UTC (rev 499)
+++ komodo/SciViews-K/components/Conscript	2012-12-18 14:07:03 UTC (rev 500)
@@ -1,53 +0,0 @@
-#!/usr/local/bin/perl
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License
-# Version 1.1 (the "License"); you may not use this file except in
-# compliance with the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS"
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-# License for the specific language governing rights and limitations
-# under the License.
-#
-# The Original Code is SciViews code.
-#
-# The Initial Developer of the Original Code is ActiveState Software Inc.
-# Portions created by ActiveState Software Inc are Copyright (C) 2000-2007
-# ActiveState Software Inc. All Rights Reserved.
-#
-# Contributor(s):
-#   Ph. Grosjean <phgrosjean at sciviews.org>
-#   ActiveState Software Inc
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-#Import(
-#    'cons',
-#    'build',
-#    'ranRegxpcomStateFileName',
-#    'mozComponentsDir',
-#    'mozIdlIncludePath',
-#    'idlExportDir',
-#    'komodoPythonUtilsDir',
-#    'siloedPython',
-#    'supportDir',
-#    'sdkDir',
-#    'platform',
-#    'havePy2to3',
-#);
-#$cons->InstallXpcomComponent('koRLinter.py');

Modified: komodo/SciViews-K/components/component.manifest
===================================================================
--- komodo/SciViews-K/components/component.manifest	2012-12-18 07:06:58 UTC (rev 499)
+++ komodo/SciViews-K/components/component.manifest	2012-12-18 14:07:03 UTC (rev 500)
@@ -4,6 +4,6 @@
 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}
-contract @sciviews.org/svRinterpreter;1 {22A6C234-CC35-D374-2F01-FD4C605C905B}
-component {22A6C234-CC35-D374-2F01-FD4C605C905B} svRinterpreter.js
+contract @sciviews.org/svRinterpreter;1 {2f89ed9d-6dda-9a4e-a78f-29e4838dcd08}
+component {2f89ed9d-6dda-9a4e-a78f-29e4838dcd08} svRinterpreter.js
 interfaces svIRinterpreter.xpt
\ No newline at end of file

Modified: komodo/SciViews-K/components/svIRinterpreter.idl
===================================================================
--- komodo/SciViews-K/components/svIRinterpreter.idl	2012-12-18 07:06:58 UTC (rev 499)
+++ komodo/SciViews-K/components/svIRinterpreter.idl	2012-12-18 14:07:03 UTC (rev 500)
@@ -33,7 +33,7 @@
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(22A6C234-CC35-D374-2F01-FD4C605C905B)]
+[scriptable, uuid(2f89ed9d-6dda-9a4e-a78f-29e4838dcd08)]
 interface svIRinterpreter : nsISupports {
 
     /**

Modified: komodo/SciViews-K/components/svRinterpreter.js
===================================================================
--- komodo/SciViews-K/components/svRinterpreter.js	2012-12-18 07:06:58 UTC (rev 499)
+++ komodo/SciViews-K/components/svRinterpreter.js	2012-12-18 14:07:03 UTC (rev 500)
@@ -28,29 +28,29 @@
 
     // Properties required for XPCOM registration
     classDescription: "The SciViews-K R interpreter",
-    classID:          Components.ID("{22A6C234-CC35-D374-2F01-FD4C605C905B}"),
+    classID:          Components.ID("{2f89ed9d-6dda-9a4e-a78f-29e4838dcd08}"),
     contractID:       "@sciviews.org/svRinterpreter;1",
 
     // Category: An array of categories to register this component in.
-    _xpcom_categories: [{
+//    _xpcom_categories: [{
+//
+//		// Each object in the array specifies the parameters to pass to
+//		// nsICategoryManager.addCategoryEntry(). 'true' is passed for both
+//		// aPersist and aReplace params.
+//		category: "r",
+//
+//		// Optional, defaults to the object's classDescription
+//		//entry: "",
+//
+//		// Optional, defaults to object's contractID (unless 'service' specified)
+//		//value: "...",
+//
+//		// Optional, defaults to false. When set to true, and only if 'value' is
+//		// not specified, the concatenation of the string "service," and the
+//		// object's contractID is passed as aValue parameter of addCategoryEntry.
+//		service: false
+//    }],
 
-		// Each object in the array specifies the parameters to pass to
-		// nsICategoryManager.addCategoryEntry(). 'true' is passed for both
-		// aPersist and aReplace params.
-		category: "r",
-
-		// Optional, defaults to the object's classDescription
-		//entry: "",
-
-		// Optional, defaults to object's contractID (unless 'service' specified)
-		//value: "...",
-
-		// Optional, defaults to false. When set to true, and only if 'value' is
-		// not specified, the concatenation of the string "service," and the
-		// object's contractID is passed as aValue parameter of addCategoryEntry.
-		service: false
-    }],
-
     // QueryInterface implementation, e.g. using the generateQI helper
 	// (remove argument if skipped steps above)
     QueryInterface: XPCOMUtils.generateQI([Components.interfaces.svIRinterpreter]),
@@ -70,29 +70,29 @@
     * @param code - The piece of code currently edited requiring calltip.
     */
     calltip: function (code) {
-		if (typeof(code) == "undefined" | code == "") {
+///		if (typeof(code) == "undefined" | code == "") {
 			return("");
-		}
-		var cmd = 'cat(callTip("' + code.replace(/(")/g, "\\$1") +
-			'", location = TRUE, description = TRUE, methods = FALSE, width = 80))';
-		var res = rCommand("<<<h>>>" + cmd,
-			function (tip) {
-				if (tip != "") {
-					koLogger.debug(tip);
-					var kvSvc = Components
-						.classes["@activestate.com/koViewService;1"]
-						.getService(Components.interfaces.koIViewService);
-					var ke = kvSvc.currentView.document.getView().scimoz;
-					try {
-						if (ke.callTipActive()) ke.callTipCancel();
-						ke.callTipShow(ke.anchor, tip.replace(/[\r\n]+/g, "\n"));
-					} catch(e) { }
-					// TODO: does not work!
-					//clearCodeintelMessage();
-				}
-			}
-		);
-		return(res);
+///		}
+///		var cmd = 'cat(callTip("' + code.replace(/(")/g, "\\$1") +
+///			'", location = TRUE, description = TRUE, methods = FALSE, width = 80))';
+///		var res = rCommand("<<<h>>>" + cmd,
+///			function (tip) {
+///				if (tip != "") {
+///					koLogger.debug(tip);
+///					var kvSvc = Components
+///						.classes["@activestate.com/koViewService;1"]
+///						.getService(Components.interfaces.koIViewService);
+///					var ke = kvSvc.currentView.document.getView().scimoz;
+///					try {
+///						if (ke.callTipActive()) ke.callTipCancel();
+///						ke.callTipShow(ke.anchor, tip.replace(/[\r\n]+/g, "\n"));
+///					} catch(e) { }
+///					// TODO: does not work!
+///					//clearCodeintelMessage();
+///				}
+///			}
+///		);
+///		return(res);
     },
 
     /**
@@ -100,66 +100,66 @@
     * @param code - The piece of code currently edited requiring completion.
     */
     complete: function (code) {
-		if (code === undefined | code == "") {
+///		if (code === undefined | code == "") {
 			return "";
-		}
-		code = code.replace(/(")/g, "\\$1");
-		var kvSvc = Components
-			.classes["@activestate.com/koViewService;1"]
-			.getService(Components.interfaces.koIViewService);
-		var ke = kvSvc.currentView.document.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 = "?")';
-		koLogger.debug("completion: ..." + code.substring(code.length - 20));
-		var res = rCommand("<<<h>>>" + cmd,
-			function (autoCstring) {
-				try {
-					// These should be set only once?:
-					ke.autoCSeparator = 9;
-					//ke.autoCSetFillUps(" []{}<>/():;%+-*@!\t\n\r=$`");
-					var autoCSeparatorChar = String.fromCharCode(ke.autoCSeparator);
-					autoCstring = autoCstring.replace(/^(.*)[\r\n]+/, "");
-					// Get length of the triggering text
-					var trigLen = parseInt(RegExp.$1);
-					koLogger.debug("trigLen: " + trigLen);
-					// Is something returned by completion()?
-					if (isNaN(trigLen)) { return; }
-					// There is a bug (or feature?) in completion(): if it returns all the code, better set trigLen to 0!
-					if (trigLen == code.length) { trigLen = 0; }
-					// TODO: we need to sort AutoCString with uppercase first
-					// otherwise, the algorithm does not find them (try: typing T, then ctrl+J, then R)
-					// TODO: there is a problem with items with special character (conversion problems)
-					autoCstring = autoCstring.replace(/\r?\n/g, autoCSeparatorChar);
-
-					// code below taken from "CodeIntelCompletionUIHandler"
-				//	var iface = Components.interfaces.koICodeIntelCompletionUIHandler;
-				//	ke.registerImage(iface.ACIID_FUNCTION, ko.markers.
-				//		getPixmap("chrome://komodo/skin/images/ac_function.xpm"));
-				//	ke.registerImage(iface.ACIID_VARIABLE, ko.markers.
-				//		getPixmap("chrome://komodo/skin/images/ac_variable.xpm"));
-				//	ke.registerImage(iface.ACIID_XML_ATTRIBUTE, ko.markers.
-				//		getPixmap("chrome://komodo/skin/images/ac_xml_attribute.xpm"));
-				//	ke.registerImage(iface.ACIID_NAMESPACE, ko.markers.
-				//		getPixmap("chrome://komodo/skin/images/ac_namespace.xpm"));
-				//	ke.registerImage(iface.ACIID_KEYWORD, ko.markers.
-				//		getPixmap("chrome://komodo/skin/images/ac_interface.xpm"));
-					ke.autoCChooseSingle = false;
-					// Take into account if we entered more characters
-					Delta = ke.anchor - lastPos;
-					koLogger.debug("Delta: " + Delta);
-					// Only display completion list if 0 <= Delta < 5
-					// Otherwise, it means we moved away for the triggering area
-					// and we are in a different context, most probably
-					if (Delta >= 0 & Delta < 5) {
-						ke.autoCShow(Delta + trigLen, autoCstring);
-					}
-				} catch(e) { }
-				// TODO: does not work!
-				//clearCodeintelMessage();
-			}
-		);
-		return(res);
+///		}
+///		code = code.replace(/(")/g, "\\$1");
+///		var kvSvc = Components
+///			.classes["@activestate.com/koViewService;1"]
+///			.getService(Components.interfaces.koIViewService);
+///		var ke = kvSvc.currentView.document.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 = "?")';
+///		koLogger.debug("completion: ..." + code.substring(code.length - 20));
+///		var res = rCommand("<<<h>>>" + cmd,
+///			function (autoCstring) {
+///				try {
+///					// These should be set only once?:
+///					ke.autoCSeparator = 9;
+///					//ke.autoCSetFillUps(" []{}<>/():;%+-*@!\t\n\r=$`");
+///					var autoCSeparatorChar = String.fromCharCode(ke.autoCSeparator);
+///					autoCstring = autoCstring.replace(/^(.*)[\r\n]+/, "");
+///					// Get length of the triggering text
+///					var trigLen = parseInt(RegExp.$1);
+///					koLogger.debug("trigLen: " + trigLen);
+///					// Is something returned by completion()?
+///					if (isNaN(trigLen)) { return; }
+///					// There is a bug (or feature?) in completion(): if it returns all the code, better set trigLen to 0!
+///					if (trigLen == code.length) { trigLen = 0; }
+///					// TODO: we need to sort AutoCString with uppercase first
+///					// otherwise, the algorithm does not find them (try: typing T, then ctrl+J, then R)
+///					// TODO: there is a problem with items with special character (conversion problems)
+///					autoCstring = autoCstring.replace(/\r?\n/g, autoCSeparatorChar);
+///
+///					// code below taken from "CodeIntelCompletionUIHandler"
+///				//	var iface = Components.interfaces.koICodeIntelCompletionUIHandler;
+///				//	ke.registerImage(iface.ACIID_FUNCTION, ko.markers.
+///				//		getPixmap("chrome://komodo/skin/images/ac_function.xpm"));
+///				//	ke.registerImage(iface.ACIID_VARIABLE, ko.markers.
+///				//		getPixmap("chrome://komodo/skin/images/ac_variable.xpm"));
+///				//	ke.registerImage(iface.ACIID_XML_ATTRIBUTE, ko.markers.
+///				//		getPixmap("chrome://komodo/skin/images/ac_xml_attribute.xpm"));
+///				//	ke.registerImage(iface.ACIID_NAMESPACE, ko.markers.
+///				//		getPixmap("chrome://komodo/skin/images/ac_namespace.xpm"));
+///				//	ke.registerImage(iface.ACIID_KEYWORD, ko.markers.
+///				//		getPixmap("chrome://komodo/skin/images/ac_interface.xpm"));
+///					ke.autoCChooseSingle = false;
+///					// Take into account if we entered more characters
+///					Delta = ke.anchor - lastPos;
+///					koLogger.debug("Delta: " + Delta);
+///					// Only display completion list if 0 <= Delta < 5
+///					// Otherwise, it means we moved away for the triggering area
+///					// and we are in a different context, most probably
+///					if (Delta >= 0 & Delta < 5) {
+///						ke.autoCShow(Delta + trigLen, autoCstring);
+///					}
+///				} catch(e) { }
+///				// TODO: does not work!
+///				//clearCodeintelMessage();
+///			}
+///		);
+///		return(res);
     }
 };
 

Deleted: komodo/SciViews-K/defaults/R reference (0.9.28).kpz
===================================================================
(Binary files differ)

Added: komodo/SciViews-K/defaults/R reference (0.9.29).kpz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/R reference (0.9.29).kpz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/SciViews_0.9-10.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-10.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/SciViews_0.9-10.zip
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-10.zip
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Deleted: komodo/SciViews-K/defaults/SciViews_0.9-8.tar.gz
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/SciViews_0.9-8.zip
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/data.table_1.8.6.tar.gz
===================================================================
(Binary files differ)

Deleted: komodo/SciViews-K/defaults/data.table_1.8.6.zip
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/defaults/svStart.R
===================================================================
--- komodo/SciViews-K/defaults/svStart.R	2012-12-18 07:06:58 UTC (rev 499)
+++ komodo/SciViews-K/defaults/svStart.R	2012-12-18 14:07:03 UTC (rev 500)
@@ -26,7 +26,7 @@
 remote.repos = "http://R-Forge.R-project.org", pkg.dir = ".",
 debug = Sys.getenv("koDebug") == "TRUE",
 pkgsLast = c("svKomodo", "SciViews"), # to be loaded at the end
-pkgsDontLoad = c("codetools", "svTools", "ellipse", "data.table", "MASS"),
+pkgsDontLoad = c("codetools", "svTools", "ellipse", "MASS"),
 skip = NULL)
 {
 	## Note (KB): it would make life a way easier to put all (and only)

Modified: komodo/SciViews-K/defaults/toolbox.zip
===================================================================
(Binary files differ)

Modified: komodo/SciViews-K/pylib/lang_r.py
===================================================================
--- komodo/SciViews-K/pylib/lang_r.py	2012-12-18 07:06:58 UTC (rev 499)
+++ komodo/SciViews-K/pylib/lang_r.py	2012-12-18 14:07:03 UTC (rev 500)
@@ -16,6 +16,7 @@
 #
 # Contributor(s):
 #   Philippe Grosjean
+#   Kamil Barton
 #   ActiveState Software Inc (code inspired from Komodo code)
 #
 # Alternatively, the contents of this file may be used under the terms of
@@ -56,7 +57,11 @@
 
 #from SilverCity import find_lexer_module_by_id, PropertySet, WordList
 
-from SilverCity.ScintillaConstants import SCE_UDL_SSL_DEFAULT, SCE_UDL_SSL_IDENTIFIER, SCE_UDL_SSL_OPERATOR, SCE_UDL_SSL_VARIABLE, SCE_UDL_SSL_WORD, SCE_UDL_SSL_COMMENT, SCE_UDL_SSL_COMMENTBLOCK, SCE_UDL_SSL_STRING
+from SilverCity.ScintillaConstants import (
+    SCE_UDL_SSL_DEFAULT, SCE_UDL_SSL_IDENTIFIER, SCE_UDL_SSL_OPERATOR,
+    SCE_UDL_SSL_VARIABLE, SCE_UDL_SSL_WORD, SCE_UDL_SSL_COMMENT,
+    SCE_UDL_SSL_COMMENTBLOCK, SCE_UDL_SSL_STRING,
+)
 
 try:
     from xpcom.server import UnwrapObject
@@ -79,6 +84,15 @@
 # Reserved keywords
 keywords = [
     "...",
+    "..1",
+    "..2",
+    "..3",
+    "..4",
+    "..5",
+    "..6",
+    "..7",
+    "..8",
+    "..9",
     "break",
     "else",
     "FALSE",
@@ -88,16 +102,21 @@
     "in",
     "Inf",
     "NA",
+    "NA_integer_",
+    "NA_real_",
+    "NA_complex_",
+    "NA_character_",
     "NaN",
     "next",
     "NULL",
     "repeat",
     "TRUE",
     "while",
-]
-
+### From PhG:
+###]
+###
 # Non reserved keywords
-builtins = [
+###builtins = [
     ".Alias",
     ".ArgsEnv",
     ".AutoloadEnv",
@@ -2723,10 +2742,10 @@
     lang = lang
 
     # Used by ProgLangTriggerIntelMixin.preceding_trg_from_pos()
-    trg_chars = tuple('$@[( ')
-    calltip_trg_chars = tuple('(,')
+### TODO: reenable this!    trg_chars = tuple('$@[( ')
+### TODO: reenable this!    calltip_trg_chars = tuple('(,')
     
-    # named styles used by the class
+    # Named styles used by the class
     whitespace_style = SCE_UDL_SSL_DEFAULT
     operator_style   = SCE_UDL_SSL_OPERATOR
     identifier_style = SCE_UDL_SSL_IDENTIFIER
@@ -2767,72 +2786,110 @@
         if pos < 3:
             return None
 
-        accessor = buf.accessor
-        last_pos = pos-1
-        
-        char = accessor.char_at_pos(last_pos)
-        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 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:
-                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)
+        acc = buf.accessor
+        last_pos = pos - 1
+        char = acc.char_at_pos(last_pos)
+        style = acc.style_at_pos(last_pos)
+        if style == self.operator_style:
+            if char in '[(,':
+                infun = self._in_func(pos, acc)
+                if infun is not None:
+                    s, e, funcname, nargs, argnames, firstarg = infun
+                    return Trigger(self.lang, TRG_FORM_CPLN, "args", pos, True,
+                        funcname = funcname, firstarg = firstarg, nargs = nargs,
+                        argnames = argnames)
+                return None
+
+            elif char in '@$:' and (char != ':' or \
+                acc.char_at_pos(last_pos - 1) == ':'):
+                vr = self._get_var_back(last_pos, acc)
+                if vr is not None:
+                    return Trigger(self.lang, TRG_FORM_CPLN, "variable", vr[4],
+                        True, obj_name = ''.join(vr[2]), cutoff = vr[3])
+        if style == self.string_style and char in self.pathsep:
+            s, e, w = self._get_word_back(last_pos, acc)
+            if len(w) < 2:
+                return None
+            return self._trg_complete_path(w, pos)
         return None
 
+
+    def _unquote(self, text, quotes = '`"\''):
+        if(text[0] in quotes and text[-1] == text[0]):
+            return text[1:len(text) - 1]
+        return text
+
+    def _is_bquoted(self, text):
+        return len(text) > 1 and text.startswith('`') and text.endswith(text[0])
+
+### From PhG code:
+        ###accessor = buf.accessor
+        ###last_pos = pos-1
+        ###
+        ###char = accessor.char_at_pos(last_pos)
+        ###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 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:
+        ###        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)
+        ###return None
+
+
     ##
     # Explicit triggering event, i.e. Ctrl+J.
     #
@@ -2842,101 +2899,441 @@
         if pos < 3:
             return None
 
-        accessor = buf.accessor
-        last_pos = pos-1
-        char = accessor.char_at_pos(last_pos)
-        style = accessor.style_at_pos(last_pos)
-        if DEBUG:
-            print "pos: %d, curr_pos: %d" % (pos, curr_pos)
-            print "char: %r, style: %d" % (char, style)
-        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)
-        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)
+        acc = buf.accessor
+        last_pos = pos - 1
+
+        style = acc.style_at_pos(last_pos)
+        s, e, w = self._get_word_back(last_pos, acc)
+
+        ch = acc.char_at_pos(pos)
+        prv_ch = acc.char_at_pos(last_pos)
+        log.debug('w = "%s", ch = "%s", prv_ch = "%s", pos = %d, curr_pos = %d ' \
+                  % (w, ch, prv_ch, pos, curr_pos, ))
+        if style in self.word_styles:
+            if self._is_bquoted(w):
+                return None
+            s2, e2, w2 = self._get_word_back(s - 1, acc)
+            log.debug( 'w2 = "%s" ' % (w2, ) )
+
+            if w2[-1] in ',(':
+                infun = self._in_func(last_pos, acc)
+                if infun is not None:
+                    #print 'complete variable or argument "%s" for "%s"' % ( w, infun[2], )
+                    s2, e2, funcname, nargs, argnames, firstarg = infun
+                    return Trigger(self.lang, TRG_FORM_CPLN, "args", s, False,
+                        funcname = funcname, firstarg = firstarg, nargs = nargs,
+                        argnames = argnames, text = w)
+                else:
+                    return None
+            else:
+                vr = self._get_var_back(last_pos, acc)
+                if vr is not None:
+                    #print 'complete variable "%s"' % ( ''.join(vr[2]), )
+                    return Trigger(self.lang, TRG_FORM_CPLN, "variable", vr[4],
+                        False, obj_name = ''.join(vr[2]), cutoff = vr[3])
+                return None
+        if style == self.string_style:
+            if len(w) < 2:
+                return None
+            return self._trg_complete_path(w, pos)
+
+        if w[-1] in ',(':
+            infun = self._in_func(pos, acc)
+            if infun is not None:
+                s2, e2, funcname, nargs, argnames, firstarg = infun
+                print 'arguments for "%s"' % ( infun[2], )
+                return Trigger(self.lang, TRG_FORM_CPLN, "args", \
+                    pos, False, funcname = funcname, firstarg = firstarg, \
+                    nargs = nargs, argnames = argnames)
+
+        elif w[-1] in '@$:':
+            vr = self._get_var_back(last_pos, acc)
+            if vr is not None:
+                v = ''.join(vr[2])
+                print 'complete "%s"' % ( v, )
+                return Trigger(self.lang, TRG_FORM_CPLN, "variable", vr[4], ### pos + 1
+                    False, obj_name = v, cutoff = vr[3])
+        elif w in ('[', '[['):
+            infun = self._in_func(pos, acc)
+            if infun is not None:
+                log.debug( 'w = "%s", in_func = "%s" ' % (w, str(infun), ) )
+                s2, e2, funcname, nargs, argnames, firstarg = infun
+                log.debug('arguments for "%s"' % ( infun[2], ))
+                return Trigger(self.lang, TRG_FORM_CPLN, "args", \
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/sciviews -r 500


More information about the Sciviews-commits mailing list