[Sciviews-commits] r503 - komodo/SciViews-K komodo/SciViews-K/components komodo/SciViews-K/content/js komodo/SciViews-K/defaults komodo/SciViews-K/locale komodo/SciViews-K/locale/en-US komodo/SciViews-K/pylib komodo/SciViews-K/udl komodo/SciViews-K-dev komodo/SciViews-K-dev/components komodo/SciViews-K-dev/content/js pkg/SciViews/R pkg/svSocket/R pkg/svTools pkg/svTools/R pkg/svTools/man pkg/tcltk2 pkg/tcltk2/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 1 22:09:35 CET 2013
Author: phgrosjean
Date: 2013-01-01 22:09:34 +0100 (Tue, 01 Jan 2013)
New Revision: 503
Added:
komodo/SciViews-K/defaults/svTools_0.9-3.tar.gz
komodo/SciViews-K/defaults/svTools_0.9-3.zip
komodo/SciViews-K/locale/en-US/
komodo/SciViews-K/locale/en-US/main.properties
komodo/SciViews-K/locale/en-US/sciviewsk.dtd
komodo/SciViews-K/pylib/codeintel_r.py
Removed:
komodo/SciViews-K/components/component.manifest
komodo/SciViews-K/defaults/svTools_0.9-2.tar.gz
komodo/SciViews-K/defaults/svTools_0.9-2.zip
komodo/SciViews-K/pylib/lang_r.py
Modified:
komodo/SciViews-K-dev/SciViews-K (dev).komodoproject
komodo/SciViews-K-dev/components/component.manifest
komodo/SciViews-K-dev/content/js/rconnection.js
komodo/SciViews-K/chrome.manifest
komodo/SciViews-K/components/koRLinter.py
komodo/SciViews-K/components/koR_UDL_Language.py
komodo/SciViews-K/components/koRwiki_UDL_Language.py
komodo/SciViews-K/components/svIRinterpreter.idl
komodo/SciViews-K/components/svRinterpreter.js
komodo/SciViews-K/content/js/commands.js
komodo/SciViews-K/content/js/pref-R.js
komodo/SciViews-K/content/js/prefs.js
komodo/SciViews-K/content/js/r.js
komodo/SciViews-K/content/js/rconsoleOld.js
komodo/SciViews-K/content/js/robjects.js
komodo/SciViews-K/content/js/sciviews.js
komodo/SciViews-K/content/js/socket.js
komodo/SciViews-K/pylib/cile_r.py
komodo/SciViews-K/udl/R-mainlex.udl
komodo/SciViews-K/udl/Rlex.udl
komodo/SciViews-K/udl/Rwiki-mainlex.udl
komodo/SciViews-K/udl/wikilex.udl
pkg/SciViews/R/misc.R
pkg/svSocket/R/svSocket-Internal.R
pkg/svTools/DESCRIPTION
pkg/svTools/NEWS
pkg/svTools/R/lint.R
pkg/svTools/TODO
pkg/svTools/man/svTools-package.Rd
pkg/tcltk2/NAMESPACE
pkg/tcltk2/R/tcltk2-Internal.R
Log:
Numerous changes in SciViews-K & svTools (bug fixes)
Modified: komodo/SciViews-K/chrome.manifest
===================================================================
--- komodo/SciViews-K/chrome.manifest 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/chrome.manifest 2013-01-01 21:09:34 UTC (rev 503)
@@ -7,9 +7,8 @@
overlay chrome://komodo/content/komodo.xul chrome://sciviewsk/content/RObjectsOverlay.xul appversion<=6.99
overlay chrome://places/content/places_panel.xul chrome://sciviewsk/content/placesOverlay.xul appversion>6.99
+locale sciviewsk en-US jar:sciviewsk.jar!/locale/en-US/
locale sciviewsk en-GB jar:sciviewsk.jar!/locale/en-GB/
locale sciviewsk fr-FR jar:sciviewsk.jar!/locale/fr-FR/
skin sciviewsk classic/1.0 jar:sciviewsk.jar!/skin/
-
-manifest components/component.manifest
Deleted: komodo/SciViews-K/components/component.manifest
===================================================================
--- komodo/SciViews-K/components/component.manifest 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/components/component.manifest 2013-01-01 21:09:34 UTC (rev 503)
@@ -1,9 +0,0 @@
-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}
-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/koRLinter.py
===================================================================
--- komodo/SciViews-K/components/koRLinter.py 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/components/koRLinter.py 2013-01-01 21:09:34 UTC (rev 503)
@@ -19,7 +19,7 @@
# ActiveState Software Inc. All Rights Reserved.
#
# Contributor(s):
-# ActiveState Software Inc
+# K. Barton
# Ph. Grosjean <phgrosjean at sciviews.org>
#
# Alternatively, the contents of this file may be used under the terms of
@@ -43,14 +43,14 @@
import os, sys, re
import tempfile
import string
-import process
-import koprocessutils
+#import process
+#import koprocessutils
import logging
log = logging.getLogger('RLinter')
#log.setLevel(logging.DEBUG)
-# R error line format with svTools:::koLint(..., type = "flat")
+# R error line format with svTools::lint(..., type = "flat")
# warning|error+++line+++column+++error message\n
class KoRLinter:
@@ -61,11 +61,14 @@
_reg_categories_ = [
("category-komodo-linter", 'R'),
]
-
+
def __init__(self):
R = "" # Default value points (no R application)
+ self.prefs = components.classes["@activestate.com/koPrefService;1"].\
+ getService(components.interfaces.koIPrefService).prefs
+ pass
- # This is not used (yet) but kept for possible future reference
+ #This is not used (yet) but kept for possible future reference
def checkValidVersion(self):
version = 1
if not version:
@@ -80,31 +83,31 @@
errmsg = "Could not find a suitable R interpreter for "\
"linting."
raise COMException(nsError.NS_ERROR_NOT_AVAILABLE, errmsg)
-
+
def lint(self, request):
"""Lint the given R content.
+
+Raise an exception if there is a problem.
+"""
+ text = request.content.encode("utf-8")
+ #tabWidth = request.koDoc.tabWidth
+ #log.debug("linting %s" % text[1:15])
- Raise an exception if there is a problem.
- """
- text = request.content.encode("utf-8")
-
# Retrieve the path to R...
R = ""
- prefs = components.classes["@activestate.com/koPrefService;1"].\
- getService(components.interfaces.koIPrefService).prefs
- if prefs.hasStringPref("r.application"):
- R = prefs.getStringPref("r.application")
+ if self.prefs.hasStringPref("r.application"):
+ R = self.prefs.getStringPref("r.application")
if R == "":
errmsg = "Could not find a suitable R interpreter for linting."
raise COMException(nsError.NS_ERROR_NOT_AVAILABLE, errmsg)
#self.checkValidVersion()
-
+
# Save R buffer to a temporary file
Rfilename = tempfile.mktemp()
fout = open(Rfilename, 'wb')
fout.write(text)
fout.close()
-
+
p = None
try:
argv = [R] + ["--slave"] + ["-e", "try(Sys.setlocale('LC_CTYPE','UTF-8'),silent=TRUE);if(isTRUE(require('svTools',quietly=TRUE)))lint('" + os.path.basename(Rfilename) + "',type='flat',encoding='utf8')"]
@@ -115,9 +118,12 @@
# TODO: check stderr to see if an error was generated here!
# The relevant output is contained in stdout.
lines = stdout.splitlines(1)
+ #log.debug('lint: ' + lines)
+ except Exception, e:
+ log.exception(e)
finally:
os.unlink(Rfilename)
-
+
results = koLintResults()
if lines:
Modified: komodo/SciViews-K/components/koR_UDL_Language.py
===================================================================
--- komodo/SciViews-K/components/koR_UDL_Language.py 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/components/koR_UDL_Language.py 2013-01-01 21:09:34 UTC (rev 503)
@@ -32,7 +32,7 @@
#
# ***** END LICENSE BLOCK *****
-# Komodo R language service
+# Registers the R language in Komodo.
import logging
from koUDLLanguageBase import KoUDLLanguage
@@ -49,35 +49,77 @@
class KoRLanguage(KoUDLLanguage):
+
+ # ------------ Komodo Registration Information ------------ #
+
name = "R"
lexresLangName = "R"
_reg_desc_ = "%s Language" % name
_reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % name
- _reg_clsid_ = "{4cc23d3b-52e2-426d-8a22-6d7eb2ba81ae}"
_reg_categories_ = [("komodo-language", name)]
+ _reg_clsid_ = "4cc23d3b-52e2-426d-8a22-6d7eb2ba81ae"
defaultExtension = '.R'
- primary = 1
- lang_from_udl_family = {
- 'SSL': None
- }
-
+
+ # ------------ Commenting Controls ------------ #
+
commentDelimiterInfo = {
"line": [ "#", ],
}
-
- downloadURL = "http://cran.r-project.org"
- searchURL = "http://www.rseek.org/"
-
- variableIndicators = '$'
+
+ # ------------ Indentation Controls ------------ #
+
+ # To support automatic indenting and dedenting after "{([" and "})]"
+ supportsSmartIndent = "brace"
+ # Other smart indenting types are:
+ # 'text', 'python', 'XML' and 'keyword'
+
+ # Indent/dedent after these words.
+ _indenting_statements = [u'switch', u'if', u'ifelse', u'while', u'for', u'repeat', u'break', u'local']
_dedenting_statements = [u'return', u'break', u'else', u'next']
- _indenting_statements = [u'switch', u'if', u'ifelse', u'while', u'for', u'repeat']
- supportsSmartIndent = "brace"
-
+
+ # ------------ Sub-language Controls ------------ #
+
+ #Check: Update 'lang_from_udl_family' as appropriate for your
+ # lexer definition. There are four UDL language families:
+ # M (markup), i.e. HTML or XML
+ # CSL (client-side language), e.g. JavaScript
+ # SSL (server-side language), e.g. Perl, PHP, Python
+ # TPL (template language), e.g. RHTML, Django, Smarty
+ # 'lang_from_udl_family' maps each UDL family code (M,
+ # CSL, ...) to the sub-language name in your language.
+ # Some examples:
+ # lang_from_udl_family = { # A PHP file can contain
+ # 'M': 'HTML', # HTML
+ # 'SSL': 'PHP', # PHP
+ # 'CSL': 'JavaScript', # JavaScript
+ # }
+ # lang_from_udl_family = { # An RHTML file can contain
+ # 'M': 'HTML', # HTML
+ # 'SSL': 'Ruby', # Ruby
+ # 'CSL': 'JavaScript', # JavaScript
+ # 'TPL': 'RHTML', # RHTML template code
+ # }
+ # lang_from_udl_family = { # A plain XML can just contain
+ # 'M': 'XML', # XML
+ # }
+ lang_from_udl_family = {
+ 'M': 'Rwiki',
+ 'SSL': 'R'
+ }
+
+ # ------------ Miscellaneous ------------ #
+
+ #primary = 1
+
+ #variableIndicators = '$'
+
#styleStdin = components.interfaces.ISciMoz.SCE_C_STDIN
#styleStdout = components.interfaces.ISciMoz.SCE_C_STDOUT
#styleStderr = components.interfaces.ISciMoz.SCE_C_STDERR
-
-
+
+ downloadURL = "http://cran.r-project.org"
+ searchURL = "http://www.rseek.org/"
+
sample = """`cube`<- function(x, na.rm = FALSE) {
if (isTRUE(na.rm))
x <- x[!is.na(x)]
@@ -94,22 +136,24 @@
* Item 1,
* Item 2.
-This is a paragraph of **bold** ans //italic// text.
+This is a paragraph of **bold** and //italic// text.
!"
"""
- # Overriding these base methods to work around bug 81066.
- def get_linter(self):
- return self._get_linter_from_lang("R")
- def get_interpreter(self):
- None
-
- #def get_lexer(self):
- # return None
- # if self._lexer is None:
- # self._lexer = KoLexerLanguageService()
- # self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP)
- # self._lexer.setKeywords(0, lang_r.keywords)
- # self._lexer.setKeywords(1, lang_r.builtins)
- # self._lexer.supportsFolding = 1
- # return self._lexer
+ ## PhG: what's this??? Everything is commented for now
+ ## Overriding these base methods to work around bug 81066.
+ #def get_linter(self):
+ # return self._get_linter_from_lang("R")
+ #
+ #def get_interpreter(self):
+ # None
+ #
+ ##def get_lexer(self):
+ ## return None
+ ## if self._lexer is None:
+ ## self._lexer = KoLexerLanguageService()
+ ## self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP)
+ ## self._lexer.setKeywords(0, lang_r.keywords)
+ ## self._lexer.setKeywords(1, lang_r.builtins)
+ ## self._lexer.supportsFolding = 1
+ ## return self._lexer
Modified: komodo/SciViews-K/components/koRwiki_UDL_Language.py
===================================================================
--- komodo/SciViews-K/components/koRwiki_UDL_Language.py 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/components/koRwiki_UDL_Language.py 2013-01-01 21:09:34 UTC (rev 503)
@@ -31,11 +31,11 @@
#
# ***** END LICENSE BLOCK *****
-# Komodo R wiki language service
+# Registers the R wiki language in Komodo.
import logging
from koUDLLanguageBase import KoUDLLanguage
-from xpcom import components #, nsError, COMException, ServerException
+#from xpcom import components #, nsError, COMException, ServerException
log = logging.getLogger("koRwikiLanguage")
@@ -48,57 +48,76 @@
class KoRwikiLanguage(KoUDLLanguage):
+
+ # ------------ Komodo Registration Information ------------ #
+
name = "Rwiki"
lexresLangName = "Rwiki"
_reg_desc_ = "%s Language" % name
_reg_contractid_ = "@activestate.com/koLanguage?language=%s;1" % name
- _reg_clsid_ = "{7de21e4c-23d3-513c-9b31-6e8dc4ab72bf}"
_reg_categories_ = [("komodo-language", name)]
+ _reg_clsid_ = "7de21e4c-23d3-513c-9b31-6e8dc4ab72bf"
defaultExtension = '.Rwiki'
- primary = 1
- lang_from_udl_family = {
- 'M': None
- }
-
+
+ # ------------ Commenting Controls ------------ #
+
commentDelimiterInfo = {
"line": [ "#", ],
}
-
+
+ # ------------ Indentation Controls ------------ #
+
+ # To support automatic indenting and dedenting after "{([" and "})]"
+ supportsSmartIndent = "text"
+ # Other smart indenting types are:
+ # 'brace', 'python', 'XML' and 'keyword'
+
+ # Indent/dedent after these words.
+ #_indenting_statements = [u'switch', ]
+ #_dedenting_statements = [u'return', ]
+
+ # ------------ Sub-language Controls ------------ #
+
+ #Check: Update 'lang_from_udl_family' as appropriate for your
+ # lexer definition. There are four UDL language families:
+ # M (markup), i.e. HTML or XML
+ # CSL (client-side language), e.g. JavaScript
+ # SSL (server-side language), e.g. Perl, PHP, Python
+ # TPL (template language), e.g. RHTML, Django, Smarty
+ # 'lang_from_udl_family' maps each UDL family code (M,
+ # CSL, ...) to the sub-language name in your language.
+ # Some examples:
+ # lang_from_udl_family = { # A PHP file can contain
+ # 'M': 'HTML', # HTML
+ # 'SSL': 'PHP', # PHP
+ # 'CSL': 'JavaScript', # JavaScript
+ # }
+ # lang_from_udl_family = { # An RHTML file can contain
+ # 'M': 'HTML', # HTML
+ # 'SSL': 'Ruby', # Ruby
+ # 'CSL': 'JavaScript', # JavaScript
+ # 'TPL': 'RHTML', # RHTML template code
+ # }
+ # lang_from_udl_family = { # A plain XML can just contain
+ # 'M': 'XML', # XML
+ # }
+ lang_from_udl_family = {
+ 'M': 'RWiki',
+ 'SSL': 'R'
+ }
+
+ # ------------ Miscellaneous ------------ #
+
+ #primary = 1
+
downloadURL = "http://www.sciviews.org"
searchURL = "http://www.rseek.org/"
-
- variableIndicators = '$'
- _dedenting_statements = [u'return', u'break', u'else', u'next']
- _indenting_statements = [u'switch', u'if', u'ifelse', u'while', u'for', u'repeat']
- supportsSmartIndent = "brace"
-
- #styleStdin = components.interfaces.ISciMoz.SCE_C_STDIN
- #styleStdout = components.interfaces.ISciMoz.SCE_C_STDOUT
- #styleStderr = components.interfaces.ISciMoz.SCE_C_STDERR
-
-
+
sample = """== A h2 title
-A paragraph of text with **bold** //italic// text...
+A paragraph of text with **bold** and //italic// text...
* Item 1,
* Item 2
"""
-
- # Overriding these base methods to work around bug 81066.
- def get_linter(self):
- None
- #return self._get_linter_from_lang("R")
- def get_interpreter(self):
- None
-
- #def get_lexer(self):
- # return None
- # if self._lexer is None:
- # self._lexer = KoLexerLanguageService()
- # self._lexer.setLexer(components.interfaces.ISciMoz.SCLEX_CPP)
- # self._lexer.setKeywords(0, lang_r.keywords)
- # self._lexer.setKeywords(1, lang_r.builtins)
- # self._lexer.supportsFolding = 1
- # return self._lexer
Modified: komodo/SciViews-K/components/svIRinterpreter.idl
===================================================================
--- komodo/SciViews-K/components/svIRinterpreter.idl 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/components/svIRinterpreter.idl 2013-01-01 21:09:34 UTC (rev 503)
@@ -52,4 +52,4 @@
* @param code - The piece of code currently edited requiring completion.
*/
string complete(in string code);
-};
\ No newline at end of file
+};
Modified: komodo/SciViews-K/components/svRinterpreter.js
===================================================================
--- komodo/SciViews-K/components/svRinterpreter.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/components/svRinterpreter.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -32,36 +32,34 @@
contractID: "@sciviews.org/svRinterpreter;1",
// Category: An array of categories to register this component in.
-// _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
-// }],
+ _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
+ }],
+
// QueryInterface implementation, e.g. using the generateQI helper
// (remove argument if skipped steps above)
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.svIRinterpreter]),
- //chromeURL: "chrome://komodo/content/colorpicker/colorpicker.html",
-
/**
* Escape from multiline mode in the R interpreter.
*/
escape: function () {
- // Currently do noting
+ // Currently do nothing
return(null);
},
@@ -70,29 +68,29 @@
* @param code - The piece of code currently edited requiring calltip.
*/
calltip: function (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);
+ if (typeof(code) == "undefined" | code == "") {
+ return(null);
+ }
+ 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 +98,66 @@
* @param code - The piece of code currently edited requiring completion.
*/
complete: function (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);
+ if (code === undefined | code == "") {
+ return(null);
+ }
+ 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);
}
};
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/content/js/commands.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -652,7 +652,7 @@
var cmd = files.map(function(x) "source('" +
sv.tools.strings.addslashes(x) +"')" ).join("\n");
sv.r.evalCallback(cmd, function (z) {
- sv.r.objects.smartRefresh(true);
+ sv.robjects.smartRefresh(true);
});
},
@@ -673,7 +673,7 @@
var cmd = files.map(function(x) "load('" +
sv.tools.strings.addslashes(x) +"')" ).join("\n");
sv.r.evalCallback(cmd, function (z) {
- sv.r.objects.smartRefresh(true);
+ sv.robjects.smartRefresh(true);
});
},
Modified: komodo/SciViews-K/content/js/pref-R.js
===================================================================
--- komodo/SciViews-K/content/js/pref-R.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/content/js/pref-R.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -411,7 +411,7 @@
"Current/Resources/doc"); // Mac OS X
}
var file;
- for (i in localPaths) {
+ for (var i in localPaths) {
file = svFile.getfile(localPaths[i], csvName);
if (file.exists()) {
csvContent = svFile.read(file.path);
Modified: komodo/SciViews-K/content/js/prefs.js
===================================================================
--- komodo/SciViews-K/content/js/prefs.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/content/js/prefs.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -76,7 +76,16 @@
type = ['double', 'long', 'boolean', 'string'].indexOf(type);
if (type == -1 || type == null) return(undefined);
typeName = ['Double', 'Long', 'Boolean', 'String'][type];
- prefset['set' + typeName + 'Pref'](prefName, value);
+ 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);
}
Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/content/js/r.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -128,7 +128,7 @@
try {
// Check that R is still there on the other side of the server port
// and adjust server type (http or socket) if needed
- res = sv.socket.rCommandSync(
+ var res = sv.socket.rCommandSync(
'cat(localeToCharset()[1], R.version.string, sep = "%%%")');
if (res == null) { // If R is not running...
window.setTimeout("sv.command.updateRStatus(false);", 500);
@@ -471,6 +471,7 @@
var doc = view.document;
var file;
+// FIXME: (sometimes?) doc is not defined in ko7!
if (!doc.isUntitled && doc.file) {
file = doc.file.path.addslashes();
} else {
@@ -1246,7 +1247,7 @@
} else {
sv.prefs.setPref("sciviews.data.dir", dir + sep + datadir, true);
sv.prefs.setPref("sciviews.data.localdir",
- sv.tools.file.path(localdir, datadir), true);
+ sv.tools.file.path(localdir, datadir), true);
}
if (scriptdir == "") {
sv.prefs.setPref("sciviews.scripts.dir", dir, true);
@@ -1254,7 +1255,7 @@
} else {
sv.prefs.setPref("sciviews.scripts.dir", dir + sep + scriptdir, true);
sv.prefs.setPref("sciviews.scripts.localdir",
- sv.tools.file.path(localdir, scriptdir), true);
+ sv.tools.file.path(localdir, scriptdir), true);
}
if (reportdir == "") {
sv.prefs.setPref("sciviews.reports.dir", dir, true);
@@ -1262,7 +1263,7 @@
} else {
sv.prefs.setPref("sciviews.reports.dir", dir + sep + reportdir, true);
sv.prefs.setPref("sciviews.reports.localdir",
- sv.tools.file.path(localdir, reportdir), true);
+ sv.tools.file.path(localdir, reportdir), true);
}
var DIRECTORY_TYPE = Components.interfaces.nsIFile.DIRECTORY_TYPE;
@@ -1687,7 +1688,7 @@
sv.r.eval('with(TempEnv(), {repos <- getOption("repos");' +
'repos["CRAN"] <- "' + repos + '"; ' +
'options(repos = repos)})');
- if (setPref) sv.prefs.setPref("r.cran.mirror", repos);
+ if (setPref) sv.prefs.setPref("r.cran.mirror", repos, true);
if (callback) callback(repos);
}
return(res);
@@ -1908,7 +1909,7 @@
if (cran == "@CRAN@") {
res = sv.r.pkg.chooseCRANMirror(true, _installCallback);
} else {
- sv.prefs.setPref("r.cran.mirror", cran);
+ sv.prefs.setPref("r.cran.mirror", cran, true);
res = sv.r.pkg.install(pkgs, cran, true);
}
return;
@@ -1973,7 +1974,7 @@
['Zip archive (*.zip)|*.zip',
'Gzip archive (*.tgz;*.tar.gz)|*.tgz;*.tar.gz'], true);
if (pkgs == null) return;
- for (i in pkgs) pkgs[i] = pkgs[i].addslashes();
+ for (var i in pkgs) pkgs[i] = pkgs[i].addslashes();
}
}
Modified: komodo/SciViews-K/content/js/rconsoleOld.js
===================================================================
--- komodo/SciViews-K/content/js/rconsoleOld.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/content/js/rconsoleOld.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -47,7 +47,7 @@
//if (sv.prefs.getPref("sciviews.console.completion.setting." +
// type) == undefined) {
sv.prefs.setPref("sciviews.console.completion.setting." + type,
- defaults[i]);
+ defaults[i], true);
//}
document.getElementById("sciviews_rconsole_completion_cb_" + type).
checked = sv.prefs.getPref("sciviews.console.completion.setting." +
@@ -394,7 +394,7 @@
} else {
checked = "true";
}
- sv.prefs.setPref("sciviews.console.completion.setting." + type, checked);
+ sv.prefs.setPref("sciviews.console.completion.setting." + type, checked, true);
}
// Completion counter
Modified: komodo/SciViews-K/content/js/robjects.js
===================================================================
--- komodo/SciViews-K/content/js/robjects.js 2012-12-21 16:07:29 UTC (rev 502)
+++ komodo/SciViews-K/content/js/robjects.js 2013-01-01 21:09:34 UTC (rev 503)
@@ -91,8 +91,9 @@
var rowsChanged = _this.visibleData.length - rowsBefore;
if (rowsChanged) _this.treeBox.rowCountChanged(0, rowsChanged);
- if (_this.treeBox.view.rowCount > _this.visibleData.length)
- throw new Error("Whoops....");
+ // PhG: in ko7, _this.treeBox.view is not defined!
+ //if (_this.treeBox.view.rowCount > _this.visibleData.length)
+ // throw new Error("Whoops....");
if (firstVisibleRow < _this.visibleData.length)
_this.treeBox.scrollToRow(firstVisibleRow);
@@ -109,15 +110,15 @@
(parentElement.group == "function" ? "args" : "sub-object")) :
'environment';
- dimNumeric = 1;
- pos = index; // XXX ????
- //this.index = index;
+ var dimNumeric = 1;
+ var pos = index;
+ this.index = index;
this.type = type;
if (obj) { /// Objects
dimNumeric = 1;
var dimRegExp = /^(\d+x)*\d+$/;
if (dimRegExp.test(arr[2])) {
- dim = arr[2].split(/x/);
+ var dim = arr[2].split(/x/);
for (var j in dim) dimNumeric *= parseInt(dim[j]);
}
this.name = arr[0];
@@ -363,8 +364,8 @@
.getElementById("sciviews_robjects_filterbox");
var obRx, text, not;
text = tb.value;
- not = (text[0] == "!");
- if (not) text = text.substr(1);
+ not = (text.substring(0, 1) == "!")
+ if (not) text = text.substring(1);
if (!text) return(function (x) true);
try {
obRx = new RegExp(text, "i");
@@ -922,7 +923,9 @@
if (node == null) node = document
.getElementById("sciviews_robjects_tab").contentDocument
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/sciviews -r 503
More information about the Sciviews-commits
mailing list