UNPKG

@jupyter-lsp/jupyterlab-lsp

Version:

Language Server Protocol integration for JupyterLab

29 lines (28 loc) 1.02 kB
import { IScopedCodeOverride } from '../../overrides/tokens'; /** * Line magics do not have to start with the new line, for example: * x = !ls * x = %ls * x =%ls * are all valid. * * The percent may also appear in strings, e.g. ls('%'). * * IPython allows magics on start of a line or in assignments (but only there!), thus: * x = (!ls) * is invalid syntax! * * Therefore we can require that the match starts with either: * - zero or more whitespaces right after the beginning of a line, or * - variable then equals (with optional whitespaces) * * This will not always work: e.g.: * x['a = !ls'] = !ls * is perfectly valid IPython, but regular expressions cannot help here. * * Look behind could be used to avoid capturing the group, * but at the time of writing support is only at 77%. */ export declare const LINE_MAGIC_PREFIX = "^(\\s*|\\s*\\S+\\s*=\\s*)"; export declare const PYTHON_IDENTIFIER = "([^?\\s'\"\\(\\)-\\+\\/#]+)"; export declare let overrides: IScopedCodeOverride[];