Format and fix type issues

This commit is contained in:
Laurent Nguyen 2020-08-27 16:43:39 +02:00
parent 35dbaeea96
commit 3bc2701356
4 changed files with 11 additions and 9 deletions

View File

@ -91,7 +91,7 @@ const makeMapStateToProps = (initialState: AppState, initialProps: IMonacoProps)
ownProps.notebookLanguageOverride
)
};
}
};
return mapStateToProps;
};

View File

@ -91,9 +91,9 @@ class CompletionItemProvider implements monaco.languages.CompletionItemProvider
const completion$ = channels.pipe(
childOf(message),
ofMessageType("complete_reply"),
map((entry) => entry.content),
map(entry => entry.content),
first(),
map((results) => this.adaptToMonacoCompletions(results, model))
map(results => this.adaptToMonacoCompletions(results, model))
);
// Subscribe and send completion request message
@ -112,7 +112,7 @@ class CompletionItemProvider implements monaco.languages.CompletionItemProvider
let percentCount = 0;
let matches = results ? results.matches : [];
if (results.metadata && results.metadata._jupyter_types_experimental) {
matches = results.metadata._jupyter_types_experimental;
matches = results.metadata._jupyter_types_experimental as CompletionMatch[];
}
return matches.map((match: CompletionMatch, index: number) => {
if (typeof match === "string") {

View File

@ -59,10 +59,7 @@ export const completionRequest = (code: string, cursorPos: number) =>
* @param js_idx JavaScript index
* @param text Text
*/
export const js_idx_to_char_idx: (js_idx: number, text: string) => number = (
js_idx: number,
text: string
): number => {
export const js_idx_to_char_idx: (js_idx: number, text: string) => number = (js_idx: number, text: string): number => {
let char_idx: number = js_idx;
for (let i = 0; i + 1 < text.length && i < js_idx; i++) {
const char_code: number = text.charCodeAt(i);

View File

@ -117,7 +117,12 @@ class BaseNotebookRenderer extends React.Component<NotebookRendererProps> {
{{
editor: {
codemirror: (props: PassedEditorProps) => (
<MonacoEditor {...props} lineNumbers={true} enableCompletion={true} shouldRegisterDefaultCompletion={true} />
<MonacoEditor
{...props}
lineNumbers={true}
enableCompletion={true}
shouldRegisterDefaultCompletion={true}
/>
)
},
prompt: ({ id, contentRef }: { id: CellId; contentRef: ContentRef }) => (