0

I have lots of open documents in sublime, many of them not saved

I was experimenting with keyboard shortcuts I thought I had created one for sorting tabs, but I hit the wrong one, something along the lines of ctrl-alt-shift-s

And it seems to be doing a close all

So I now have a situation of sublime with a load of unsaved documents and a window that looks like

enter image description here

and if I hit OK then it asks about the next file (so presumably I lose that one). Though that one might not be important, many of them are defunitely untitled and important. Others titled but perhaps not saved.

I can't see a way of getting out of this process without potentially losing all my unsaved files (or updates to saved ones).

What do you suggest?

Further to Hugo's input that it's a JSON, i'd be interested in reading it in a JSON editor / JSON reader.

But I get this error

enter image description here

So maybe it's not a totally valid json? I will try to find out what character is there..

If I try some NodeJS to read the file, I still get an issue

/*
http://stackoverflow.com/questions/14432165/uncaught-syntaxerror-unexpected-token-with-json-parse

// preserve newlines, etc - use valid JSON
s = s.replace(/\\n/g, "\\n")  
               .replace(/\\'/g, "\\'")
               .replace(/\\"/g, '\\"')
               .replace(/\\&/g, "\\&")
               .replace(/\\r/g, "\\r")
               .replace(/\\t/g, "\\t")
               .replace(/\\b/g, "\\b")
               .replace(/\\f/g, "\\f");
// remove non-printable and other non-valid JSON chars

s = s.replace(/[\u0000-\u0019]+/g,""); 
var o = JSON.parse(s);
*/

var fs = require('fs');

fs.readFile('./auto1.json', 'utf8', function (err, data) {
    if (err) throw err; // we'll not consider error handling for now
    var str=data;


str = str.replace(/\\n/g, "\\n")  
               .replace(/\\'/g, "\\'")
               .replace(/\\"/g, '\\"')
               .replace(/\\&/g, "\\&")
               .replace(/\\r/g, "\\r")
               .replace(/\\t/g, "\\t")
               .replace(/\\b/g, "\\b")
               .replace(/\\f/g, "\\f")
               .replace(/[\u0000-\u001F]+/g,""); 

    var obj = JSON.parse(data);
});

and I get output

C:\crp\abba>node a.js
undefined:1273
                                        "contents": "\nhtt...
SyntaxError: Unexpected token
    at Object.parse (native)
    at C:\crp\abba\a.js:36:20
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

C:\crp\abba>

I'll have to try out smaller parts of the file and try to find the part of the json that is causing the issue. And i'll try sublime on another computer and load the files onto that 'cos sublime is apparently more lenient when reading(and creating!) a json than javascript is.

barlop
  • 12,887
  • 8
  • 80
  • 109

1 Answers1

0

Sublime stores the contents of unsaved files inside some json files located at:

C:\Users\<USER>\AppData\Roaming\Sublime Text 2\Settings

First thing, create a backup of these files, then try to copy these files to the same folder in another computer (or to another account in the same computer) and then open sublime.

Hugo Corrá
  • 14,546
  • 3
  • 27
  • 39