[TxMt] Re: how does the html bundle preview a document with unsaved changes?

Stephen Bannasch stephen.bannasch at deanbrook.org
Sat Sep 7 23:13:17 UTC 2013


At 10:34 PM -0400 9/6/13, Stephen Bannasch wrote:
>I trying to add the ability to run jshint on a document which has changes that haven't been saved to the filesystem to the jshint.tmbundle bundle:
>
>   https://github.com/fgnass/jshint.tmbundle
>
>I wondered if there was a way to have textmate make a tmp file of the current document so I could pass that file in a command line invocation of jshint.

I solved this by specifying input from document and and inputFormat as text in the "Hint (without save)" command and then using this in the nodejs code to read the currentDocument:

   var currentDocument = fs.readFileSync('/dev/stdin').toString();

FYI: I've got three pull requests in to jshint.tmbundle.

- Include jshint npm production dependencies
   https://github.com/fgnass/jshint.tmbundle/pull/17

- Use custom options if they exist
   https://github.com/fgnass/jshint.tmbundle/pull/16

- Hint without save
   https://github.com/fgnass/jshint.tmbundle/pull/18

They are cumulative so if you want them all just grab the branch referenced in the 'Hint without save' pull request.

All together they make working in JavaScript much nicer on both my 10.6 system running an old TextMate2 and my 10.8.3 system running the latest TextMate2.



More information about the textmate mailing list