mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(editor): Update Code node editor for native Python runner (#18538)
This commit is contained in:
@@ -24,7 +24,20 @@ export const useCompleter = (
|
||||
mode: MaybeRefOrGetter<CodeExecutionMode>,
|
||||
editor: MaybeRefOrGetter<EditorView | null>,
|
||||
) => {
|
||||
function autocompletionExtension(language: 'javaScript' | 'python'): Extension {
|
||||
function autocompletionExtension(language: 'javaScript' | 'python' | 'pythonNative'): Extension {
|
||||
if (language === 'pythonNative') {
|
||||
const completions = (context: CompletionContext): CompletionResult | null => {
|
||||
const word = context.matchBefore(/\w*/);
|
||||
if (!word) return null;
|
||||
|
||||
const label = toValue(mode) === 'runOnceForEachItem' ? '_item' : '_items';
|
||||
|
||||
return { from: word.from, options: [{ label, type: 'variable' }] };
|
||||
};
|
||||
|
||||
return autocompletion({ icons: false, override: [completions] });
|
||||
}
|
||||
|
||||
// Base completions
|
||||
const { baseCompletions, itemCompletions, nodeSelectorCompletions } = useBaseCompletions(
|
||||
toValue(mode),
|
||||
|
||||
Reference in New Issue
Block a user