added references/implementations opening directly in TextMate, need to cut back syntax highlighting in displayed files still
This commit is contained in:
parent
e5b8316dac
commit
24f83b278b
49
TextMate.sc
49
TextMate.sc
|
@ -1,5 +1,5 @@
|
||||||
TextMate {
|
TextMate {
|
||||||
classvar menu, <openClassInTextMate;
|
classvar menu, <openClassInTextMate, <openReferencesInTextMate;
|
||||||
|
|
||||||
*initClass {
|
*initClass {
|
||||||
var opt;
|
var opt;
|
||||||
|
@ -19,6 +19,12 @@ TextMate {
|
||||||
};
|
};
|
||||||
openClassInTextMate.state = true;
|
openClassInTextMate.state = true;
|
||||||
openClassInTextMate.setShortCut("j", true, true);
|
openClassInTextMate.setShortCut("j", true, true);
|
||||||
|
|
||||||
|
openReferencesInTextMate = CocoaMenuItem(menu, 2, "Open references in TextMate", false) { |item|
|
||||||
|
item.state = item.state.not;
|
||||||
|
};
|
||||||
|
openReferencesInTextMate.state = true;
|
||||||
|
openReferencesInTextMate.setShortCut("r", true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +60,9 @@ SC3Controller {
|
||||||
nodes.add(node);
|
nodes.add(node);
|
||||||
|
|
||||||
node = OSCresponderNode(nil, '/sc3ctrl/help') { |t, r, msg|
|
node = OSCresponderNode(nil, '/sc3ctrl/help') { |t, r, msg|
|
||||||
{ msg[1].asString.openHelpFile }.defer
|
{
|
||||||
|
msg[1].asString.openHelpFile;
|
||||||
|
}.defer
|
||||||
}.add;
|
}.add;
|
||||||
nodes.add(node);
|
nodes.add(node);
|
||||||
|
|
||||||
|
@ -88,12 +96,20 @@ SC3Controller {
|
||||||
nodes.add(node);
|
nodes.add(node);
|
||||||
|
|
||||||
node = OSCresponderNode(nil, '/sc3ctrl/implementations') { |t, r, msg|
|
node = OSCresponderNode(nil, '/sc3ctrl/implementations') { |t, r, msg|
|
||||||
{ SC3Controller.methodTemplates(msg[1]) }.defer
|
if(TextMate.openReferencesInTextMate.state) {
|
||||||
|
{ SC3Controller.methodTemplates(msg[1], true) }.defer
|
||||||
|
} { // open in SC.app
|
||||||
|
{ SC3Controller.methodTemplates(msg[1], false) }.defer
|
||||||
|
}
|
||||||
}.add;
|
}.add;
|
||||||
nodes.add(node);
|
nodes.add(node);
|
||||||
|
|
||||||
node = OSCresponderNode(nil, '/sc3ctrl/references') { |t, r, msg|
|
node = OSCresponderNode(nil, '/sc3ctrl/references') { |t, r, msg|
|
||||||
{ SC3Controller.methodReferences(msg[1]) }.defer
|
if(TextMate.openReferencesInTextMate.state) {
|
||||||
|
{ SC3Controller.methodReferences(msg[1], true) }.defer
|
||||||
|
} { // open in SC.app
|
||||||
|
{ SC3Controller.methodReferences(msg[1], false) }.defer
|
||||||
|
}
|
||||||
}.add;
|
}.add;
|
||||||
nodes.add(node);
|
nodes.add(node);
|
||||||
|
|
||||||
|
@ -130,7 +146,7 @@ SC3Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// adapated from Kernel.sc
|
// adapated from Kernel.sc
|
||||||
*methodTemplates { |name|
|
*methodTemplates { |name, openInTextMate=false|
|
||||||
var out, found = 0, namestring;
|
var out, found = 0, namestring;
|
||||||
out = CollStream.new;
|
out = CollStream.new;
|
||||||
out << "Implementations of '" << name << "' :\n";
|
out << "Implementations of '" << name << "' :\n";
|
||||||
|
@ -168,12 +184,20 @@ SC3Controller {
|
||||||
Post << "\nNo implementations of '" << name << "'.\n";
|
Post << "\nNo implementations of '" << name << "'.\n";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
out.collection.newTextWindow(name.asString);
|
if(openInTextMate) {
|
||||||
|
var fname = "/tmp/" ++ Date.seed ++ ".sc";
|
||||||
|
File.use(fname, "w") { |f|
|
||||||
|
f << out.collection.asString;
|
||||||
|
("mate" + fname).unixCmd;
|
||||||
|
};
|
||||||
|
} {
|
||||||
|
out.collection.newTextWindow(name.asString);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// adapted from Kernel.sc
|
// adapted from Kernel.sc
|
||||||
*methodReferences { |name|
|
*methodReferences { |name, openInTextMate|
|
||||||
var out, references;
|
var out, references;
|
||||||
name = name.asSymbol;
|
name = name.asSymbol;
|
||||||
out = CollStream.new;
|
out = CollStream.new;
|
||||||
|
@ -182,7 +206,16 @@ SC3Controller {
|
||||||
if (references.notNil, {
|
if (references.notNil, {
|
||||||
out << "References to '" << name << "' :\n";
|
out << "References to '" << name << "' :\n";
|
||||||
references.do({ arg ref; out << " " << ref.asString << "\n"; });
|
references.do({ arg ref; out << " " << ref.asString << "\n"; });
|
||||||
out.collection.newTextWindow(name.asString);
|
|
||||||
|
if(openInTextMate) {
|
||||||
|
var fname = "/tmp/" ++ Date.seed ++ ".sc";
|
||||||
|
File.use(fname, "w") { |f|
|
||||||
|
f << out.collection.asString;
|
||||||
|
("mate" + fname).unixCmd;
|
||||||
|
};
|
||||||
|
} {
|
||||||
|
out.collection.newTextWindow(name.asString);
|
||||||
|
};
|
||||||
},{
|
},{
|
||||||
Post << "\nNo references to '" << name << "'.\n";
|
Post << "\nNo references to '" << name << "'.\n";
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue