groove-dev 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/FILE-EDITOR-PLAN.md +253 -0
- package/node_modules/@codemirror/autocomplete/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/autocomplete/CHANGELOG.md +639 -0
- package/node_modules/@codemirror/autocomplete/LICENSE +21 -0
- package/node_modules/@codemirror/autocomplete/README.md +43 -0
- package/node_modules/@codemirror/autocomplete/dist/index.cjs +2151 -0
- package/node_modules/@codemirror/autocomplete/dist/index.d.cts +648 -0
- package/node_modules/@codemirror/autocomplete/dist/index.d.ts +648 -0
- package/node_modules/@codemirror/autocomplete/dist/index.js +2120 -0
- package/node_modules/@codemirror/autocomplete/package.json +41 -0
- package/node_modules/@codemirror/commands/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/commands/CHANGELOG.md +386 -0
- package/node_modules/@codemirror/commands/LICENSE +21 -0
- package/node_modules/@codemirror/commands/README.md +35 -0
- package/node_modules/@codemirror/commands/dist/index.cjs +1909 -0
- package/node_modules/@codemirror/commands/dist/index.d.cts +650 -0
- package/node_modules/@codemirror/commands/dist/index.d.ts +650 -0
- package/node_modules/@codemirror/commands/dist/index.js +1795 -0
- package/node_modules/@codemirror/commands/package.json +42 -0
- package/node_modules/@codemirror/lang-css/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lang-css/CHANGELOG.md +106 -0
- package/node_modules/@codemirror/lang-css/LICENSE +21 -0
- package/node_modules/@codemirror/lang-css/README.md +50 -0
- package/node_modules/@codemirror/lang-css/dist/index.cjs +269 -0
- package/node_modules/@codemirror/lang-css/dist/index.d.cts +28 -0
- package/node_modules/@codemirror/lang-css/dist/index.d.ts +28 -0
- package/node_modules/@codemirror/lang-css/dist/index.js +264 -0
- package/node_modules/@codemirror/lang-css/package.json +42 -0
- package/node_modules/@codemirror/lang-html/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lang-html/CHANGELOG.md +210 -0
- package/node_modules/@codemirror/lang-html/LICENSE +21 -0
- package/node_modules/@codemirror/lang-html/README.md +147 -0
- package/node_modules/@codemirror/lang-html/dist/index.cjs +667 -0
- package/node_modules/@codemirror/lang-html/dist/index.d.cts +115 -0
- package/node_modules/@codemirror/lang-html/dist/index.d.ts +115 -0
- package/node_modules/@codemirror/lang-html/dist/index.js +661 -0
- package/node_modules/@codemirror/lang-html/package.json +46 -0
- package/node_modules/@codemirror/lang-javascript/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lang-javascript/CHANGELOG.md +206 -0
- package/node_modules/@codemirror/lang-javascript/LICENSE +21 -0
- package/node_modules/@codemirror/lang-javascript/README.md +125 -0
- package/node_modules/@codemirror/lang-javascript/dist/index.cjs +526 -0
- package/node_modules/@codemirror/lang-javascript/dist/index.d.cts +93 -0
- package/node_modules/@codemirror/lang-javascript/dist/index.d.ts +93 -0
- package/node_modules/@codemirror/lang-javascript/dist/index.js +513 -0
- package/node_modules/@codemirror/lang-javascript/package.json +45 -0
- package/node_modules/@codemirror/lang-json/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lang-json/CHANGELOG.md +59 -0
- package/node_modules/@codemirror/lang-json/LICENSE +21 -0
- package/node_modules/@codemirror/lang-json/README.md +56 -0
- package/node_modules/@codemirror/lang-json/dist/index.cjs +68 -0
- package/node_modules/@codemirror/lang-json/dist/index.d.cts +22 -0
- package/node_modules/@codemirror/lang-json/dist/index.d.ts +22 -0
- package/node_modules/@codemirror/lang-json/dist/index.js +64 -0
- package/node_modules/@codemirror/lang-json/package.json +39 -0
- package/node_modules/@codemirror/lang-markdown/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lang-markdown/CHANGELOG.md +246 -0
- package/node_modules/@codemirror/lang-markdown/LICENSE +21 -0
- package/node_modules/@codemirror/lang-markdown/README.md +162 -0
- package/node_modules/@codemirror/lang-markdown/dist/index.cjs +501 -0
- package/node_modules/@codemirror/lang-markdown/dist/index.d.cts +124 -0
- package/node_modules/@codemirror/lang-markdown/dist/index.d.ts +124 -0
- package/node_modules/@codemirror/lang-markdown/dist/index.js +492 -0
- package/node_modules/@codemirror/lang-markdown/package.json +44 -0
- package/node_modules/@codemirror/lang-python/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lang-python/CHANGELOG.md +174 -0
- package/node_modules/@codemirror/lang-python/LICENSE +21 -0
- package/node_modules/@codemirror/lang-python/README.md +61 -0
- package/node_modules/@codemirror/lang-python/dist/index.cjs +313 -0
- package/node_modules/@codemirror/lang-python/dist/index.d.cts +26 -0
- package/node_modules/@codemirror/lang-python/dist/index.d.ts +26 -0
- package/node_modules/@codemirror/lang-python/dist/index.js +308 -0
- package/node_modules/@codemirror/lang-python/package.json +42 -0
- package/node_modules/@codemirror/language/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/language/CHANGELOG.md +412 -0
- package/node_modules/@codemirror/language/LICENSE +21 -0
- package/node_modules/@codemirror/language/README.md +66 -0
- package/node_modules/@codemirror/language/dist/index.cjs +2742 -0
- package/node_modules/@codemirror/language/dist/index.d.cts +1220 -0
- package/node_modules/@codemirror/language/dist/index.d.ts +1220 -0
- package/node_modules/@codemirror/language/dist/index.js +2687 -0
- package/node_modules/@codemirror/language/package.json +44 -0
- package/node_modules/@codemirror/lint/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/lint/CHANGELOG.md +318 -0
- package/node_modules/@codemirror/lint/LICENSE +21 -0
- package/node_modules/@codemirror/lint/README.md +18 -0
- package/node_modules/@codemirror/lint/dist/index.cjs +958 -0
- package/node_modules/@codemirror/lint/dist/index.d.cts +195 -0
- package/node_modules/@codemirror/lint/dist/index.d.ts +195 -0
- package/node_modules/@codemirror/lint/dist/index.js +945 -0
- package/node_modules/@codemirror/lint/package.json +40 -0
- package/node_modules/@codemirror/search/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/search/CHANGELOG.md +324 -0
- package/node_modules/@codemirror/search/LICENSE +21 -0
- package/node_modules/@codemirror/search/README.md +18 -0
- package/node_modules/@codemirror/search/dist/index.cjs +1237 -0
- package/node_modules/@codemirror/search/dist/index.d.cts +385 -0
- package/node_modules/@codemirror/search/dist/index.d.ts +385 -0
- package/node_modules/@codemirror/search/dist/index.js +1217 -0
- package/node_modules/@codemirror/search/package.json +40 -0
- package/node_modules/@codemirror/state/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/state/CHANGELOG.md +308 -0
- package/node_modules/@codemirror/state/LICENSE +21 -0
- package/node_modules/@codemirror/state/README.md +18 -0
- package/node_modules/@codemirror/state/dist/index.cjs +3922 -0
- package/node_modules/@codemirror/state/dist/index.d.cts +1713 -0
- package/node_modules/@codemirror/state/dist/index.d.ts +1713 -0
- package/node_modules/@codemirror/state/dist/index.js +3892 -0
- package/node_modules/@codemirror/state/package.json +38 -0
- package/node_modules/@codemirror/theme-one-dark/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/theme-one-dark/CHANGELOG.md +97 -0
- package/node_modules/@codemirror/theme-one-dark/LICENSE +21 -0
- package/node_modules/@codemirror/theme-one-dark/README.md +46 -0
- package/node_modules/@codemirror/theme-one-dark/dist/index.cjs +139 -0
- package/node_modules/@codemirror/theme-one-dark/dist/index.d.cts +39 -0
- package/node_modules/@codemirror/theme-one-dark/dist/index.d.ts +39 -0
- package/node_modules/@codemirror/theme-one-dark/dist/index.js +134 -0
- package/node_modules/@codemirror/theme-one-dark/package.json +41 -0
- package/node_modules/@codemirror/view/.github/workflows/dispatch.yml +16 -0
- package/node_modules/@codemirror/view/CHANGELOG.md +2284 -0
- package/node_modules/@codemirror/view/LICENSE +21 -0
- package/node_modules/@codemirror/view/README.md +37 -0
- package/node_modules/@codemirror/view/dist/index.cjs +11796 -0
- package/node_modules/@codemirror/view/dist/index.d.cts +2389 -0
- package/node_modules/@codemirror/view/dist/index.d.ts +2389 -0
- package/node_modules/@codemirror/view/dist/index.js +11745 -0
- package/node_modules/@codemirror/view/package.json +41 -0
- package/node_modules/@groove-dev/daemon/src/api.js +157 -2
- package/node_modules/@groove-dev/daemon/src/filewatcher.js +59 -0
- package/node_modules/@groove-dev/daemon/src/index.js +28 -1
- package/node_modules/@groove-dev/daemon/src/skills.js +20 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-Dxg9hdf3.js +103 -0
- package/node_modules/@groove-dev/gui/dist/index.html +1 -1
- package/node_modules/@groove-dev/gui/package.json +15 -2
- package/node_modules/@groove-dev/gui/src/App.jsx +3 -0
- package/node_modules/@groove-dev/gui/src/components/CodeEditor.jsx +143 -0
- package/node_modules/@groove-dev/gui/src/components/EditorTabs.jsx +83 -0
- package/node_modules/@groove-dev/gui/src/components/FileTree.jsx +193 -0
- package/node_modules/@groove-dev/gui/src/stores/groove.js +158 -1
- package/node_modules/@groove-dev/gui/src/views/FileEditor.jsx +142 -0
- package/node_modules/@groove-dev/gui/src/views/SkillsMarketplace.jsx +112 -1
- package/node_modules/@lezer/common/LICENSE +21 -0
- package/node_modules/@lezer/common/README.md +14 -0
- package/node_modules/@lezer/common/dist/index.cjs +2209 -0
- package/node_modules/@lezer/common/dist/index.d.cts +1174 -0
- package/node_modules/@lezer/common/dist/index.d.ts +1174 -0
- package/node_modules/@lezer/common/dist/index.js +2196 -0
- package/node_modules/@lezer/common/package.json +32 -0
- package/node_modules/@lezer/css/CHANGELOG.md +307 -0
- package/node_modules/@lezer/css/LICENSE +21 -0
- package/node_modules/@lezer/css/README.md +6 -0
- package/node_modules/@lezer/css/dist/index.cjs +151 -0
- package/node_modules/@lezer/css/dist/index.d.cts +3 -0
- package/node_modules/@lezer/css/dist/index.d.ts +3 -0
- package/node_modules/@lezer/css/dist/index.js +147 -0
- package/node_modules/@lezer/css/package.json +36 -0
- package/node_modules/@lezer/css/rollup.config.js +16 -0
- package/node_modules/@lezer/css/src/css.grammar +290 -0
- package/node_modules/@lezer/css/src/highlight.js +36 -0
- package/node_modules/@lezer/css/src/parser.js +31 -0
- package/node_modules/@lezer/css/src/parser.terms.js +63 -0
- package/node_modules/@lezer/css/src/tokens.js +75 -0
- package/node_modules/@lezer/css/test/declarations.txt +241 -0
- package/node_modules/@lezer/css/test/selector.txt +178 -0
- package/node_modules/@lezer/css/test/statements.txt +227 -0
- package/node_modules/@lezer/css/test/test-css.js +16 -0
- package/node_modules/@lezer/highlight/LICENSE +21 -0
- package/node_modules/@lezer/highlight/README.md +14 -0
- package/node_modules/@lezer/highlight/dist/index.cjs +936 -0
- package/node_modules/@lezer/highlight/dist/index.d.cts +623 -0
- package/node_modules/@lezer/highlight/dist/index.d.ts +623 -0
- package/node_modules/@lezer/highlight/dist/index.js +927 -0
- package/node_modules/@lezer/highlight/package.json +31 -0
- package/node_modules/@lezer/html/CHANGELOG.md +303 -0
- package/node_modules/@lezer/html/LICENSE +21 -0
- package/node_modules/@lezer/html/README.md +37 -0
- package/node_modules/@lezer/html/dist/index.cjs +354 -0
- package/node_modules/@lezer/html/dist/index.d.cts +14 -0
- package/node_modules/@lezer/html/dist/index.d.ts +14 -0
- package/node_modules/@lezer/html/dist/index.js +349 -0
- package/node_modules/@lezer/html/package.json +37 -0
- package/node_modules/@lezer/html/rollup.config.js +16 -0
- package/node_modules/@lezer/html/src/.tern-port +1 -0
- package/node_modules/@lezer/html/src/content.js +87 -0
- package/node_modules/@lezer/html/src/highlight.js +15 -0
- package/node_modules/@lezer/html/src/html.grammar +181 -0
- package/node_modules/@lezer/html/src/index.js +2 -0
- package/node_modules/@lezer/html/src/parser.js +27 -0
- package/node_modules/@lezer/html/src/parser.terms.js +53 -0
- package/node_modules/@lezer/html/src/tokens.js +199 -0
- package/node_modules/@lezer/html/test/mixed.txt +69 -0
- package/node_modules/@lezer/html/test/tags.txt +370 -0
- package/node_modules/@lezer/html/test/test-html.js +29 -0
- package/node_modules/@lezer/html/test/test-incremental.js +97 -0
- package/node_modules/@lezer/html/test/vue.txt +56 -0
- package/node_modules/@lezer/javascript/CHANGELOG.md +485 -0
- package/node_modules/@lezer/javascript/LICENSE +21 -0
- package/node_modules/@lezer/javascript/README.md +14 -0
- package/node_modules/@lezer/javascript/dist/index.cjs +196 -0
- package/node_modules/@lezer/javascript/dist/index.d.cts +3 -0
- package/node_modules/@lezer/javascript/dist/index.d.ts +3 -0
- package/node_modules/@lezer/javascript/dist/index.js +192 -0
- package/node_modules/@lezer/javascript/package.json +36 -0
- package/node_modules/@lezer/javascript/rollup.config.js +16 -0
- package/node_modules/@lezer/javascript/src/highlight.js +62 -0
- package/node_modules/@lezer/javascript/src/javascript.grammar +735 -0
- package/node_modules/@lezer/javascript/src/parser.js +33 -0
- package/node_modules/@lezer/javascript/src/parser.terms.js +177 -0
- package/node_modules/@lezer/javascript/src/tokens.js +87 -0
- package/node_modules/@lezer/javascript/test/decorator.txt +64 -0
- package/node_modules/@lezer/javascript/test/expression.txt +686 -0
- package/node_modules/@lezer/javascript/test/jsx.txt +79 -0
- package/node_modules/@lezer/javascript/test/semicolon.txt +77 -0
- package/node_modules/@lezer/javascript/test/statement.txt +404 -0
- package/node_modules/@lezer/javascript/test/test-javascript.js +17 -0
- package/node_modules/@lezer/javascript/test/typescript.txt +401 -0
- package/node_modules/@lezer/json/CHANGELOG.md +79 -0
- package/node_modules/@lezer/json/LICENSE +21 -0
- package/node_modules/@lezer/json/README.md +7 -0
- package/node_modules/@lezer/json/dist/index.cjs +41 -0
- package/node_modules/@lezer/json/dist/index.d.cts +3 -0
- package/node_modules/@lezer/json/dist/index.d.ts +3 -0
- package/node_modules/@lezer/json/dist/index.js +37 -0
- package/node_modules/@lezer/json/package.json +36 -0
- package/node_modules/@lezer/json/rollup.config.js +15 -0
- package/node_modules/@lezer/json/src/highlight.js +12 -0
- package/node_modules/@lezer/json/src/json.grammar +38 -0
- package/node_modules/@lezer/json/src/parser.js +23 -0
- package/node_modules/@lezer/json/src/parser.terms.js +12 -0
- package/node_modules/@lezer/json/test/arrays.txt +34 -0
- package/node_modules/@lezer/json/test/literals.txt +23 -0
- package/node_modules/@lezer/json/test/numbers.txt +87 -0
- package/node_modules/@lezer/json/test/objects.txt +34 -0
- package/node_modules/@lezer/json/test/strings.txt +50 -0
- package/node_modules/@lezer/json/test/test-json.js +17 -0
- package/node_modules/@lezer/lr/LICENSE +21 -0
- package/node_modules/@lezer/lr/README.md +25 -0
- package/node_modules/@lezer/lr/dist/constants.d.ts +45 -0
- package/node_modules/@lezer/lr/dist/constants.js +5 -0
- package/node_modules/@lezer/lr/dist/index.cjs +1891 -0
- package/node_modules/@lezer/lr/dist/index.d.cts +303 -0
- package/node_modules/@lezer/lr/dist/index.d.ts +303 -0
- package/node_modules/@lezer/lr/dist/index.js +1884 -0
- package/node_modules/@lezer/lr/package.json +32 -0
- package/node_modules/@lezer/markdown/CHANGELOG.md +279 -0
- package/node_modules/@lezer/markdown/LICENSE +21 -0
- package/node_modules/@lezer/markdown/README.md +725 -0
- package/node_modules/@lezer/markdown/bin/build-readme.cjs +39 -0
- package/node_modules/@lezer/markdown/build.js +16 -0
- package/node_modules/@lezer/markdown/dist/index.cjs +2352 -0
- package/node_modules/@lezer/markdown/dist/index.d.cts +600 -0
- package/node_modules/@lezer/markdown/dist/index.d.ts +600 -0
- package/node_modules/@lezer/markdown/dist/index.js +2335 -0
- package/node_modules/@lezer/markdown/package.json +37 -0
- package/node_modules/@lezer/markdown/src/README.md +83 -0
- package/node_modules/@lezer/markdown/src/extension.ts +301 -0
- package/node_modules/@lezer/markdown/src/index.ts +5 -0
- package/node_modules/@lezer/markdown/src/markdown.ts +1961 -0
- package/node_modules/@lezer/markdown/src/nest.ts +46 -0
- package/node_modules/@lezer/markdown/test/compare-tree.ts +14 -0
- package/node_modules/@lezer/markdown/test/spec.ts +79 -0
- package/node_modules/@lezer/markdown/test/test-extension.ts +269 -0
- package/node_modules/@lezer/markdown/test/test-incremental.ts +265 -0
- package/node_modules/@lezer/markdown/test/test-markdown.ts +3574 -0
- package/node_modules/@lezer/markdown/test/test-nesting.ts +86 -0
- package/node_modules/@lezer/markdown/test/tsconfig.json +12 -0
- package/node_modules/@lezer/markdown/tsconfig.json +14 -0
- package/node_modules/@lezer/python/CHANGELOG.md +243 -0
- package/node_modules/@lezer/python/LICENSE +21 -0
- package/node_modules/@lezer/python/README.md +6 -0
- package/node_modules/@lezer/python/dist/index.cjs +330 -0
- package/node_modules/@lezer/python/dist/index.d.cts +3 -0
- package/node_modules/@lezer/python/dist/index.d.ts +3 -0
- package/node_modules/@lezer/python/dist/index.js +326 -0
- package/node_modules/@lezer/python/package.json +36 -0
- package/node_modules/@lezer/python/rollup.config.js +16 -0
- package/node_modules/@lezer/python/src/highlight.js +35 -0
- package/node_modules/@lezer/python/src/python.grammar +381 -0
- package/node_modules/@lezer/python/src/tokens.js +224 -0
- package/node_modules/@lezer/python/test/expression.txt +231 -0
- package/node_modules/@lezer/python/test/statement.txt +442 -0
- package/node_modules/@lezer/python/test/test-incremental.js +33 -0
- package/node_modules/@lezer/python/test/test-python.js +17 -0
- package/node_modules/@marijn/find-cluster-break/LICENSE +21 -0
- package/node_modules/@marijn/find-cluster-break/README.md +28 -0
- package/node_modules/@marijn/find-cluster-break/dist/index.cjs +85 -0
- package/node_modules/@marijn/find-cluster-break/dist/index.d.cts +15 -0
- package/node_modules/@marijn/find-cluster-break/package.json +35 -0
- package/node_modules/@marijn/find-cluster-break/rollup.config.js +7 -0
- package/node_modules/@marijn/find-cluster-break/src/index.d.ts +15 -0
- package/node_modules/@marijn/find-cluster-break/src/index.js +87 -0
- package/node_modules/@marijn/find-cluster-break/test/test-cluster.js +30 -0
- package/node_modules/crelt/LICENSE +19 -0
- package/node_modules/crelt/README.md +23 -0
- package/node_modules/crelt/dist/index.cjs +31 -0
- package/node_modules/crelt/dist/index.d.cts +4 -0
- package/node_modules/crelt/index.d.ts +4 -0
- package/node_modules/crelt/index.js +28 -0
- package/node_modules/crelt/package.json +35 -0
- package/node_modules/crelt/rollup.config.js +13 -0
- package/node_modules/style-mod/LICENSE +19 -0
- package/node_modules/style-mod/README.md +98 -0
- package/node_modules/style-mod/dist/style-mod.cjs +165 -0
- package/node_modules/style-mod/dist/style-mod.d.cts +16 -0
- package/node_modules/style-mod/package.json +39 -0
- package/node_modules/style-mod/src/README.md +34 -0
- package/node_modules/style-mod/src/style-mod.d.ts +16 -0
- package/node_modules/style-mod/src/style-mod.js +172 -0
- package/node_modules/style-mod/test/test-style-mod.js +104 -0
- package/node_modules/w3c-keyname/.tern-port +1 -0
- package/node_modules/w3c-keyname/LICENSE +19 -0
- package/node_modules/w3c-keyname/README.md +18 -0
- package/node_modules/w3c-keyname/index.cjs +127 -0
- package/node_modules/w3c-keyname/index.d.cts +5 -0
- package/node_modules/w3c-keyname/index.d.ts +5 -0
- package/node_modules/w3c-keyname/index.js +119 -0
- package/node_modules/w3c-keyname/package.json +37 -0
- package/package.json +1 -1
- package/packages/daemon/src/api.js +157 -2
- package/packages/daemon/src/filewatcher.js +59 -0
- package/packages/daemon/src/index.js +28 -1
- package/packages/daemon/src/skills.js +20 -0
- package/packages/gui/dist/assets/index-Dxg9hdf3.js +103 -0
- package/packages/gui/dist/index.html +1 -1
- package/packages/gui/package.json +15 -2
- package/packages/gui/src/App.jsx +3 -0
- package/packages/gui/src/components/CodeEditor.jsx +143 -0
- package/packages/gui/src/components/EditorTabs.jsx +83 -0
- package/packages/gui/src/components/FileTree.jsx +193 -0
- package/packages/gui/src/stores/groove.js +158 -1
- package/packages/gui/src/views/FileEditor.jsx +142 -0
- package/packages/gui/src/views/SkillsMarketplace.jsx +112 -1
- package/node_modules/@groove-dev/gui/dist/assets/index-CNCSwHwH.js +0 -74
- package/packages/gui/dist/assets/index-CNCSwHwH.js +0 -74
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
## 6.2.1 (2025-05-14)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where the indentation logic would too eagerly align lines to the body directly above them.
|
|
6
|
+
|
|
7
|
+
## 6.2.0 (2025-04-25)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Add an indentation rule for member expressions.
|
|
12
|
+
|
|
13
|
+
### New features
|
|
14
|
+
|
|
15
|
+
Allow multi-line strings to be code-folded.
|
|
16
|
+
|
|
17
|
+
## 6.1.7 (2025-01-18)
|
|
18
|
+
|
|
19
|
+
### Bug fixes
|
|
20
|
+
|
|
21
|
+
Properly indent match/case statements.
|
|
22
|
+
|
|
23
|
+
## 6.1.6 (2024-04-29)
|
|
24
|
+
|
|
25
|
+
### Bug fixes
|
|
26
|
+
|
|
27
|
+
Improve the way indentation for the current body is preserved when inenting new lines.
|
|
28
|
+
|
|
29
|
+
## 6.1.5 (2024-03-28)
|
|
30
|
+
|
|
31
|
+
### Bug fixes
|
|
32
|
+
|
|
33
|
+
Properly indent `else:` when attached to a `for` or `while` statement.
|
|
34
|
+
|
|
35
|
+
## 6.1.4 (2024-02-02)
|
|
36
|
+
|
|
37
|
+
### Bug fixes
|
|
38
|
+
|
|
39
|
+
Explicitly declare dependencies on @lezer/common and @codemirror/state
|
|
40
|
+
|
|
41
|
+
## 6.1.3 (2023-06-12)
|
|
42
|
+
|
|
43
|
+
### Bug fixes
|
|
44
|
+
|
|
45
|
+
Fix a bug where blocks started after a wrapped argument list or similar construct were indented too far.
|
|
46
|
+
|
|
47
|
+
## 6.1.2 (2023-03-01)
|
|
48
|
+
|
|
49
|
+
### Bug fixes
|
|
50
|
+
|
|
51
|
+
Don't indent lines after a dedented comment line.
|
|
52
|
+
|
|
53
|
+
## 6.1.1 (2022-12-24)
|
|
54
|
+
|
|
55
|
+
### Bug fixes
|
|
56
|
+
|
|
57
|
+
Remove leftover log statements.
|
|
58
|
+
|
|
59
|
+
## 6.1.0 (2022-11-18)
|
|
60
|
+
|
|
61
|
+
### New features
|
|
62
|
+
|
|
63
|
+
The `globalCompletion` completion source (included in the language support returned from `python()`) completes standard Python globals and keywords.
|
|
64
|
+
|
|
65
|
+
Export a `localCompletionSource` function that completes locally defined variables. Included in the support extensions returned from `python()`.
|
|
66
|
+
|
|
67
|
+
## 6.0.4 (2022-10-24)
|
|
68
|
+
|
|
69
|
+
### Bug fixes
|
|
70
|
+
|
|
71
|
+
Make sure the language object has a name.
|
|
72
|
+
|
|
73
|
+
## 6.0.3 (2022-10-19)
|
|
74
|
+
|
|
75
|
+
### Bug fixes
|
|
76
|
+
|
|
77
|
+
Add proper indentation handling of `else` clauses in `try` statements.
|
|
78
|
+
|
|
79
|
+
## 6.0.2 (2022-09-22)
|
|
80
|
+
|
|
81
|
+
### Bug fixes
|
|
82
|
+
|
|
83
|
+
Allow prefixed strings to be closed by `closeBrackets`.
|
|
84
|
+
|
|
85
|
+
## 6.0.1 (2022-07-21)
|
|
86
|
+
|
|
87
|
+
### Bug fixes
|
|
88
|
+
|
|
89
|
+
Fix (non-)auto indentation in template strings and comments.
|
|
90
|
+
|
|
91
|
+
## 6.0.0 (2022-06-08)
|
|
92
|
+
|
|
93
|
+
### Breaking changes
|
|
94
|
+
|
|
95
|
+
Update dependencies to 6.0.0
|
|
96
|
+
|
|
97
|
+
## 0.20.0 (2022-04-20)
|
|
98
|
+
|
|
99
|
+
### Bug fixes
|
|
100
|
+
|
|
101
|
+
Add folding information for set and tuple expressions.
|
|
102
|
+
|
|
103
|
+
## 0.19.5 (2022-04-06)
|
|
104
|
+
|
|
105
|
+
### Bug fixes
|
|
106
|
+
|
|
107
|
+
Make sure * and ** modifiers are highlighted as such, add modifier tag for FormatSpec nodes.
|
|
108
|
+
|
|
109
|
+
## 0.19.4 (2022-01-26)
|
|
110
|
+
|
|
111
|
+
### Bug fixes
|
|
112
|
+
|
|
113
|
+
Fix issue where folding body nodes folded away the newline after the body.
|
|
114
|
+
|
|
115
|
+
## 0.19.3 (2022-01-20)
|
|
116
|
+
|
|
117
|
+
### Bug fixes
|
|
118
|
+
|
|
119
|
+
Fix the way block bodies are folded.
|
|
120
|
+
|
|
121
|
+
## 0.19.2 (2021-08-11)
|
|
122
|
+
|
|
123
|
+
### Bug fixes
|
|
124
|
+
|
|
125
|
+
Make sure that indenting an else/elif/except/finally that's indented too deep moves it back up.
|
|
126
|
+
|
|
127
|
+
## 0.19.1 (2021-08-11)
|
|
128
|
+
|
|
129
|
+
### Bug fixes
|
|
130
|
+
|
|
131
|
+
Fix incorrect versions for @lezer dependencies.
|
|
132
|
+
|
|
133
|
+
## 0.19.0 (2021-08-11)
|
|
134
|
+
|
|
135
|
+
### Bug fixes
|
|
136
|
+
|
|
137
|
+
Improve indentation for dictionaries, arrays, and tuples. Fix delimitedIndent calls
|
|
138
|
+
|
|
139
|
+
Indentation on deindented blank lines after a block will no longer return to the block's indentation level.
|
|
140
|
+
|
|
141
|
+
## 0.18.1 (2021-07-20)
|
|
142
|
+
|
|
143
|
+
### Bug fixes
|
|
144
|
+
|
|
145
|
+
Fix highlighting of property names. Improve indentation support
|
|
146
|
+
|
|
147
|
+
Don't deindent when pressing enter at the end of the document.
|
|
148
|
+
|
|
149
|
+
Properly indent else/elif/except syntax.
|
|
150
|
+
|
|
151
|
+
## 0.18.0 (2021-03-03)
|
|
152
|
+
|
|
153
|
+
### Breaking changes
|
|
154
|
+
|
|
155
|
+
Update dependencies to 0.18.
|
|
156
|
+
|
|
157
|
+
## 0.17.2 (2021-01-12)
|
|
158
|
+
|
|
159
|
+
### Bug fixes
|
|
160
|
+
|
|
161
|
+
Improves the highlighting specificity for names of function and class definitions.
|
|
162
|
+
|
|
163
|
+
## 0.17.1 (2021-01-06)
|
|
164
|
+
|
|
165
|
+
### New features
|
|
166
|
+
|
|
167
|
+
The package now also exports a CommonJS module.
|
|
168
|
+
|
|
169
|
+
## 0.17.0 (2020-12-29)
|
|
170
|
+
|
|
171
|
+
### Breaking changes
|
|
172
|
+
|
|
173
|
+
First numbered release.
|
|
174
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2018-2021 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!-- NOTE: README.md is generated from src/README.md -->
|
|
2
|
+
|
|
3
|
+
# @codemirror/lang-python [](https://www.npmjs.org/package/@codemirror/lang-python)
|
|
4
|
+
|
|
5
|
+
[ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/lang-python/blob/main/CHANGELOG.md) ]
|
|
6
|
+
|
|
7
|
+
This package implements Python language support for the
|
|
8
|
+
[CodeMirror](https://codemirror.net/) code editor.
|
|
9
|
+
|
|
10
|
+
The [project page](https://codemirror.net/) has more information, a
|
|
11
|
+
number of [examples](https://codemirror.net/examples/) and the
|
|
12
|
+
[documentation](https://codemirror.net/docs/).
|
|
13
|
+
|
|
14
|
+
This code is released under an
|
|
15
|
+
[MIT license](https://github.com/codemirror/lang-python/tree/main/LICENSE).
|
|
16
|
+
|
|
17
|
+
We aim to be an inclusive, welcoming community. To make that explicit,
|
|
18
|
+
we have a [code of
|
|
19
|
+
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
|
|
20
|
+
to communication around the project.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
import {EditorView, basicSetup} from "codemirror"
|
|
26
|
+
import {python} from "@codemirror/lang-python"
|
|
27
|
+
|
|
28
|
+
const view = new EditorView({
|
|
29
|
+
parent: document.body,
|
|
30
|
+
doc: `print("Hello world")`,
|
|
31
|
+
extensions: [basicSetup, python()]
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
# API Reference
|
|
36
|
+
|
|
37
|
+
<dl>
|
|
38
|
+
<dt id="user-content-python">
|
|
39
|
+
<code><strong><a href="#user-content-python">python</a></strong>() → <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>
|
|
40
|
+
|
|
41
|
+
<dd><p>Python language support.</p>
|
|
42
|
+
</dd>
|
|
43
|
+
<dt id="user-content-pythonlanguage">
|
|
44
|
+
<code><strong><a href="#user-content-pythonlanguage">pythonLanguage</a></strong>: <a href="https://codemirror.net/docs/ref#language.LRLanguage">LRLanguage</a></code></dt>
|
|
45
|
+
|
|
46
|
+
<dd><p>A language provider based on the <a href="https://github.com/lezer-parser/python">Lezer Python
|
|
47
|
+
parser</a>, extended with
|
|
48
|
+
highlighting and indentation information.</p>
|
|
49
|
+
</dd>
|
|
50
|
+
<dt id="user-content-globalcompletion">
|
|
51
|
+
<code><strong><a href="#user-content-globalcompletion">globalCompletion</a></strong>: <a href="https://codemirror.net/docs/ref#autocomplete.CompletionSource">CompletionSource</a></code></dt>
|
|
52
|
+
|
|
53
|
+
<dd><p>Autocompletion for built-in Python globals and keywords.</p>
|
|
54
|
+
</dd>
|
|
55
|
+
<dt id="user-content-localcompletionsource">
|
|
56
|
+
<code><strong><a href="#user-content-localcompletionsource">localCompletionSource</a></strong>(<a id="user-content-localcompletionsource^context" href="#user-content-localcompletionsource^context">context</a>: <a href="https://codemirror.net/docs/ref#autocomplete.CompletionContext">CompletionContext</a>) → <a href="https://codemirror.net/docs/ref#autocomplete.CompletionResult">CompletionResult</a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null">null</a></code></dt>
|
|
57
|
+
|
|
58
|
+
<dd><p>Completion source that looks up locally defined names in
|
|
59
|
+
Python code.</p>
|
|
60
|
+
</dd>
|
|
61
|
+
</dl>
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var python$1 = require('@lezer/python');
|
|
4
|
+
var language = require('@codemirror/language');
|
|
5
|
+
var common = require('@lezer/common');
|
|
6
|
+
var autocomplete = require('@codemirror/autocomplete');
|
|
7
|
+
|
|
8
|
+
const cache = new common.NodeWeakMap();
|
|
9
|
+
const ScopeNodes = new Set([
|
|
10
|
+
"Script", "Body",
|
|
11
|
+
"FunctionDefinition", "ClassDefinition", "LambdaExpression",
|
|
12
|
+
"ForStatement", "MatchClause"
|
|
13
|
+
]);
|
|
14
|
+
function defID(type) {
|
|
15
|
+
return (node, def, outer) => {
|
|
16
|
+
if (outer)
|
|
17
|
+
return false;
|
|
18
|
+
let id = node.node.getChild("VariableName");
|
|
19
|
+
if (id)
|
|
20
|
+
def(id, type);
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const gatherCompletions = {
|
|
25
|
+
FunctionDefinition: defID("function"),
|
|
26
|
+
ClassDefinition: defID("class"),
|
|
27
|
+
ForStatement(node, def, outer) {
|
|
28
|
+
if (outer)
|
|
29
|
+
for (let child = node.node.firstChild; child; child = child.nextSibling) {
|
|
30
|
+
if (child.name == "VariableName")
|
|
31
|
+
def(child, "variable");
|
|
32
|
+
else if (child.name == "in")
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
ImportStatement(_node, def) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
let { node } = _node;
|
|
39
|
+
let isFrom = ((_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.name) == "from";
|
|
40
|
+
for (let ch = node.getChild("import"); ch; ch = ch.nextSibling) {
|
|
41
|
+
if (ch.name == "VariableName" && ((_b = ch.nextSibling) === null || _b === void 0 ? void 0 : _b.name) != "as")
|
|
42
|
+
def(ch, isFrom ? "variable" : "namespace");
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
AssignStatement(node, def) {
|
|
46
|
+
for (let child = node.node.firstChild; child; child = child.nextSibling) {
|
|
47
|
+
if (child.name == "VariableName")
|
|
48
|
+
def(child, "variable");
|
|
49
|
+
else if (child.name == ":" || child.name == "AssignOp")
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
ParamList(node, def) {
|
|
54
|
+
for (let prev = null, child = node.node.firstChild; child; child = child.nextSibling) {
|
|
55
|
+
if (child.name == "VariableName" && (!prev || !/\*|AssignOp/.test(prev.name)))
|
|
56
|
+
def(child, "variable");
|
|
57
|
+
prev = child;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
CapturePattern: defID("variable"),
|
|
61
|
+
AsPattern: defID("variable"),
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
64
|
+
function getScope(doc, node) {
|
|
65
|
+
let cached = cache.get(node);
|
|
66
|
+
if (cached)
|
|
67
|
+
return cached;
|
|
68
|
+
let completions = [], top = true;
|
|
69
|
+
function def(node, type) {
|
|
70
|
+
let name = doc.sliceString(node.from, node.to);
|
|
71
|
+
completions.push({ label: name, type });
|
|
72
|
+
}
|
|
73
|
+
node.cursor(common.IterMode.IncludeAnonymous).iterate(node => {
|
|
74
|
+
if (node.name) {
|
|
75
|
+
let gather = gatherCompletions[node.name];
|
|
76
|
+
if (gather && gather(node, def, top) || !top && ScopeNodes.has(node.name))
|
|
77
|
+
return false;
|
|
78
|
+
top = false;
|
|
79
|
+
}
|
|
80
|
+
else if (node.to - node.from > 8192) {
|
|
81
|
+
// Allow caching for bigger internal nodes
|
|
82
|
+
for (let c of getScope(doc, node.node))
|
|
83
|
+
completions.push(c);
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
cache.set(node, completions);
|
|
88
|
+
return completions;
|
|
89
|
+
}
|
|
90
|
+
const Identifier = /^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/;
|
|
91
|
+
const dontComplete = ["String", "FormatString", "Comment", "PropertyName"];
|
|
92
|
+
/**
|
|
93
|
+
Completion source that looks up locally defined names in
|
|
94
|
+
Python code.
|
|
95
|
+
*/
|
|
96
|
+
function localCompletionSource(context) {
|
|
97
|
+
let inner = language.syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
98
|
+
if (dontComplete.indexOf(inner.name) > -1)
|
|
99
|
+
return null;
|
|
100
|
+
let isWord = inner.name == "VariableName" ||
|
|
101
|
+
inner.to - inner.from < 20 && Identifier.test(context.state.sliceDoc(inner.from, inner.to));
|
|
102
|
+
if (!isWord && !context.explicit)
|
|
103
|
+
return null;
|
|
104
|
+
let options = [];
|
|
105
|
+
for (let pos = inner; pos; pos = pos.parent) {
|
|
106
|
+
if (ScopeNodes.has(pos.name))
|
|
107
|
+
options = options.concat(getScope(context.state.doc, pos));
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
options,
|
|
111
|
+
from: isWord ? inner.from : context.pos,
|
|
112
|
+
validFor: Identifier
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const globals = [
|
|
116
|
+
"__annotations__", "__builtins__", "__debug__", "__doc__", "__import__", "__name__",
|
|
117
|
+
"__loader__", "__package__", "__spec__",
|
|
118
|
+
"False", "None", "True"
|
|
119
|
+
].map(n => ({ label: n, type: "constant" })).concat([
|
|
120
|
+
"ArithmeticError", "AssertionError", "AttributeError", "BaseException", "BlockingIOError",
|
|
121
|
+
"BrokenPipeError", "BufferError", "BytesWarning", "ChildProcessError", "ConnectionAbortedError",
|
|
122
|
+
"ConnectionError", "ConnectionRefusedError", "ConnectionResetError", "DeprecationWarning",
|
|
123
|
+
"EOFError", "Ellipsis", "EncodingWarning", "EnvironmentError", "Exception", "FileExistsError",
|
|
124
|
+
"FileNotFoundError", "FloatingPointError", "FutureWarning", "GeneratorExit", "IOError",
|
|
125
|
+
"ImportError", "ImportWarning", "IndentationError", "IndexError", "InterruptedError",
|
|
126
|
+
"IsADirectoryError", "KeyError", "KeyboardInterrupt", "LookupError", "MemoryError",
|
|
127
|
+
"ModuleNotFoundError", "NameError", "NotADirectoryError", "NotImplemented", "NotImplementedError",
|
|
128
|
+
"OSError", "OverflowError", "PendingDeprecationWarning", "PermissionError", "ProcessLookupError",
|
|
129
|
+
"RecursionError", "ReferenceError", "ResourceWarning", "RuntimeError", "RuntimeWarning",
|
|
130
|
+
"StopAsyncIteration", "StopIteration", "SyntaxError", "SyntaxWarning", "SystemError",
|
|
131
|
+
"SystemExit", "TabError", "TimeoutError", "TypeError", "UnboundLocalError", "UnicodeDecodeError",
|
|
132
|
+
"UnicodeEncodeError", "UnicodeError", "UnicodeTranslateError", "UnicodeWarning", "UserWarning",
|
|
133
|
+
"ValueError", "Warning", "ZeroDivisionError"
|
|
134
|
+
].map(n => ({ label: n, type: "type" }))).concat([
|
|
135
|
+
"bool", "bytearray", "bytes", "classmethod", "complex", "float", "frozenset", "int", "list",
|
|
136
|
+
"map", "memoryview", "object", "range", "set", "staticmethod", "str", "super", "tuple", "type"
|
|
137
|
+
].map(n => ({ label: n, type: "class" }))).concat([
|
|
138
|
+
"abs", "aiter", "all", "anext", "any", "ascii", "bin", "breakpoint", "callable", "chr",
|
|
139
|
+
"compile", "delattr", "dict", "dir", "divmod", "enumerate", "eval", "exec", "exit", "filter",
|
|
140
|
+
"format", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "isinstance",
|
|
141
|
+
"issubclass", "iter", "len", "license", "locals", "max", "min", "next", "oct", "open",
|
|
142
|
+
"ord", "pow", "print", "property", "quit", "repr", "reversed", "round", "setattr", "slice",
|
|
143
|
+
"sorted", "sum", "vars", "zip"
|
|
144
|
+
].map(n => ({ label: n, type: "function" })));
|
|
145
|
+
const snippets = [
|
|
146
|
+
autocomplete.snippetCompletion("def ${name}(${params}):\n\t${}", {
|
|
147
|
+
label: "def",
|
|
148
|
+
detail: "function",
|
|
149
|
+
type: "keyword"
|
|
150
|
+
}),
|
|
151
|
+
autocomplete.snippetCompletion("for ${name} in ${collection}:\n\t${}", {
|
|
152
|
+
label: "for",
|
|
153
|
+
detail: "loop",
|
|
154
|
+
type: "keyword"
|
|
155
|
+
}),
|
|
156
|
+
autocomplete.snippetCompletion("while ${}:\n\t${}", {
|
|
157
|
+
label: "while",
|
|
158
|
+
detail: "loop",
|
|
159
|
+
type: "keyword"
|
|
160
|
+
}),
|
|
161
|
+
autocomplete.snippetCompletion("try:\n\t${}\nexcept ${error}:\n\t${}", {
|
|
162
|
+
label: "try",
|
|
163
|
+
detail: "/ except block",
|
|
164
|
+
type: "keyword"
|
|
165
|
+
}),
|
|
166
|
+
autocomplete.snippetCompletion("if ${}:\n\t\n", {
|
|
167
|
+
label: "if",
|
|
168
|
+
detail: "block",
|
|
169
|
+
type: "keyword"
|
|
170
|
+
}),
|
|
171
|
+
autocomplete.snippetCompletion("if ${}:\n\t${}\nelse:\n\t${}", {
|
|
172
|
+
label: "if",
|
|
173
|
+
detail: "/ else block",
|
|
174
|
+
type: "keyword"
|
|
175
|
+
}),
|
|
176
|
+
autocomplete.snippetCompletion("class ${name}:\n\tdef __init__(self, ${params}):\n\t\t\t${}", {
|
|
177
|
+
label: "class",
|
|
178
|
+
detail: "definition",
|
|
179
|
+
type: "keyword"
|
|
180
|
+
}),
|
|
181
|
+
autocomplete.snippetCompletion("import ${module}", {
|
|
182
|
+
label: "import",
|
|
183
|
+
detail: "statement",
|
|
184
|
+
type: "keyword"
|
|
185
|
+
}),
|
|
186
|
+
autocomplete.snippetCompletion("from ${module} import ${names}", {
|
|
187
|
+
label: "from",
|
|
188
|
+
detail: "import",
|
|
189
|
+
type: "keyword"
|
|
190
|
+
})
|
|
191
|
+
];
|
|
192
|
+
/**
|
|
193
|
+
Autocompletion for built-in Python globals and keywords.
|
|
194
|
+
*/
|
|
195
|
+
const globalCompletion = autocomplete.ifNotIn(dontComplete, autocomplete.completeFromList(globals.concat(snippets)));
|
|
196
|
+
|
|
197
|
+
function innerBody(context) {
|
|
198
|
+
let { node, pos } = context;
|
|
199
|
+
let lineIndent = context.lineIndent(pos, -1);
|
|
200
|
+
let found = null;
|
|
201
|
+
for (;;) {
|
|
202
|
+
let before = node.childBefore(pos);
|
|
203
|
+
if (!before) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
else if (before.name == "Comment") {
|
|
207
|
+
pos = before.from;
|
|
208
|
+
}
|
|
209
|
+
else if (before.name == "Body" || before.name == "MatchBody") {
|
|
210
|
+
if (context.baseIndentFor(before) + context.unit <= lineIndent)
|
|
211
|
+
found = before;
|
|
212
|
+
node = before;
|
|
213
|
+
}
|
|
214
|
+
else if (before.name == "MatchClause") {
|
|
215
|
+
node = before;
|
|
216
|
+
}
|
|
217
|
+
else if (before.type.is("Statement")) {
|
|
218
|
+
node = before;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return found;
|
|
225
|
+
}
|
|
226
|
+
function indentBody(context, node) {
|
|
227
|
+
let base = context.baseIndentFor(node);
|
|
228
|
+
let line = context.lineAt(context.pos, -1), to = line.from + line.text.length;
|
|
229
|
+
// Don't consider blank, deindented lines at the end of the
|
|
230
|
+
// block part of the block
|
|
231
|
+
if (/^\s*($|#)/.test(line.text) &&
|
|
232
|
+
context.node.to < to + 100 &&
|
|
233
|
+
!/\S/.test(context.state.sliceDoc(to, context.node.to)) &&
|
|
234
|
+
context.lineIndent(context.pos, -1) <= base)
|
|
235
|
+
return null;
|
|
236
|
+
// A normally deindenting keyword that appears at a higher
|
|
237
|
+
// indentation than the block should probably be handled by the next
|
|
238
|
+
// level
|
|
239
|
+
if (/^\s*(else:|elif |except |finally:|case\s+[^=:]+:)/.test(context.textAfter) && context.lineIndent(context.pos, -1) > base)
|
|
240
|
+
return null;
|
|
241
|
+
return base + context.unit;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
A language provider based on the [Lezer Python
|
|
245
|
+
parser](https://github.com/lezer-parser/python), extended with
|
|
246
|
+
highlighting and indentation information.
|
|
247
|
+
*/
|
|
248
|
+
const pythonLanguage = language.LRLanguage.define({
|
|
249
|
+
name: "python",
|
|
250
|
+
parser: python$1.parser.configure({
|
|
251
|
+
props: [
|
|
252
|
+
language.indentNodeProp.add({
|
|
253
|
+
Body: context => {
|
|
254
|
+
var _a;
|
|
255
|
+
let body = /^\s*(#|$)/.test(context.textAfter) && innerBody(context) || context.node;
|
|
256
|
+
return (_a = indentBody(context, body)) !== null && _a !== void 0 ? _a : context.continue();
|
|
257
|
+
},
|
|
258
|
+
MatchBody: context => {
|
|
259
|
+
var _a;
|
|
260
|
+
let inner = innerBody(context);
|
|
261
|
+
return (_a = indentBody(context, inner || context.node)) !== null && _a !== void 0 ? _a : context.continue();
|
|
262
|
+
},
|
|
263
|
+
IfStatement: cx => /^\s*(else:|elif )/.test(cx.textAfter) ? cx.baseIndent : cx.continue(),
|
|
264
|
+
"ForStatement WhileStatement": cx => /^\s*else:/.test(cx.textAfter) ? cx.baseIndent : cx.continue(),
|
|
265
|
+
TryStatement: cx => /^\s*(except[ :]|finally:|else:)/.test(cx.textAfter) ? cx.baseIndent : cx.continue(),
|
|
266
|
+
MatchStatement: cx => {
|
|
267
|
+
if (/^\s*case /.test(cx.textAfter))
|
|
268
|
+
return cx.baseIndent + cx.unit;
|
|
269
|
+
return cx.continue();
|
|
270
|
+
},
|
|
271
|
+
"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression": language.delimitedIndent({ closing: ")" }),
|
|
272
|
+
"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression": language.delimitedIndent({ closing: "}" }),
|
|
273
|
+
"ArrayExpression ArrayComprehensionExpression": language.delimitedIndent({ closing: "]" }),
|
|
274
|
+
MemberExpression: cx => cx.baseIndent + cx.unit,
|
|
275
|
+
"String FormatString": () => null,
|
|
276
|
+
Script: context => {
|
|
277
|
+
var _a;
|
|
278
|
+
let inner = innerBody(context);
|
|
279
|
+
return (_a = (inner && indentBody(context, inner))) !== null && _a !== void 0 ? _a : context.continue();
|
|
280
|
+
},
|
|
281
|
+
}),
|
|
282
|
+
language.foldNodeProp.add({
|
|
283
|
+
"ArrayExpression DictionaryExpression SetExpression TupleExpression": language.foldInside,
|
|
284
|
+
Body: (node, state) => ({ from: node.from + 1, to: node.to - (node.to == state.doc.length ? 0 : 1) }),
|
|
285
|
+
"String FormatString": (node, state) => ({ from: state.doc.lineAt(node.from).to, to: node.to })
|
|
286
|
+
})
|
|
287
|
+
],
|
|
288
|
+
}),
|
|
289
|
+
languageData: {
|
|
290
|
+
closeBrackets: {
|
|
291
|
+
brackets: ["(", "[", "{", "'", '"', "'''", '"""'],
|
|
292
|
+
stringPrefixes: ["f", "fr", "rf", "r", "u", "b", "br", "rb",
|
|
293
|
+
"F", "FR", "RF", "R", "U", "B", "BR", "RB"]
|
|
294
|
+
},
|
|
295
|
+
commentTokens: { line: "#" },
|
|
296
|
+
// Indent logic logic are triggered upon below input patterns
|
|
297
|
+
indentOnInput: /^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/,
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
/**
|
|
301
|
+
Python language support.
|
|
302
|
+
*/
|
|
303
|
+
function python() {
|
|
304
|
+
return new language.LanguageSupport(pythonLanguage, [
|
|
305
|
+
pythonLanguage.data.of({ autocomplete: localCompletionSource }),
|
|
306
|
+
pythonLanguage.data.of({ autocomplete: globalCompletion }),
|
|
307
|
+
]);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
exports.globalCompletion = globalCompletion;
|
|
311
|
+
exports.localCompletionSource = localCompletionSource;
|
|
312
|
+
exports.python = python;
|
|
313
|
+
exports.pythonLanguage = pythonLanguage;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
|
+
import * as _codemirror_autocomplete from '@codemirror/autocomplete';
|
|
3
|
+
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
Completion source that looks up locally defined names in
|
|
7
|
+
Python code.
|
|
8
|
+
*/
|
|
9
|
+
declare function localCompletionSource(context: CompletionContext): CompletionResult | null;
|
|
10
|
+
/**
|
|
11
|
+
Autocompletion for built-in Python globals and keywords.
|
|
12
|
+
*/
|
|
13
|
+
declare const globalCompletion: _codemirror_autocomplete.CompletionSource;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
A language provider based on the [Lezer Python
|
|
17
|
+
parser](https://github.com/lezer-parser/python), extended with
|
|
18
|
+
highlighting and indentation information.
|
|
19
|
+
*/
|
|
20
|
+
declare const pythonLanguage: LRLanguage;
|
|
21
|
+
/**
|
|
22
|
+
Python language support.
|
|
23
|
+
*/
|
|
24
|
+
declare function python(): LanguageSupport;
|
|
25
|
+
|
|
26
|
+
export { globalCompletion, localCompletionSource, python, pythonLanguage };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
|
+
import * as _codemirror_autocomplete from '@codemirror/autocomplete';
|
|
3
|
+
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
Completion source that looks up locally defined names in
|
|
7
|
+
Python code.
|
|
8
|
+
*/
|
|
9
|
+
declare function localCompletionSource(context: CompletionContext): CompletionResult | null;
|
|
10
|
+
/**
|
|
11
|
+
Autocompletion for built-in Python globals and keywords.
|
|
12
|
+
*/
|
|
13
|
+
declare const globalCompletion: _codemirror_autocomplete.CompletionSource;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
A language provider based on the [Lezer Python
|
|
17
|
+
parser](https://github.com/lezer-parser/python), extended with
|
|
18
|
+
highlighting and indentation information.
|
|
19
|
+
*/
|
|
20
|
+
declare const pythonLanguage: LRLanguage;
|
|
21
|
+
/**
|
|
22
|
+
Python language support.
|
|
23
|
+
*/
|
|
24
|
+
declare function python(): LanguageSupport;
|
|
25
|
+
|
|
26
|
+
export { globalCompletion, localCompletionSource, python, pythonLanguage };
|