{"action":"created","issue":{"url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff/issues/2","repository_url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff","labels_url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff/issues/2/comments","events_url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff/issues/2/events","html_url":"https://github.com/ryu1kn/vscode-partial-diff/issues/2","id":160107677,"number":2,"title":"[suggestion] use document provider API instead of temp file","user":{"login":"jrieken","id":1794099,"avatar_url":"https://avatars.githubusercontent.com/u/1794099?v=3","gravatar_id":"","url":"https://api.github.com/users/jrieken","html_url":"https://github.com/jrieken","followers_url":"https://api.github.com/users/jrieken/followers","following_url":"https://api.github.com/users/jrieken/following{/other_user}","gists_url":"https://api.github.com/users/jrieken/gists{/gist_id}","starred_url":"https://api.github.com/users/jrieken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrieken/subscriptions","organizations_url":"https://api.github.com/users/jrieken/orgs","repos_url":"https://api.github.com/users/jrieken/repos","events_url":"https://api.github.com/users/jrieken/events{/privacy}","received_events_url":"https://api.github.com/users/jrieken/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-14T06:38:55Z","updated_at":"2016-06-14T14:29:18Z","closed_at":null,"body":"Instead of writing temp files you could use 'virtual' document. Create and register a [TextDocumentContentProvider](https://code.visualstudio.com/docs/extensionAPI/vscode-api#TextDocumentContentProvider) and use the uris of such documents for the diff command. A more complex sample with a content provider can be found here: https://github.com/Microsoft/vscode-extension-samples/tree/master/contentprovider-sample"},"comment":{"url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff/issues/comments/225899114","html_url":"https://github.com/ryu1kn/vscode-partial-diff/issues/2#issuecomment-225899114","issue_url":"https://api.github.com/repos/ryu1kn/vscode-partial-diff/issues/2","id":225899114,"user":{"login":"ryu1kn","id":1505715,"avatar_url":"https://avatars.githubusercontent.com/u/1505715?v=3","gravatar_id":"","url":"https://api.github.com/users/ryu1kn","html_url":"https://github.com/ryu1kn","followers_url":"https://api.github.com/users/ryu1kn/followers","following_url":"https://api.github.com/users/ryu1kn/following{/other_user}","gists_url":"https://api.github.com/users/ryu1kn/gists{/gist_id}","starred_url":"https://api.github.com/users/ryu1kn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryu1kn/subscriptions","organizations_url":"https://api.github.com/users/ryu1kn/orgs","repos_url":"https://api.github.com/users/ryu1kn/repos","events_url":"https://api.github.com/users/ryu1kn/events{/privacy}","received_events_url":"https://api.github.com/users/ryu1kn/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T14:29:18Z","updated_at":"2016-06-14T14:29:18Z","body":"@jrieken \r\n\r\nAt first I thought I can embed `editor.document.uri` and `editor.selection` into my custom scheme, and from them I can retrieve the selected text inside `TextDocumentContentProvider`. But I actually want to capture the exact text rather than just the location of the text because, by the time a user chooses the second bit of text, they might have, with whatever reason, changed something before/in the 1st selected range.\r\n\r\nSo I embedded the selected text into uri by `encodeURIComponent`ing, then pass 2 uris to `vscode.diff` command. It worked, but I'm not sure if I should go with this as I feel not right to put the entire selected text, which can be very very long depending on the kind of text a user selects.\r\n\r\nOh, well actually, I can introduce something like `textRegistry` which can store only 2 texts together with indexes, then inject it into `textDocumentContentProvider`. I also embed text index into my custom scheme so that `textDocumentContentProvider` can lookup texts from the textRegistry. This looks better to me.\r\n\r\nAny thoughts??"}}
{"actor":{"display_login":"ryu1kn"}}