Better py editor indentation (#2098)

Better PyEditor Indentation
This commit is contained in:
Andrea Giammarchi
2024-06-13 11:34:14 +02:00
committed by GitHub
parent a1e5a05b49
commit aab015b9b8
3 changed files with 46 additions and 46 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@pyscript/core",
"version": "0.4.44",
"version": "0.4.46",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@pyscript/core",
"version": "0.4.44",
"version": "0.4.46",
"license": "APACHE-2.0",
"dependencies": {
"@ungap/with-resolvers": "^0.1.0",
@@ -21,7 +21,7 @@
"@codemirror/lang-python": "^6.1.6",
"@codemirror/language": "^6.10.2",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.28.0",
"@codemirror/view": "^6.28.1",
"@playwright/test": "^1.44.1",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
@@ -29,7 +29,7 @@
"@webreflection/toml-j0.4": "^1.1.3",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.11.0",
"bun": "^1.1.12",
"bun": "^1.1.13",
"chokidar": "^3.6.0",
"codemirror": "^6.0.1",
"eslint": "^9.4.0",
@@ -135,9 +135,9 @@
"license": "MIT"
},
"node_modules/@codemirror/view": {
"version": "6.28.0",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.28.0.tgz",
"integrity": "sha512-fo7CelaUDKWIyemw4b+J57cWuRkOu4SWCCPfNDkPvfWkGjM9D5racHQXr4EQeYCD6zEBIBxGCeaKkQo+ysl0gA==",
"version": "6.28.1",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.28.1.tgz",
"integrity": "sha512-BUWr+zCJpMkA/u69HlJmR+YkV4yPpM81HeMkOMZuwFa8iM5uJdEPKAs1icIRZKkKmy0Ub1x9/G3PQLTXdpBxrQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -486,9 +486,9 @@
}
},
"node_modules/@oven/bun-darwin-aarch64": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.1.12.tgz",
"integrity": "sha512-g8nmDXIYDmbEnP6moX3ZTS5BsikX8dz/XB0PAfL+LEBJEGECyor2Hv1yvhGQfeR1/lvfSXsWnk0Hhk9Mrj6uoQ==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.1.13.tgz",
"integrity": "sha512-XjnL/B3i7s3xR7f7rYtXU5fyVb27g1Hd5fsmkyi1sNmB/34Lt/KRMmhp4C7brjxFtbI3NSkrvF+b3PkprQzPCA==",
"cpu": [
"arm64"
],
@@ -500,9 +500,9 @@
]
},
"node_modules/@oven/bun-darwin-x64": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.1.12.tgz",
"integrity": "sha512-XWL6atcLxyh4KgOlqqyHUOh4Ylm46CExipJmAdKs30gyYqbw3E+HTFhADsyFEtugOe0qPUNlo0aMo+ZMc1yIQA==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.1.13.tgz",
"integrity": "sha512-N9t2JHLIEs/n+d7R6ybU/3d7o7xGeKd1U3vip9RMLaEAaJM6mfByAHmhwaQesr3Z6ljcs1zkQJNaFMJA/cJqnA==",
"cpu": [
"x64"
],
@@ -514,9 +514,9 @@
]
},
"node_modules/@oven/bun-darwin-x64-baseline": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.1.12.tgz",
"integrity": "sha512-KXBwaeD9y4GuxSqC1uDNIktTC/jY2DtagiURuUOF1rniYxkkLRNgXotTvVA5NvP2PBCoWyrxZ67WJSBm0AIyjQ==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.1.13.tgz",
"integrity": "sha512-RvVAeFMIayd8HKJqkWnZdI9BQJbH87jAXhNVMLlHpGqP4JVvkPLCKJT5jr9/4FGeWtQmMMZufH6PzTxpHCc9HQ==",
"cpu": [
"x64"
],
@@ -528,9 +528,9 @@
]
},
"node_modules/@oven/bun-linux-aarch64": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.1.12.tgz",
"integrity": "sha512-6Jen4+b5BzInF7bbRjMIWoy3xIuK/kQQn9xehvrAYnr3J9p3vCD5VhzDP20hW9yQcmZtO2kE6pIYCbaaxPNKtg==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.1.13.tgz",
"integrity": "sha512-5F9EKOjQauRXr+D3VjeMebKyq93xhdgrBOfpPnAn/C+NLFs1Wa2ZjwGAKjW2akmqht6milHft3sbsnCIR+MWIQ==",
"cpu": [
"arm64"
],
@@ -542,9 +542,9 @@
]
},
"node_modules/@oven/bun-linux-x64": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.1.12.tgz",
"integrity": "sha512-X4dqnIOv4M9HAL4tAj9bb14WjsfKby5xWNV/otUxtfSDsDrV2ukYUekivEmHqchxHFUHOHyc/cv+/jtfvedDZg==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.1.13.tgz",
"integrity": "sha512-3mq50HhwJbAwu0Dw6OCB5PS6uD1bpFGb8XrEgxnOB3ZydCBOVRRjoY1Jb8HjYHVKzFJZoPrUqulToA8od3IzeQ==",
"cpu": [
"x64"
],
@@ -556,9 +556,9 @@
]
},
"node_modules/@oven/bun-linux-x64-baseline": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.1.12.tgz",
"integrity": "sha512-luwWf/QGMJ23+yIRBMDnhjYuxh9zXy+Vw4lAzwvLB7phYXCs7IPEhIhZxhcZQ3XMafWtHlWAVo5P6NZZdFRMUQ==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.1.13.tgz",
"integrity": "sha512-0zhCVLsFcIyfqqsum7XUejuF3QhRkhI1DxgHQrLs16EKS4gt4X4A49jgTIHOvyedHcKb3FZOLsyjpOejB8kIpg==",
"cpu": [
"x64"
],
@@ -570,9 +570,9 @@
]
},
"node_modules/@oven/bun-windows-x64": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.1.12.tgz",
"integrity": "sha512-ufvTeXXI9tJSJUhvdPnFUmGqCNBKBazEwjvQ5c8vhtZ8hdBHV54LoURVDIBYCgzfdv5NQT3sr8qRLFqy4mlMLg==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.1.13.tgz",
"integrity": "sha512-PwFKQVFzhpUMAF86PwIEctfFT8ZQe1Gueqn1dKk07lwJOBve+Ou2NUEoQsq0eac0Cbw2C20fScjyVzDBwIMIPQ==",
"cpu": [
"x64"
],
@@ -584,9 +584,9 @@
]
},
"node_modules/@oven/bun-windows-x64-baseline": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.1.12.tgz",
"integrity": "sha512-MRn+zcJO1hcVqwJmFxpUSdb6ZvrYC8Xp2N1fPOzdw3YSskz9iHkJuUKzx7s9iCC7jTpo6XI/H51EFr/M2U7Ipg==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.1.13.tgz",
"integrity": "sha512-7CVWrc/6LSRrdkxwBjAt4ehqQrLxC9k8+LI7VZKAYt1yNHM3JaOhcPyt3AJB10cmzc5HA/q/uSi6xcNUnlCWiA==",
"cpu": [
"x64"
],
@@ -1220,9 +1220,9 @@
}
},
"node_modules/bun": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/bun/-/bun-1.1.12.tgz",
"integrity": "sha512-NZzeZuZk7VwCs8VAXnXUHCPOlTS/IyHCscChtT1M1FLSwhBcVMsGVStYlXaaoqsinBKgp0CGJdhnJw2gR3NkDw==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/bun/-/bun-1.1.13.tgz",
"integrity": "sha512-yrujTLEspzQJfh7hd2xkYM5skQsjBwVm/wq0cyYBkR5x4FRveOUqeAqtFOPH4aHvsDgwVN+dO0uIrlvE7dDsDQ==",
"cpu": [
"arm64",
"x64"
@@ -1240,14 +1240,14 @@
"bunx": "bin/bun.exe"
},
"optionalDependencies": {
"@oven/bun-darwin-aarch64": "1.1.12",
"@oven/bun-darwin-x64": "1.1.12",
"@oven/bun-darwin-x64-baseline": "1.1.12",
"@oven/bun-linux-aarch64": "1.1.12",
"@oven/bun-linux-x64": "1.1.12",
"@oven/bun-linux-x64-baseline": "1.1.12",
"@oven/bun-windows-x64": "1.1.12",
"@oven/bun-windows-x64-baseline": "1.1.12"
"@oven/bun-darwin-aarch64": "1.1.13",
"@oven/bun-darwin-x64": "1.1.13",
"@oven/bun-darwin-x64-baseline": "1.1.13",
"@oven/bun-linux-aarch64": "1.1.13",
"@oven/bun-linux-x64": "1.1.13",
"@oven/bun-linux-x64-baseline": "1.1.13",
"@oven/bun-windows-x64": "1.1.13",
"@oven/bun-windows-x64-baseline": "1.1.13"
}
},
"node_modules/callsites": {

View File

@@ -1,6 +1,6 @@
{
"name": "@pyscript/core",
"version": "0.4.44",
"version": "0.4.46",
"type": "module",
"description": "PyScript",
"module": "./index.js",
@@ -53,7 +53,7 @@
"@codemirror/lang-python": "^6.1.6",
"@codemirror/language": "^6.10.2",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.28.0",
"@codemirror/view": "^6.28.1",
"@playwright/test": "^1.44.1",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
@@ -61,7 +61,7 @@
"@webreflection/toml-j0.4": "^1.1.3",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.11.0",
"bun": "^1.1.12",
"bun": "^1.1.13",
"chokidar": "^3.6.0",
"codemirror": "^6.0.1",
"eslint": "^9.4.0",

View File

@@ -291,7 +291,7 @@ const init = async (script, type, interpreter) => {
const doc = dedent(script.textContent).trim();
// preserve user indentation, if any
const indentation = /^(\s+)/m.test(doc) ? RegExp.$1 : " ";
const indentation = /^([ \t]+)/m.test(doc) ? RegExp.$1 : " ";
const listener = () => runButton.click();
const editor = new EditorView({