diff --git a/frontend/components/CellInput/LiveDocsFromCursor.js b/frontend/components/CellInput/LiveDocsFromCursor.js index 6e89f344f5..a2cd0ffdbf 100644 --- a/frontend/components/CellInput/LiveDocsFromCursor.js +++ b/frontend/components/CellInput/LiveDocsFromCursor.js @@ -244,8 +244,7 @@ export let get_selected_doc_from_state = (/** @type {EditorState} */ state, verb if ( cursor.name === "Identifier" && parent.name === "ArgumentList" && - (parent.parent.parent.name === "FunctionAssignmentExpression" || - parent.parent.name === "FunctionDefinition") + (parent.parent.parent.name === "FunctionAssignmentExpression" || parent.parent.name === "FunctionDefinition") ) { continue } @@ -297,7 +296,6 @@ export let get_selected_doc_from_state = (/** @type {EditorState} */ state, verb if (VALID_DOCS_TYPES.includes(cursor.name) || keywords_that_have_docs_and_are_cool.includes(cursor.name)) { if (!is_docs_searchable(cursor)) { - console.log("NOT DOCS SEARCHABLE") return undefined } diff --git a/frontend/components/CellInput/pluto_autocomplete.js b/frontend/components/CellInput/pluto_autocomplete.js index 9fc7436b29..1711cabc80 100644 --- a/frontend/components/CellInput/pluto_autocomplete.js +++ b/frontend/components/CellInput/pluto_autocomplete.js @@ -194,7 +194,7 @@ const section_operators = { rank: 1, } -const field_rank_heuristic = (text) => (/^\p{Ll}/u.test(text) ? 3 : /^\p{Lu}/u.test(text) ? 2 : 1) +const field_rank_heuristic = (text, is_exported) => is_exported * 3 + (/^\p{Ll}/u.test(text) ? 2 : /^\p{Lu}/u.test(text) ? 1 : 0) const julia_commit_characters = [".", ",", "(", "[", "{"] const endswith_keyword_regex = @@ -266,6 +266,8 @@ const julia_code_completions_to_cm = let text_to_apply = completion_type === "method" ? to_complete : is_field_expression ? override_text_to_apply_in_field_expression(text) ?? text : text + value_type = value_type === "Function" && text.startsWith("@") ? "Macro" : value_type + return { label: text, apply: text_to_apply, @@ -277,14 +279,9 @@ const julia_code_completions_to_cm = c_from_notebook: is_from_notebook, }) ?? undefined, section: section_regular, + // detail: completion_type, boost: - completion_type === "keyword_argument" - ? 1 - : is_listing_all_fields_of_a_module - ? is_exported - ? field_rank_heuristic(text_to_apply) - : undefined - : undefined, + completion_type === "keyword_argument" ? 7 : is_field_expression ? field_rank_heuristic(text_to_apply, is_exported) : undefined, // boost: 50 - i / results.length, } }), @@ -434,6 +431,7 @@ const special_symbols_completion = (/** @type {() => Promise} * label, apply: value != null && (!is_inside_string || is_emoji) ? value : label, detail: value ?? undefined, + type: "c_special_symbol", boost: label === "\\in" ? 3 : special_latex_examples.includes(label) ? 2 : special_emoji_examples.includes(value) ? 1 : 0, } }) diff --git a/frontend/editor.css b/frontend/editor.css index 74b6dee8d1..0eeab2158f 100644 --- a/frontend/editor.css +++ b/frontend/editor.css @@ -3472,6 +3472,10 @@ pluto-cell.errored .cm-editor .cm-lineNumbers .cm-gutterElement::after { color: var(--cm-string-color); } +.cm-completionIcon-completion_property::before { + color: var(--cm-property-color); +} + .cm-completionIcon-completion_keyword::before { color: var(--cm-keyword-color); } @@ -3494,6 +3498,9 @@ pluto-popup code.auto_disabled_variable { .cm-completionIcon-c_Function::before { color: var(--cm-function-color); } +.cm-completionIcon-c_Macro::before { + color: var(--cm-macro-color); +} .cm-completionIcon-c_Array::before { color: var(--cm-bracket-color);