{"action":"created","comment":{"url":"https://api.github.com/repos/palantir/groovy-language-server/pulls/comments/75887508","id":75887508,"diff_hunk":"@@ -85,4 +86,47 @@ public static boolean contains(Range range, Position position) {\n                 && POSITION_COMPARATOR.compare(range.getEnd(), position) >= 0;\n     }\n \n+    /**\n+     * Returns the maximum position.\n+     */\n+    public static Position max(Position position1, Position position2) {\n+        return POSITION_COMPARATOR.compare(position1, position2) >= 0 ? position1 : position2;\n+    }\n+\n+    /**\n+     * Returns the minimum position.\n+     */\n+    public static Position min(Position position1, Position position2) {\n+        return POSITION_COMPARATOR.compare(position1, position2) < 0 ? position1 : position2;\n+    }\n+\n+    /**\n+     * Returns whether range1 and range2 intersect. Assumes that a range is inclusive on its start and exclusive on its\n+     * end, which means that if range1 ends on the same position as range2 starts, this is not considered intersecting.\n+     */\n+    public static boolean intersects(Range range1, Range range2) {\n+        checkArgument(isValid(range1), String.format(\"range1 is not valid: %s\", range1.toString()));\n+        checkArgument(isValid(range2), String.format(\"range2 is not valid: %s\", range2.toString()));\n+\n+        Position maxStart = max(range1.getStart(), range2.getStart());\n+        Position minEnd = min(range1.getEnd(), range2.getEnd());\n+        return maxStart.getLine() < minEnd.getLine()","path":"groovy-language-server/src/main/java/com/palantir/ls/util/Ranges.java","position":36,"original_position":36,"commit_id":"b041288d6b59eb47a61e66b4252fe83af24646cb","original_commit_id":"cd444f50b3d9ccaad3d064edb540faa62d297b98","user":{"login":"natgabb","id":5252500,"avatar_url":"https://avatars.githubusercontent.com/u/5252500?v=3","gravatar_id":"","url":"https://api.github.com/users/natgabb","html_url":"https://github.com/natgabb","followers_url":"https://api.github.com/users/natgabb/followers","following_url":"https://api.github.com/users/natgabb/following{/other_user}","gists_url":"https://api.github.com/users/natgabb/gists{/gist_id}","starred_url":"https://api.github.com/users/natgabb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natgabb/subscriptions","organizations_url":"https://api.github.com/users/natgabb/orgs","repos_url":"https://api.github.com/users/natgabb/repos","events_url":"https://api.github.com/users/natgabb/events{/privacy}","received_events_url":"https://api.github.com/users/natgabb/received_events","type":"User","site_admin":false},"body":"It's actually not the exact same as the POSITION_COMPARATOR because we check `maxStart.getCharacter() < minEnd.getCharacter()` strictly less since the end is exclusive on the character.","created_at":"2016-08-23T15:14:26Z","updated_at":"2016-08-23T15:14:26Z","html_url":"https://github.com/palantir/groovy-language-server/pull/69#discussion_r75887508","pull_request_url":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/palantir/groovy-language-server/pulls/comments/75887508"},"html":{"href":"https://github.com/palantir/groovy-language-server/pull/69#discussion_r75887508"},"pull_request":{"href":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69","id":82128229,"html_url":"https://github.com/palantir/groovy-language-server/pull/69","diff_url":"https://github.com/palantir/groovy-language-server/pull/69.diff","patch_url":"https://github.com/palantir/groovy-language-server/pull/69.patch","issue_url":"https://api.github.com/repos/palantir/groovy-language-server/issues/69","number":69,"state":"open","locked":false,"title":"Add Ranges#intersects","user":{"login":"natgabb","id":5252500,"avatar_url":"https://avatars.githubusercontent.com/u/5252500?v=3","gravatar_id":"","url":"https://api.github.com/users/natgabb","html_url":"https://github.com/natgabb","followers_url":"https://api.github.com/users/natgabb/followers","following_url":"https://api.github.com/users/natgabb/following{/other_user}","gists_url":"https://api.github.com/users/natgabb/gists{/gist_id}","starred_url":"https://api.github.com/users/natgabb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natgabb/subscriptions","organizations_url":"https://api.github.com/users/natgabb/orgs","repos_url":"https://api.github.com/users/natgabb/repos","events_url":"https://api.github.com/users/natgabb/events{/privacy}","received_events_url":"https://api.github.com/users/natgabb/received_events","type":"User","site_admin":false},"body":"- SourceWriter#applyChanges now makes sure that non of the given ranges intersect.\r\n\r\nCloses #60\r\n","created_at":"2016-08-22T02:52:48Z","updated_at":"2016-08-23T15:14:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1afce93c8b7afc2641d65e35e574a76b5dba684c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69/commits","review_comments_url":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69/comments","review_comment_url":"https://api.github.com/repos/palantir/groovy-language-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/palantir/groovy-language-server/issues/69/comments","statuses_url":"https://api.github.com/repos/palantir/groovy-language-server/statuses/b041288d6b59eb47a61e66b4252fe83af24646cb","head":{"label":"palantir:ng/add-ranges-intersect","ref":"ng/add-ranges-intersect","sha":"b041288d6b59eb47a61e66b4252fe83af24646cb","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":62839192,"name":"groovy-language-server","full_name":"palantir/groovy-language-server","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/groovy-language-server","description":null,"fork":false,"url":"https://api.github.com/repos/palantir/groovy-language-server","forks_url":"https://api.github.com/repos/palantir/groovy-language-server/forks","keys_url":"https://api.github.com/repos/palantir/groovy-language-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/groovy-language-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/groovy-language-server/teams","hooks_url":"https://api.github.com/repos/palantir/groovy-language-server/hooks","issue_events_url":"https://api.github.com/repos/palantir/groovy-language-server/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/groovy-language-server/events","assignees_url":"https://api.github.com/repos/palantir/groovy-language-server/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/groovy-language-server/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/groovy-language-server/tags","blobs_url":"https://api.github.com/repos/palantir/groovy-language-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/groovy-language-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/groovy-language-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/groovy-language-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/groovy-language-server/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/groovy-language-server/languages","stargazers_url":"https://api.github.com/repos/palantir/groovy-language-server/stargazers","contributors_url":"https://api.github.com/repos/palantir/groovy-language-server/contributors","subscribers_url":"https://api.github.com/repos/palantir/groovy-language-server/subscribers","subscription_url":"https://api.github.com/repos/palantir/groovy-language-server/subscription","commits_url":"https://api.github.com/repos/palantir/groovy-language-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/groovy-language-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/groovy-language-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/groovy-language-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/groovy-language-server/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/groovy-language-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/groovy-language-server/merges","archive_url":"https://api.github.com/repos/palantir/groovy-language-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/groovy-language-server/downloads","issues_url":"https://api.github.com/repos/palantir/groovy-language-server/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/groovy-language-server/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/groovy-language-server/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/groovy-language-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/groovy-language-server/labels{/name}","releases_url":"https://api.github.com/repos/palantir/groovy-language-server/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/groovy-language-server/deployments","created_at":"2016-07-07T21:28:35Z","updated_at":"2016-08-19T14:00:31Z","pushed_at":"2016-08-23T15:10:39Z","git_url":"git://github.com/palantir/groovy-language-server.git","ssh_url":"git@github.com:palantir/groovy-language-server.git","clone_url":"https://github.com/palantir/groovy-language-server.git","svn_url":"https://github.com/palantir/groovy-language-server","homepage":null,"size":241,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":25,"forks":0,"open_issues":25,"watchers":3,"default_branch":"develop"}},"base":{"label":"palantir:develop","ref":"develop","sha":"2ccdb00440ce70462b777815a0fb5f4e18a49045","user":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"repo":{"id":62839192,"name":"groovy-language-server","full_name":"palantir/groovy-language-server","owner":{"login":"palantir","id":303157,"avatar_url":"https://avatars.githubusercontent.com/u/303157?v=3","gravatar_id":"","url":"https://api.github.com/users/palantir","html_url":"https://github.com/palantir","followers_url":"https://api.github.com/users/palantir/followers","following_url":"https://api.github.com/users/palantir/following{/other_user}","gists_url":"https://api.github.com/users/palantir/gists{/gist_id}","starred_url":"https://api.github.com/users/palantir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/palantir/subscriptions","organizations_url":"https://api.github.com/users/palantir/orgs","repos_url":"https://api.github.com/users/palantir/repos","events_url":"https://api.github.com/users/palantir/events{/privacy}","received_events_url":"https://api.github.com/users/palantir/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/palantir/groovy-language-server","description":null,"fork":false,"url":"https://api.github.com/repos/palantir/groovy-language-server","forks_url":"https://api.github.com/repos/palantir/groovy-language-server/forks","keys_url":"https://api.github.com/repos/palantir/groovy-language-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/palantir/groovy-language-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/palantir/groovy-language-server/teams","hooks_url":"https://api.github.com/repos/palantir/groovy-language-server/hooks","issue_events_url":"https://api.github.com/repos/palantir/groovy-language-server/issues/events{/number}","events_url":"https://api.github.com/repos/palantir/groovy-language-server/events","assignees_url":"https://api.github.com/repos/palantir/groovy-language-server/assignees{/user}","branches_url":"https://api.github.com/repos/palantir/groovy-language-server/branches{/branch}","tags_url":"https://api.github.com/repos/palantir/groovy-language-server/tags","blobs_url":"https://api.github.com/repos/palantir/groovy-language-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/palantir/groovy-language-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/palantir/groovy-language-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/palantir/groovy-language-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/palantir/groovy-language-server/statuses/{sha}","languages_url":"https://api.github.com/repos/palantir/groovy-language-server/languages","stargazers_url":"https://api.github.com/repos/palantir/groovy-language-server/stargazers","contributors_url":"https://api.github.com/repos/palantir/groovy-language-server/contributors","subscribers_url":"https://api.github.com/repos/palantir/groovy-language-server/subscribers","subscription_url":"https://api.github.com/repos/palantir/groovy-language-server/subscription","commits_url":"https://api.github.com/repos/palantir/groovy-language-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/palantir/groovy-language-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/palantir/groovy-language-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/palantir/groovy-language-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/palantir/groovy-language-server/contents/{+path}","compare_url":"https://api.github.com/repos/palantir/groovy-language-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/palantir/groovy-language-server/merges","archive_url":"https://api.github.com/repos/palantir/groovy-language-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/palantir/groovy-language-server/downloads","issues_url":"https://api.github.com/repos/palantir/groovy-language-server/issues{/number}","pulls_url":"https://api.github.com/repos/palantir/groovy-language-server/pulls{/number}","milestones_url":"https://api.github.com/repos/palantir/groovy-language-server/milestones{/number}","notifications_url":"https://api.github.com/repos/palantir/groovy-language-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/palantir/groovy-language-server/labels{/name}","releases_url":"https://api.github.com/repos/palantir/groovy-language-server/releases{/id}","deployments_url":"https://api.github.com/repos/palantir/groovy-language-server/deployments","created_at":"2016-07-07T21:28:35Z","updated_at":"2016-08-19T14:00:31Z","pushed_at":"2016-08-23T15:10:39Z","git_url":"git://github.com/palantir/groovy-language-server.git","ssh_url":"git@github.com:palantir/groovy-language-server.git","clone_url":"https://github.com/palantir/groovy-language-server.git","svn_url":"https://github.com/palantir/groovy-language-server","homepage":null,"size":241,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":25,"forks":0,"open_issues":25,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69"},"html":{"href":"https://github.com/palantir/groovy-language-server/pull/69"},"issue":{"href":"https://api.github.com/repos/palantir/groovy-language-server/issues/69"},"comments":{"href":"https://api.github.com/repos/palantir/groovy-language-server/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/palantir/groovy-language-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/palantir/groovy-language-server/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/palantir/groovy-language-server/statuses/b041288d6b59eb47a61e66b4252fe83af24646cb"}}}}
{"actor":{"display_login":"natgabb"}}