Code-settings-sync: OS X: sync-summary file summary.txt is hidden and cannot be viewed

Created on 5 Sep 2016  路  9Comments  路  Source: shanalikhan/code-settings-sync

Visual Studio Code Version : [ 1.4.0 ]
Code Sync Settings Version : [ 2.2.3 ]
Operating System : [ OSX 10.11.6 ]

The following screen shot shows that the summary.txt file is missing from the list of open editors, yet 1 unsaved file is listed (which is the hidden summary.txt, saving of which is prompted for on exiting VSCode):

image

Note that this does _not_ happen in the Windows version of VSCode.

bug 馃悰

All 9 comments

I only have Windows machines actually so i was unable to test on OSX, it would be great if you can download the code and debug it and send me a pull request solving this problem- i will be more happy to accept that.

Sounds good, I'll see what I can do.

2.2.5 version contains (#101)[https://github.com/shanalikhan/code-settings-sync/issues/101] fixed that was generating after summary page generation. would you please test its generating the summary now

Sorry, but the file still doesn't show up as an open editor on OS X (it is non-empty again on Windows, however).

i have pushed an update 2.2.6.
Can you paste the log on upload and download from the developer console.
For example i have log showing as

FILE URI For Summary Page : C:\Users\shana\AppData\Roaming\Code\User\summary.txt

Whats your URI

Thanks for looking into this - getting closer:

[Extension Host] FILE URI For Summary Page : \Users\mklement\Library\Application Support\Code\Usersummary.txt

threadService.ts:217[Extension Host] cannot open untitled:%5CUsers%5Cjdoe%5CLibrary%5CApplication%20Support%5CCode%5CUser%5Csummary.txt. Detail: expected URI untitled:%5CUsers%5Cjdoet%5CLibrary%5CApplication%20Support%5CCode%5CUser%5Csummary.txt BUT GOT untitled:/Users/jdoe/Library/Application%20Support/Code/User/summary.txt(anonymous function) @ threadService.ts:217

Here's a URI that would work:

 file:/Users/jdoe/Library/Application%20Support/Code/User/summary.txt

On a side note:

  • Is it possible to mark the open editor as "clean", so that on closing the user isn't asked to save the summary file?
  • Perhaps you can make do without creating a file at all?

Following the code causing problem actually :

i'm replacing the / with \ in loop and its working fine in Windows.
But i'm unable to debug this in other platform.
The console log showing right format of URI
But when i try to parse the string in URI it shows error as its changed somehow.

 var tempURI: string = this.en.APP_SUMMARY;

        while (tempURI.indexOf("/") > -1) {
            tempURI = tempURI.replace("/", "\\");
        }

        console.log("FILE URI For Summary Page : " + tempURI); //\Users\mklement\Library\Application Support\Code\User\summary.txt

        var setting: vscode.Uri = vscode.Uri.parse("untitled:" + tempURI);   //Problem here

        vscode.workspace.openTextDocument(setting).then((a: vscode.TextDocument) ....

as per now there is no way to open untitled file without pointing any location in file system thats why i have to set a directory for summary page and showing dialog box to save is the default behavior for code.

There is another issue opened due to this problem. (https://github.com/shanalikhan/code-settings-sync/issues/96)

For this i have opened the issue in VSCode (https://github.com/Microsoft/vscode/issues/12192)

I've submitted a PR (#107) that bypasses the issue by using an actual file for the sync-summary information.

Some asides:

I don't know what the official recommendations are, but placing your extension's files directly in the application-support folder, along built-in files such as keybindings.json, could be problematic longer-term with respect to potential name collisions and clutter.

The original problem stemmed from the untitled: URI scheme inexplicably accepting only platform-specific path separators (\ on Window, / on OS X / Linux).

This would have worked:

vscode.Uri.parse("untitled:" + tempURI.replace(/[\\/]/g, this.en.OsType === OsType.Windows? '\\' : '/'));

If you use regular expressions with <string>.replace(), you can apply options such as g (global replacement - all occurrences) and i (case-insensitivity) to the search term.

Thus,

    while (tempURI.indexOf("/") > -1) {
        tempURI = tempURI.replace("/", "\\");
    }

can be replaced with simply

 tempURI = tempURI.replace(/\//g, "\\");

I have pushed an update 2.2.7 fixing this issue.

Was this page helpful?
0 / 5 - 0 ratings