removed variable declarations from funcdefs, now inline correctly
This commit is contained in:
parent
7319706b05
commit
e65250a87b
17
TextMate.sc
17
TextMate.sc
|
@ -18,17 +18,15 @@ TextMate {
|
||||||
item.state = item.state.not;
|
item.state = item.state.not;
|
||||||
};
|
};
|
||||||
openClassInTextMate.state = true;
|
openClassInTextMate.state = true;
|
||||||
openClassInTextMate.setShortCut("j", true, true);
|
|
||||||
|
|
||||||
openReferencesInTextMate = CocoaMenuItem(menu, 2, "Open references in TextMate", false) { |item|
|
openReferencesInTextMate = CocoaMenuItem(menu, 2, "Open references in TextMate", false) { |item|
|
||||||
item.state = item.state.not;
|
item.state = item.state.not;
|
||||||
};
|
};
|
||||||
openReferencesInTextMate.state = true;
|
openReferencesInTextMate.state = true;
|
||||||
openReferencesInTextMate.setShortCut("r", true, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://github.com/rfwatson/sc3ctrl
|
// adapted from http://github.com/rfwatson/sc3ctrl
|
||||||
SC3Controller {
|
SC3Controller {
|
||||||
classvar nodes;
|
classvar nodes;
|
||||||
|
|
||||||
|
@ -68,14 +66,15 @@ SC3Controller {
|
||||||
|
|
||||||
node = OSCresponderNode(nil, '/sc3ctrl/class') { |t, r, msg|
|
node = OSCresponderNode(nil, '/sc3ctrl/class') { |t, r, msg|
|
||||||
// TM version only
|
// TM version only
|
||||||
|
var fname, cmd;
|
||||||
var klass = msg[1].asString;
|
var klass = msg[1].asString;
|
||||||
var allClasses = Class.allClasses.collect(_.asString);
|
var allClasses = Class.allClasses.collect(_.asString);
|
||||||
|
|
||||||
{
|
{
|
||||||
if(TextMate.openClassInTextMate.state) {
|
if(TextMate.openClassInTextMate.state) {
|
||||||
if(allClasses.detect{ |str| str == klass }.notNil) { // .includes doesn't work?
|
if(allClasses.detect{ |str| str == klass }.notNil) { // .includes doesn't work?
|
||||||
var fname = klass.interpret.filenameSymbol;
|
fname = klass.interpret.filenameSymbol;
|
||||||
var cmd = "grep -nh \"^" ++ klass ++ "\" \"" ++ fname ++ "\" > /tmp/grepout.tmp";
|
cmd = "grep -nh \"^" ++ klass ++ "\" \"" ++ fname ++ "\" > /tmp/grepout.tmp";
|
||||||
cmd.unixCmd(postOutput: false, action: {
|
cmd.unixCmd(postOutput: false, action: {
|
||||||
File.use("/tmp/grepout.tmp", "r") { |f|
|
File.use("/tmp/grepout.tmp", "r") { |f|
|
||||||
var content = f.readAllString;
|
var content = f.readAllString;
|
||||||
|
@ -147,7 +146,7 @@ SC3Controller {
|
||||||
|
|
||||||
// adapated from Kernel.sc
|
// adapated from Kernel.sc
|
||||||
*methodTemplates { |name, openInTextMate=false|
|
*methodTemplates { |name, openInTextMate=false|
|
||||||
var out, found = 0, namestring;
|
var out, found = 0, namestring, fname;
|
||||||
out = CollStream.new;
|
out = CollStream.new;
|
||||||
out << "Implementations of '" << name << "' :\n";
|
out << "Implementations of '" << name << "' :\n";
|
||||||
Class.allClasses.do({ arg class;
|
Class.allClasses.do({ arg class;
|
||||||
|
@ -185,7 +184,7 @@ SC3Controller {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if(openInTextMate) {
|
if(openInTextMate) {
|
||||||
var fname = "/tmp/" ++ Date.seed ++ ".sc";
|
fname = "/tmp/" ++ Date.seed ++ ".sc";
|
||||||
File.use(fname, "w") { |f|
|
File.use(fname, "w") { |f|
|
||||||
f << out.collection.asString;
|
f << out.collection.asString;
|
||||||
("mate" + fname).unixCmd(postOutput: false);
|
("mate" + fname).unixCmd(postOutput: false);
|
||||||
|
@ -198,7 +197,7 @@ SC3Controller {
|
||||||
|
|
||||||
// adapted from Kernel.sc
|
// adapted from Kernel.sc
|
||||||
*methodReferences { |name, openInTextMate|
|
*methodReferences { |name, openInTextMate|
|
||||||
var out, references;
|
var out, references, fname;
|
||||||
name = name.asSymbol;
|
name = name.asSymbol;
|
||||||
out = CollStream.new;
|
out = CollStream.new;
|
||||||
references = Class.findAllReferences(name);
|
references = Class.findAllReferences(name);
|
||||||
|
@ -208,7 +207,7 @@ SC3Controller {
|
||||||
references.do({ arg ref; out << " " << ref.asString << "\n"; });
|
references.do({ arg ref; out << " " << ref.asString << "\n"; });
|
||||||
|
|
||||||
if(openInTextMate) {
|
if(openInTextMate) {
|
||||||
var fname = "/tmp/" ++ Date.seed ++ ".sc";
|
fname = "/tmp/" ++ Date.seed ++ ".sc";
|
||||||
File.use(fname, "w") { |f|
|
File.use(fname, "w") { |f|
|
||||||
f << out.collection.asString;
|
f << out.collection.asString;
|
||||||
("mate" + fname).unixCmd(postOutput: false);
|
("mate" + fname).unixCmd(postOutput: false);
|
||||||
|
|
Loading…
Reference in New Issue