-
Notifications
You must be signed in to change notification settings - Fork 2
NickTulett/gneady
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
geany is a nice lightweight ide but lacked syntax highlighting and auto-complete for javascript, let alone V8 or node.js. Putting that right just meant building 2 files (on the Downloads page): filetypes.javascript to go in ~/.config/geany/filedefs for highlighting Javascript.js.tags to go in ~/.config/geany/tags for auto-complete ============================================================================================ You can also set node %f as the compile command in geany 0.18 to run the script you are currently editing. Alternatively, in geany 0.19 you can set a couple of build commands for js source files: node %f press F8 to run and (if you have installed node-inspector) node ~/node/node-inspector/bin/inspector.js --start=%f press F9 to start debugging. ============================================================================================ You can also add a "lint" build command: node ~/linter.js %d/%f Where linter.js is Douglas Crockford's fulljslint.js with this small addition: var inFile = process.argv[2], sys = require("sys"), fs = require("fs"); sys.puts(inFile); fs.readFile(inFile, function (err, lintable) { if (!err) { if (JSLINT(lintable.toString())) { sys.puts("Nothing untoward"); } else { console.log(sys.inspect(JSLINT.data(), false, 3)); } } else { sys.log("File not found!"); } }); ============================================================================================ If you prefer the sort of output you get with the JSlint web site, you can also do this: var inFile = process.argv[2], sys = require("sys"), fs = require("fs"), http = require('http'); sys.puts(inFile); fs.readFile(inFile, function (err, lintable) { var JSlintCSS = "#errors {background-color:mistyrose;border:2px solid black;margin:1em;padding:1em;}#errors p {margin-left:2em;}#errors p.evidence {font-family:monospace;margin-left:0;}#functions {background-color:white;}#members {background-color:peachpuff;}#functions, #members {border:2px solid black;font-family:monospace;margin:1em;padding:1em;}#functions div {margin-left:10em;text-indent:-5em;}#functions div.function {margin-left:0;text-indent:0;}"; if (!err) { if (JSLINT(lintable.toString())) { sys.puts("Nothing untoward"); } else { sys.puts("JSlint report available at localhost:8181"); var httpServer = http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': "text/html", "Expires": "now"}); response.end("<html><head><title>JSlint report</title><style>" + JSlintCSS + "</style></head><body>" + "<H1>JSlint</H1><H2>" + inFile + "</H2><H3>" + new Date() + "</H3>" + JSLINT.report() + "</body></html>"); process.exit(0); }).listen(8181); } } else { sys.log("File not found!"); } });
About
Setting up geany as a node.js IDE
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published