{"action":"created","issue":{"url":"https://api.github.com/repos/groovy/groovy-eclipse/issues/622","repository_url":"https://api.github.com/repos/groovy/groovy-eclipse","labels_url":"https://api.github.com/repos/groovy/groovy-eclipse/issues/622/labels{/name}","comments_url":"https://api.github.com/repos/groovy/groovy-eclipse/issues/622/comments","events_url":"https://api.github.com/repos/groovy/groovy-eclipse/issues/622/events","html_url":"https://github.com/groovy/groovy-eclipse/pull/622","id":338847958,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5Njc2NzM2","number":622,"title":"https://github.com/groovy/groovy-eclipse/issues/603","user":{"login":"ybayk","id":1779404,"node_id":"MDQ6VXNlcjE3Nzk0MDQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1779404?v=4","gravatar_id":"","url":"https://api.github.com/users/ybayk","html_url":"https://github.com/ybayk","followers_url":"https://api.github.com/users/ybayk/followers","following_url":"https://api.github.com/users/ybayk/following{/other_user}","gists_url":"https://api.github.com/users/ybayk/gists{/gist_id}","starred_url":"https://api.github.com/users/ybayk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ybayk/subscriptions","organizations_url":"https://api.github.com/users/ybayk/orgs","repos_url":"https://api.github.com/users/ybayk/repos","events_url":"https://api.github.com/users/ybayk/events{/privacy}","received_events_url":"https://api.github.com/users/ybayk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-07-06T08:20:20Z","updated_at":"2018-07-06T21:46:19Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/groovy/groovy-eclipse/pulls/622","html_url":"https://github.com/groovy/groovy-eclipse/pull/622","diff_url":"https://github.com/groovy/groovy-eclipse/pull/622.diff","patch_url":"https://github.com/groovy/groovy-eclipse/pull/622.patch"},"body":"A new boolean property `isBuilder` has been added to the `method` contribution.\r\nWhen it is not specified or set to false, the existing behavior is completely preserved.\r\n`isBuilder` is similar to `noParens`. It removes parentheses around arguments, however parentheses are forced when the method has a trailing closure.\r\n\r\nWhen isBuilder=true is specified, the following behavior is expected:\r\n\r\n1) For single-parameter methods with the parameter having Closure type\r\ne.g. `method name: 'bar', type: 'void', isBuilder: true, params: ['block':Closure]`\r\n\r\n- Selecting the proposal will lead to the state where the user can immediately start coding the closure block which is desired in a \"builder\" use case. \r\n`bar { | }`\r\n- **No parentheses** around the closure parameter regardless of the Content Assist preferences.\r\n- **it** is suppressed from the proposed closure literal\r\n\r\n2) For multi-parameter methods with a trailing Closure parameter:\r\ne.g. `method name: 'bar', type: 'void', isBuilder: true, namedParams:['name':String], params: ['block':Closure]`\r\n- Selecting the proposal will lead to the parameter editing mode:\r\n![image](https://user-images.githubusercontent.com/1779404/42363056-d3915d00-80aa-11e8-9ddd-87ffe84be8d1.png)\r\n- After completion (Enter key) the caret will be automatically placed in a middle of the Closure block.\r\n- Parentheses are **forced** around the parameter list, but it **excludes** the trailing closure regardless of the Content Assist preferences.\r\n- **it** is suppressed from the proposed closure literal\r\n\r\n3) For methods without a trailing Closure, behavior is identical to `noParens=true`\r\ne.g. `method name: 'bar', type: 'void', isBuilder: true, namedParams:['name':String], params: ['regular':String]`\r\nThe resulting proposal will look like the following:\r\n`bar name: name, regular`\r\n- **No parentheses** around the parameters\r\n\r\nThe above change will make [groovy builders](http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-specific-languages.html#_builders) generally expressed in DSLD. Also it will make builders less time consuming and less confusing to use by DSLD consumers.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/groovy/groovy-eclipse/issues/comments/403154654","html_url":"https://github.com/groovy/groovy-eclipse/pull/622#issuecomment-403154654","issue_url":"https://api.github.com/repos/groovy/groovy-eclipse/issues/622","id":403154654,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzE1NDY1NA==","user":{"login":"eric-milles","id":18193802,"node_id":"MDQ6VXNlcjE4MTkzODAy","avatar_url":"https://avatars3.githubusercontent.com/u/18193802?v=4","gravatar_id":"","url":"https://api.github.com/users/eric-milles","html_url":"https://github.com/eric-milles","followers_url":"https://api.github.com/users/eric-milles/followers","following_url":"https://api.github.com/users/eric-milles/following{/other_user}","gists_url":"https://api.github.com/users/eric-milles/gists{/gist_id}","starred_url":"https://api.github.com/users/eric-milles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eric-milles/subscriptions","organizations_url":"https://api.github.com/users/eric-milles/orgs","repos_url":"https://api.github.com/users/eric-milles/repos","events_url":"https://api.github.com/users/eric-milles/events{/privacy}","received_events_url":"https://api.github.com/users/eric-milles/received_events","type":"User","site_admin":false},"created_at":"2018-07-06T21:46:18Z","updated_at":"2018-07-06T21:46:18Z","author_association":"CONTRIBUTOR","body":"Your first two examples in the initial comment can be attained with `useNamedArgs`.  Given `method name: 'bar', type: void, useNamedArgs: true, params: ['name':String, 'block':Closure]` content assist would insert: `bar(name: null) { }`\r\n\r\nWhen method does not have trailing closure, isn't it for the user to decide if parenthesis are desired (via content assist pref)?  Otherwise, `noParens` exists to remove.\r\n\r\nI'm not sure I understand wanting parens in one case and not in another.  What I am driving at is there are at least 2 settings in the DSLD and several more in content assist prefs to control this stuff.  But you seem stuck on associating a tuple of these settings to 1 single flag.  But if I get a request for another mix of settings how would I handle that?\r\n\r\nAs I stated in #603, I'd prefer to tackle each of the content assist problems as separately as possible and I would choose new DSLD API as a last resort solution.  It may be beneficial for named arguments or trailing closures in general to make a non-DSLD change."}}
{"actor":{"display_login":"eric-milles"}}