Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 728b974

Browse files
authored
Merge pull request #1995 from atom/all/review-comments
Reviews dock item
2 parents b4e7844 + dcd0ad6 commit 728b974

File tree

202 files changed

+23772
-5350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+23772
-5350
lines changed

graphql/schema.graphql

Lines changed: 2267 additions & 452 deletions
Large diffs are not rendered by default.

img/mona.svg

Lines changed: 75 additions & 0 deletions
Loading

keymaps/git.cson

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'alt-g p': 'github:push'
1010
'alt-g shift-p': 'github:force-push'
1111
'alt-g =': 'github:clone'
12+
'alt-g r': 'github:open-reviews-tab'
1213

1314
'atom-text-editor':
1415
'alt-m 1': 'github:resolve-as-ours'
@@ -132,3 +133,20 @@
132133
'end': 'github:co-author:end'
133134
'delete': 'github:co-author:delete'
134135
'shift-backspace': 'github:co-author-exclude'
136+
137+
'.platform-darwin .github-Reviews':
138+
'cmd-=': 'github:more-context'
139+
'cmd--': 'github:less-context'
140+
'.platform-win32 .github-Reviews':
141+
'ctrl-=': 'github:more-context'
142+
'ctrl--': 'github:less-context'
143+
'.platform-linux .github-Reviews':
144+
'ctrl-=': 'github:more-context'
145+
'ctrl--': 'github:less-context'
146+
147+
'.platform-darwin .github-Review-reply atom-text-editor':
148+
'cmd-enter': 'github:submit-comment'
149+
'.platform-win32 .github-Review-reply atom-text-editor':
150+
'ctrl-enter': 'github:submit-comment'
151+
'.platform-linux .github-Review-reply atom-text-editor':
152+
'ctrl-enter': 'github:submit-comment'

lib/atom/atom-text-editor.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const editorUpdateProps = {
1818
};
1919

2020
const editorCreationProps = {
21-
buffer: PropTypes.object, // FIXME make proptype more specific
21+
buffer: PropTypes.object,
2222
...editorUpdateProps,
2323
};
2424

