Built in Compiler?


#1

Is there a built in C or java compiler in Atom like that in TextMate?


How can I compile c code out of atom?
#2

I don’t think TextMate has built-in compilers.


#3

Perhaps the OP is referring to something similar to the “Build” system in Sublime text?


#4

If I go into TextMate -> Bundles -> C -> Run

It will compile the program and run it.

Similarly you could do the same for Java (Bundles -> Java -> Compile & Run)

Just wondering if there was a similar thing in Atom


#5

The Node API has system level access, so if this doesn’t exist yet, it shouldn’t be hard to implement.

Looking at the API, you could probably do something like this to compile C:

var BufferedProcess = require('atom').BufferedProcess;
var process = new BufferedProcess({
  command: 'cc',
  args: 'path_to_your_file'
})

But I’m having trouble figuring out how to get the path of the file in the current buffer


#6
editor = atom.workspace.getActiveEditor()
buffer = editor.getBuffer()
filePath = buffer.file.path

#8

The Script Package will allow you to run C, Perl, Java and a horde of other compilers from a Command-i shortcut. like the Command-b build system of Sublime, similar to this Textmate builder.


#9

Your post about Script Package was the most helpful. Thank you.