www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D + Dub + Sublime +... build/run in terminal?

reply SuperLuigi <luigi greenmario.com> writes:
Just wondering if anyone here might know how I can accomplish 
this... basically I'm editing my D code in Sublime using the Dkit 
plugin to access DCD which so far is more reliable than 
monodevelop's autocomplete but I do need to reset the server 
pretty often... but that's neither here nor there...

Sublime is great but its little output panel sucks... won't 
update stdout text until the end of program run so I'd like to 
open newly built programs in a linux terminal. So I installed a 
terminal plugin https://github.com/wbond/sublime_terminal . I can 
open the terminal, great. I can build with dub, great. Now I need 
to put them together... somehow...

When building, sublime looks at a file it has called 
D.sublime-build, and this files looks like the following:

{
   "cmd": ["dmd", "-g", "-debug", "$file"],
   "file_regex": "^(.*?)\\(([0-9]+),?([0-9]+)?\\): (.*)",
   "selector": "source.d",

   "variants":
   [
     {
       "name": "Run",
       "cmd": ["rdmd", "-g", "-debug", "$file"]
     },
     {
       "name": "dub",
       "working_dir": "$project_path",
       "cmd": ["dub"]
     }
   ]
}

I'm pretty sure I need to edit the last line to pop open the 
terminal at the project path and run dub... but whatever I put in 
messes up and I just get errors...

Has anyone done this before and can give me a clue as to what I 
can do to get this to work?
Sep 13 2015
next sibling parent reply Gary Willoughby <dev nomad.so> writes:
On Sunday, 13 September 2015 at 10:00:13 UTC, SuperLuigi wrote:
 but whatever I put in messes up and I just get errors...
So what are the errors?
Sep 13 2015
parent SuperLuigi <luigi greenmario.com> writes:
On Sunday, 13 September 2015 at 12:45:02 UTC, Gary Willoughby 
wrote:
 On Sunday, 13 September 2015 at 10:00:13 UTC, SuperLuigi wrote:
 but whatever I put in messes up and I just get errors...
So what are the errors?
Depends what I put in, but they're just basically saying what I'm putting in isn't valid... because I don't know what I should be putting in... Changing the last line to: "cmd": ["open_terminal"] Results in: [Errno 2] No such file or directory: 'open_terminal' [cmd: ['open_terminal']] Same deal for "terminal", "terminal.app" and other things I've tried... I get this one: __init__() got an unexpected keyword argument 'command' [cmd: ['dub']] ...when trying to open the terminal the same way I'd open it with a key binding like so: "command" : "open_terminal" I can get the terminal to open fine on its own with a key binding in the Key binding file with this: {"keys": ["f2"], "command": "open_terminal"}, Key command to build: { "keys": ["ctrl+b"], "command": "build" },
Sep 13 2015
prev sibling parent Laeeth Isharc <nospamlaeeth nospamlaeeth.com> writes:
On Sunday, 13 September 2015 at 10:00:13 UTC, SuperLuigi wrote:
 Just wondering if anyone here might know how I can accomplish 
 this... basically I'm editing my D code in Sublime using the 
 Dkit plugin to access DCD which so far is more reliable than 
 monodevelop's autocomplete but I do need to reset the server 
 pretty often... but that's neither here nor there...

 Sublime is great but its little output panel sucks... won't 
 update stdout text until the end of program run so I'd like to 
 open newly built programs in a linux terminal. So I installed a 
 terminal plugin https://github.com/wbond/sublime_terminal . I 
 can open the terminal, great. I can build with dub, great. Now 
 I need to put them together... somehow...

 When building, sublime looks at a file it has called 
 D.sublime-build, and this files looks like the following:

 {
   "cmd": ["dmd", "-g", "-debug", "$file"],
   "file_regex": "^(.*?)\\(([0-9]+),?([0-9]+)?\\): (.*)",
   "selector": "source.d",

   "variants":
   [
     {
       "name": "Run",
       "cmd": ["rdmd", "-g", "-debug", "$file"]
     },
     {
       "name": "dub",
       "working_dir": "$project_path",
       "cmd": ["dub"]
     }
   ]
 }

 I'm pretty sure I need to edit the last line to pop open the 
 terminal at the project path and run dub... but whatever I put 
 in messes up and I just get errors...

 Has anyone done this before and can give me a clue as to what I 
 can do to get this to work?
Are you on Windows or Linux ? If the latter, which terminal do you use? A reference for lxterminal is here: http://manpages.ubuntu.com/manpages/precise/man1/lxterminal.1.html In which case I think if you replace call to dub with a call to lxterminal and stick --command dub at the end it might work Can't try here. Will be similar thing for Windows.
Sep 14 2015