@@ -30,8 +30,6 @@ export default class AtomTextEditor extends React.Component {
3030
static propTypes = {
3131
...editorCreationProps,
3232

33-
workspace: PropTypes.object.isRequired,
34-
3533
didChangeCursorPosition: PropTypes.func,
3634
didAddSelection: PropTypes.func,
3735
didChangeSelectionRange: PropTypes.func,

lib/atom/decoration.js

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ class BareDecoration extends React.Component {
4444
this.decorationHolder = new RefHolder();
4545
this.editorSub = new Disposable();
4646
this.decorableSub = new Disposable();
47+
this.gutterSub = new Disposable();
4748

4849
this.domNode = null;
4950
this.item = null;
51+
5052
if (['gutter', 'overlay', 'block'].includes(this.props.type)) {
5153
this.domNode = document.createElement('div');
5254
this.domNode.className = cx('react-atom-decoration', this.props.className);
@@ -115,6 +117,23 @@ class BareDecoration extends React.Component {
115117
return;
116118
}
117119

120+
// delay decoration creation when it's a gutter type;
121+
// instead wait for the Gutter to be added to the editor first
122+
if (this.props.type === 'gutter') {
123+
if (!this.props.gutterName) {
124+
throw new Error('You are trying to decorate a gutter but did not supply gutterName prop.');
125+
}
126+
this.props.editorHolder.map(editor => {
127+
this.gutterSub = editor.observeGutters(gutter => {
128+
if (gutter.name === this.props.gutterName) {
129+
this.createDecoration();
130+
}
131+
});
132+
return null;
133+
});
134+
return;
135+
}
136+
118137
this.createDecoration();
119138
}
120139

@@ -126,7 +145,6 @@ class BareDecoration extends React.Component {
126145
const opts = this.getDecorationOpts(this.props);
127146
const editor = this.props.editorHolder.get();
128147
const decorable = this.props.decorableHolder.get();
129-
130148
this.decorationHolder.setter(
131149
editor[this.props.decorateMethod](decorable, opts),
132150
);
@@ -136,6 +154,7 @@ class BareDecoration extends React.Component {
136154
this.decorationHolder.map(decoration => decoration.destroy());
137155
this.editorSub.dispose();
138156
this.decorableSub.dispose();
157+
this.gutterSub.dispose();
139158
}
140159

141160
getDecorationOpts(props) {
@@ -150,6 +169,7 @@ export default class Decoration extends React.Component {
150169
static propTypes = {
151170
editor: PropTypes.object,
152171
decorable: PropTypes.object,
172+
decorateMethod: PropTypes.oneOf(['decorateMarker', 'decorateMarkerLayer']),
153173
}
154174

155175
constructor(props) {
@@ -184,28 +204,30 @@ export default class Decoration extends React.Component {
184204
}
185205

186206
render() {
187-
if (!this.state.editorHolder.isEmpty() && !this.state.decorableHolder.isEmpty()) {
188-
return (
189-
<BareDecoration
190-
{...this.props}
191-
editorHolder={this.state.editorHolder}
192-
decorableHolder={this.state.decorableHolder}
193-
/>
194-
);
195-
}
196-
197207
return (
198208
<TextEditorContext.Consumer>
199209
{editorHolder => (
200210
<DecorableContext.Consumer>
201-
{({holder, decorateMethod}) => (
202-
<BareDecoration
203-
editorHolder={editorHolder}
204-
decorableHolder={holder}
205-
decorateMethod={decorateMethod}
206-
{...this.props}
207-
/>
208-
)}
211+
{decorable => {
212+
let holder = null;
213+
let decorateMethod = null;
214+
if (!this.state.decorableHolder.isEmpty()) {
215+
holder = this.state.decorableHolder;
216+
decorateMethod = this.props.decorateMethod;
217+
} else {
218+
holder = decorable.holder;
219+
decorateMethod = decorable.decorateMethod;
220+
}
221+
222+
return (
223+
<BareDecoration
224+
editorHolder={editorHolder || this.state.editorHolder}
225+
decorableHolder={holder}
226+
decorateMethod={decorateMethod}
227+
{...this.props}
228+
/>
229+
);
230+
}}
209231
</DecorableContext.Consumer>
210232
)}
211233
</TextEditorContext.Consumer>

lib/atom/marker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const MarkablePropType = PropTypes.shape({
1313
});
1414

1515
const markerProps = {
16+
exclusive: PropTypes.bool,
1617
reversed: PropTypes.bool,
1718
invalidate: PropTypes.oneOf(['never', 'surround', 'overlap', 'inside', 'touch']),
1819
};

lib/atom/pane-item.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class OpenItem {
173173
this.domNode.tabIndex = '-1';
174174
this.domNode.onfocus = this.onFocus.bind(this);
175175
this.stubItem = stub;
176+
this.stubProps = stub ? stub.props : {};
176177
this.match = match;
177178
this.itemHolder = new RefHolder();
178179
}
@@ -202,15 +203,15 @@ class OpenItem {
202203
}
203204

204205
getStubProps() {
205-
if (!this.itemHolder.isEmpty()) {
206-
const item = this.itemHolder.get();
207-
return {
208-
title: item.getTitle ? item.getTitle() : null,
209-
iconName: item.getIconName ? item.getIconName() : null,
210-
};
211-
} else {
212-
return {};
213-
}
206+
const itemProps = this.itemHolder.map(item => ({
207+
title: item.getTitle ? item.getTitle() : null,
208+
iconName: item.getIconName ? item.getIconName() : null,
209+
}));
210+
211+
return {
212+
...this.stubProps,
213+
...itemProps,
214+
};
214215
}
215216

216217
onFocus() {
@@ -220,6 +221,7 @@ class OpenItem {
220221
renderPortal(renderProp) {
221222
return ReactDOM.createPortal(
222223
renderProp({
224+
deserialized: this.stubProps,
223225
itemHolder: this.itemHolder,
224226
params: this.match.getParams(),
225227
uri: this.match.getURI(),

lib/atom/tooltip.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default class Tooltip extends React.Component {
3636
keyBindingTarget: PropTypes.element,
3737
children: PropTypes.element,
3838
itemHolder: RefHolderPropType,
39+
tooltipHolder: RefHolderPropType,
3940
}
4041

4142
static defaultProps = {
@@ -126,6 +127,10 @@ export default class Tooltip extends React.Component {
126127
this.refSub = this.props.target.observe(t => {
127128
this.tipSub.dispose();
128129
this.tipSub = this.props.manager.add(t, options);
130+
const h = this.props.tooltipHolder;
131+
if (h) {
132+
h.setter(this.tipSub);
133+
}
129134
});
130135
}
131136
}

0 commit comments

Comments
 (0)