{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/issues/211","repository_url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools","labels_url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/issues/211/labels{/name}","comments_url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/issues/211/comments","events_url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/issues/211/events","html_url":"https://github.com/Azure/vscode-kubernetes-tools/pull/211","id":321384972,"number":211,"title":"Fix copy of a resource being appended when resource re-selected","user":{"login":"itowlson","id":865538,"avatar_url":"https://avatars1.githubusercontent.com/u/865538?v=4","gravatar_id":"","url":"https://api.github.com/users/itowlson","html_url":"https://github.com/itowlson","followers_url":"https://api.github.com/users/itowlson/followers","following_url":"https://api.github.com/users/itowlson/following{/other_user}","gists_url":"https://api.github.com/users/itowlson/gists{/gist_id}","starred_url":"https://api.github.com/users/itowlson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itowlson/subscriptions","organizations_url":"https://api.github.com/users/itowlson/orgs","repos_url":"https://api.github.com/users/itowlson/repos","events_url":"https://api.github.com/users/itowlson/events{/privacy}","received_events_url":"https://api.github.com/users/itowlson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-08T23:54:03Z","updated_at":"2018-05-09T02:15:42Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/pulls/211","html_url":"https://github.com/Azure/vscode-kubernetes-tools/pull/211","diff_url":"https://github.com/Azure/vscode-kubernetes-tools/pull/211.diff","patch_url":"https://github.com/Azure/vscode-kubernetes-tools/pull/211.patch"},"body":"Consider the following scenario:\r\n\r\n1. The user selects a resource in the tree view (or uses the `Load` command).\r\n2. The extension creates an untitled document containing the resource JSON.\r\n3. The user leaves the document open.\r\n4. Later, the user again selects the same resource (or uses the `Load` command to load it again).\r\n\r\nAt the moment, this has a bug where the second time, the resource JSON is appended to the existing document.  This PR loads each copy of the resource into a new document.  Documents are named e.g. `deployment-foo.json`, `deployment-foo.1.json`, `deployment-foo.2.json`, etc.\r\n\r\nA nice enhancement to this would be to compare the current JSON against the content of the existing document, and simply re-show that document if the resource had not changed.  This would avoid creating a lot of temp documents that the user has to close if they are simply browsing around in the tree.  (Alternatively, if the existing document was a temp document, I guess we could overwrite its contents with the new resource state...?)"},"comment":{"url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/issues/comments/387599147","html_url":"https://github.com/Azure/vscode-kubernetes-tools/pull/211#issuecomment-387599147","issue_url":"https://api.github.com/repos/Azure/vscode-kubernetes-tools/issues/211","id":387599147,"user":{"login":"bnookala","id":87996,"avatar_url":"https://avatars0.githubusercontent.com/u/87996?v=4","gravatar_id":"","url":"https://api.github.com/users/bnookala","html_url":"https://github.com/bnookala","followers_url":"https://api.github.com/users/bnookala/followers","following_url":"https://api.github.com/users/bnookala/following{/other_user}","gists_url":"https://api.github.com/users/bnookala/gists{/gist_id}","starred_url":"https://api.github.com/users/bnookala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnookala/subscriptions","organizations_url":"https://api.github.com/users/bnookala/orgs","repos_url":"https://api.github.com/users/bnookala/repos","events_url":"https://api.github.com/users/bnookala/events{/privacy}","received_events_url":"https://api.github.com/users/bnookala/received_events","type":"User","site_admin":false},"created_at":"2018-05-09T02:15:42Z","updated_at":"2018-05-09T02:15:42Z","author_association":"COLLABORATOR","body":"@itowlson I get why this is necessary... but would it be possible to do as you mentioned in your last paragraph and compare the current JSON of the temporary document, replacing it as necessary? I'd think a simple hash of the document contents would be a fairly reasonable approach to this. I really dislike the current behavior (as unavoidable as it is), and accidentally opening > 1 temporary document, and being prompted to save every single one would be even more annoying."}}
{"actor":{"display_login":"bnookala"}}