-
Notifications
You must be signed in to change notification settings - Fork 758
Improve JSX syntax highlighting #4539
Changes from 8 commits
2020e97
2e2aa7e
2f98f11
421cf8f
dedf024
7499b61
2d0f1a9
b524f3c
5e38111
7b4e0c4
3ddfe62
0df2abc
7b46bf2
5b8cdad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ function makeMarker(isDisabled: boolean) { | |
type Props = { | ||
breakpoint: Object, | ||
selectedSource: Object, | ||
editor: Object | ||
editor: Object, | ||
metaData: Object | ||
}; | ||
|
||
class Breakpoint extends Component<Props> { | ||
|
@@ -36,7 +37,7 @@ class Breakpoint extends Component<Props> { | |
} | ||
|
||
addBreakpoint() { | ||
const { breakpoint, editor, selectedSource } = this.props; | ||
const { breakpoint, editor, selectedSource, metaData } = this.props; | ||
|
||
// Hidden Breakpoints are never rendered on the client | ||
if (breakpoint.hidden) { | ||
|
@@ -52,7 +53,7 @@ class Breakpoint extends Component<Props> { | |
const sourceId = selectedSource.get("id"); | ||
const line = toEditorLine(sourceId, breakpoint.location.line); | ||
|
||
showSourceText(editor, selectedSource.toJS()); | ||
showSourceText(editor, selectedSource.toJS(), metaData); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @codehag do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why this is in addBreakpoint to be honest. this shouldnt be taken care of here -- it should be done with the lifecycle update... in fact the same can be said about everything that is happening with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahh ok i understand better. the naming is a bit off -- this should probably be renderBreakpoint; still not sure if we need showSourceText... this was added here: #3294 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed #4579 and we can come back |
||
|
||
editor.codeMirror.setGutterMarker( | ||
line, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,12 @@ type EmptyLinesType = number[]; | |
export type SymbolsMap = Map<string, SymbolDeclarations>; | ||
export type EmptyLinesMap = Map<string, EmptyLinesType>; | ||
|
||
export type SourceMetaDataType = { | ||
isReactComponent: boolean | ||
}; | ||
|
||
export type SourceMetaDataMap = Map<string, SourceMetaDataType>; | ||
|
||
export type Preview = | ||
| {| updating: true |} | ||
| null | ||
|
@@ -38,7 +44,8 @@ export type ASTState = { | |
symbols: SymbolsMap, | ||
emptyLines: EmptyLinesMap, | ||
outOfScopeLocations: ?Array<AstLocation>, | ||
preview: Preview | ||
preview: Preview, | ||
metaData: SourceMetaDataMap | ||
}; | ||
|
||
export function initialState() { | ||
|
@@ -47,7 +54,8 @@ export function initialState() { | |
symbols: I.Map(), | ||
emptyLines: I.Map(), | ||
outOfScopeLocations: null, | ||
preview: null | ||
preview: null, | ||
metaData: I.Map() | ||
}: ASTState) | ||
)(); | ||
} | ||
|
@@ -111,6 +119,10 @@ function update( | |
return initialState(); | ||
} | ||
|
||
case "SET_SOURCE_METADATA": { | ||
return state.set("metaData", action.metaData); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahh, I'd change this to look like empty lines: |
||
} | ||
|
||
default: { | ||
return state; | ||
} | ||
|
@@ -167,4 +179,8 @@ export function getPreview(state: OuterState) { | |
return state.ast.get("preview"); | ||
} | ||
|
||
export function getMetaData(state: OuterState) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, i think this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we need source for in this selector? |
||
return state.ast.get("metaData"); | ||
} | ||
|
||
export default update; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add a jest unit test for this next to
setSymbols