{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/959","repository_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt","labels_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/959/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/959/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/959/events","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/959","id":150226039,"number":959,"title":"Implement proof of concept for formatting specific line ranges","user":{"login":"kamalmarhubi","id":50936,"avatar_url":"https://avatars.githubusercontent.com/u/50936?v=3","gravatar_id":"","url":"https://api.github.com/users/kamalmarhubi","html_url":"https://github.com/kamalmarhubi","followers_url":"https://api.github.com/users/kamalmarhubi/followers","following_url":"https://api.github.com/users/kamalmarhubi/following{/other_user}","gists_url":"https://api.github.com/users/kamalmarhubi/gists{/gist_id}","starred_url":"https://api.github.com/users/kamalmarhubi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamalmarhubi/subscriptions","organizations_url":"https://api.github.com/users/kamalmarhubi/orgs","repos_url":"https://api.github.com/users/kamalmarhubi/repos","events_url":"https://api.github.com/users/kamalmarhubi/events{/privacy}","received_events_url":"https://api.github.com/users/kamalmarhubi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-22T00:20:21Z","updated_at":"2016-04-26T02:35:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/pulls/959","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/959","diff_url":"https://github.com/rust-lang-nursery/rustfmt/pull/959.diff","patch_url":"https://github.com/rust-lang-nursery/rustfmt/pull/959.patch"},"body":"This series of commits adds a proof of concept of restricting formatting to specific line ranges, controlled by the `--experimental-file-lines` option. It includes a rough demonstration of formatting for statements. Later commits will extend this to more AST node type and refine the formatting more, and remove the `experimental-` prefix on the option name.\r\n\r\nThe goal is to make incremental formatting possible, and allow improving the formatting of a codebase one change at a time. This is much better than requiring that an entire project be formatted in one go in order to get the benefits of rustfmt. In later commits, we can add a tool to format a project based on a diff which will allow adding rustfmt to, eg, a git pre-commit hook without risk of introducing unrelated changes across a codebase.\r\n\r\nThere is some heuristic work needed to follow on from this to enable incremental formatting of all AST node types. For some, we will want to format when a change overlaps the AST node; for others, only when the change fully contains the AST node. As an example, we won't want to reformat an entire function because one line in it changed, but we would want to reformat an entire function signature if part of it changed. This will be done in later commits.\r\n\r\nOutline of the commits in the series:\r\n- commits 1-2 improve debuggability\r\n- commits 3-4 are refactorings to config to make way for the config field that tracks lines to be formatted\r\n- commit 5 moves some codemap related utilities to their own module\r\n- commit 6 adds utilities for working with line ranges, and looking up line ranges in the codemap\r\n- commit 7 adds a field to the `Config` struct to track lines to be formatted\r\n- commit 8 adds a proof of concept for formatting statements within the specified line ranges\r\n- commit 9 adds a command line option for specifying line ranges to be formatted\r\n\r\nRefs #434"},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/comments/214589334","html_url":"https://github.com/rust-lang-nursery/rustfmt/pull/959#issuecomment-214589334","issue_url":"https://api.github.com/repos/rust-lang-nursery/rustfmt/issues/959","id":214589334,"user":{"login":"nrc","id":762626,"avatar_url":"https://avatars.githubusercontent.com/u/762626?v=3","gravatar_id":"","url":"https://api.github.com/users/nrc","html_url":"https://github.com/nrc","followers_url":"https://api.github.com/users/nrc/followers","following_url":"https://api.github.com/users/nrc/following{/other_user}","gists_url":"https://api.github.com/users/nrc/gists{/gist_id}","starred_url":"https://api.github.com/users/nrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nrc/subscriptions","organizations_url":"https://api.github.com/users/nrc/orgs","repos_url":"https://api.github.com/users/nrc/repos","events_url":"https://api.github.com/users/nrc/events{/privacy}","received_events_url":"https://api.github.com/users/nrc/received_events","type":"User","site_admin":false},"created_at":"2016-04-26T02:35:48Z","updated_at":"2016-04-26T02:35:48Z","body":"I don't think you need the `experimental` prefix on the option - everything in Rustfmt is experimental for now!"}}