diff --git a/client/src/extension.ts b/client/src/extension.ts index d119b19c..3b41d408 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -56,6 +56,7 @@ export function activate(context: ExtensionContext) { // when running in web mode, it fails posting these values as messages, so convert to raw JSON, codeLens: JSON.parse(JSON.stringify(workspace.getConfiguration("abaplint").get("codeLens"))), inlayHints: JSON.parse(JSON.stringify(workspace.getConfiguration("abaplint").get("inlayHints"))), + formatting: JSON.parse(JSON.stringify(workspace.getConfiguration("abaplint").get("formatting"))), }, synchronize: { fileEvents: workspace.createFileSystemWatcher("**/abaplint.json*"), diff --git a/package-lock.json b/package-lock.json index aa5c9041..8f016de0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "vscode-abaplint", - "version": "0.6.376", + "version": "0.6.377", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-abaplint", - "version": "0.6.376", + "version": "0.6.377", "hasInstallScript": true, "license": "MIT", "devDependencies": { "@types/mocha": "^10.0.6", - "@types/node": "^20.12.8", - "@typescript-eslint/eslint-plugin": "^7.7.1", - "@typescript-eslint/parser": "^7.7.1", + "@types/node": "^20.12.9", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", "@vscode/test-web": "^0.0.54", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", @@ -359,9 +359,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.12.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz", - "integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==", + "version": "20.12.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.9.tgz", + "integrity": "sha512-o93r47yu04MHumPBCFg0bMPBMNgtMg3jzbhl7e68z50+BMHmRMGDJv13eBlUgOdc9i/uoJXGMGYLtJV4ReTXEg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -374,16 +374,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz", - "integrity": "sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz", + "integrity": "sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.7.1", - "@typescript-eslint/type-utils": "7.7.1", - "@typescript-eslint/utils": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/type-utils": "7.8.0", + "@typescript-eslint/utils": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.3.1", @@ -409,15 +409,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.7.1.tgz", - "integrity": "sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz", + "integrity": "sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.7.1", - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/typescript-estree": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/typescript-estree": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", "debug": "^4.3.4" }, "engines": { @@ -437,13 +437,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz", - "integrity": "sha512-PytBif2SF+9SpEUKynYn5g1RHFddJUcyynGpztX3l/ik7KmZEv19WCMhUBkHXPU9es/VWGD3/zg3wg90+Dh2rA==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz", + "integrity": "sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1" + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -454,13 +454,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz", - "integrity": "sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz", + "integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.7.1", - "@typescript-eslint/utils": "7.7.1", + "@typescript-eslint/typescript-estree": "7.8.0", + "@typescript-eslint/utils": "7.8.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -481,9 +481,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.7.1.tgz", - "integrity": "sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz", + "integrity": "sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==", "dev": true, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -494,13 +494,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz", - "integrity": "sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz", + "integrity": "sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -546,17 +546,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.7.1.tgz", - "integrity": "sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz", + "integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.15", "@types/semver": "^7.5.8", - "@typescript-eslint/scope-manager": "7.7.1", - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/typescript-estree": "7.7.1", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/typescript-estree": "7.8.0", "semver": "^7.6.0" }, "engines": { @@ -571,12 +571,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.1.tgz", - "integrity": "sha512-gBL3Eq25uADw1LQ9kVpf3hRM+DWzs0uZknHYK3hq4jcTPqVCClHGDnB6UUUV2SFeBeA4KWHWbbLqmbGcZ4FYbw==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz", + "integrity": "sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.7.1", + "@typescript-eslint/types": "7.8.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -5712,9 +5712,9 @@ "dev": true }, "@types/node": { - "version": "20.12.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz", - "integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==", + "version": "20.12.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.9.tgz", + "integrity": "sha512-o93r47yu04MHumPBCFg0bMPBMNgtMg3jzbhl7e68z50+BMHmRMGDJv13eBlUgOdc9i/uoJXGMGYLtJV4ReTXEg==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -5727,16 +5727,16 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz", - "integrity": "sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz", + "integrity": "sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==", "dev": true, "requires": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.7.1", - "@typescript-eslint/type-utils": "7.7.1", - "@typescript-eslint/utils": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/type-utils": "7.8.0", + "@typescript-eslint/utils": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.3.1", @@ -5746,54 +5746,54 @@ } }, "@typescript-eslint/parser": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.7.1.tgz", - "integrity": "sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz", + "integrity": "sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "7.7.1", - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/typescript-estree": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/typescript-estree": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", "debug": "^4.3.4" } }, "@typescript-eslint/scope-manager": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz", - "integrity": "sha512-PytBif2SF+9SpEUKynYn5g1RHFddJUcyynGpztX3l/ik7KmZEv19WCMhUBkHXPU9es/VWGD3/zg3wg90+Dh2rA==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz", + "integrity": "sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==", "dev": true, "requires": { - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1" + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0" } }, "@typescript-eslint/type-utils": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz", - "integrity": "sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz", + "integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "7.7.1", - "@typescript-eslint/utils": "7.7.1", + "@typescript-eslint/typescript-estree": "7.8.0", + "@typescript-eslint/utils": "7.8.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" } }, "@typescript-eslint/types": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.7.1.tgz", - "integrity": "sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz", + "integrity": "sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz", - "integrity": "sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz", + "integrity": "sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==", "dev": true, "requires": { - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/visitor-keys": "7.7.1", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/visitor-keys": "7.8.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -5823,27 +5823,27 @@ } }, "@typescript-eslint/utils": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.7.1.tgz", - "integrity": "sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz", + "integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.15", "@types/semver": "^7.5.8", - "@typescript-eslint/scope-manager": "7.7.1", - "@typescript-eslint/types": "7.7.1", - "@typescript-eslint/typescript-estree": "7.7.1", + "@typescript-eslint/scope-manager": "7.8.0", + "@typescript-eslint/types": "7.8.0", + "@typescript-eslint/typescript-estree": "7.8.0", "semver": "^7.6.0" } }, "@typescript-eslint/visitor-keys": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.1.tgz", - "integrity": "sha512-gBL3Eq25uADw1LQ9kVpf3hRM+DWzs0uZknHYK3hq4jcTPqVCClHGDnB6UUUV2SFeBeA4KWHWbbLqmbGcZ4FYbw==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz", + "integrity": "sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==", "dev": true, "requires": { - "@typescript-eslint/types": "7.7.1", + "@typescript-eslint/types": "7.8.0", "eslint-visitor-keys": "^3.4.3" } }, diff --git a/package.json b/package.json index 5db2c75b..9f673ef4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "ABAP linting, problems view, go to definition, find references, and quick fixes.", "author": "Lars Hvam", "license": "MIT", - "version": "0.6.376", + "version": "0.6.377", "repository": { "type": "git", "url": "https://github.com/abaplint/vscode-abaplint" @@ -78,6 +78,14 @@ "fileMatch": "abaplint.jsonc", "url": "https://schema.abaplint.org/schema.json" }, + { + "fileMatch": "abaplint-downport.json", + "url": "https://schema.abaplint.org/schema.json" + }, + { + "fileMatch": "abaplint-downport.jsonc", + "url": "https://schema.abaplint.org/schema.json" + }, { "fileMatch": "abaplint.json5", "url": "https://schema.abaplint.org/schema.json" @@ -142,54 +150,67 @@ "when": "editorLangId == 'abap' && editorTextFocus" } ], - "configuration": { - "type": "object", - "title": "abaplint", - "properties": { - "abaplint.enableSemanticHighlighting": { - "scope": "window", - "type": "boolean", - "default": true, - "description": "Enable semantic highlighting, requires vscode restart" - }, - "abaplint.inlayHints": { - "type": "object", - "title": "Inlay Hints", - "properties": { - "inferredTypes": { - "type": "boolean", - "description": "Show inferred types", - "default": true - } + "configuration": [ + { + "order": 10, + "id": "semanticHighlighting", + "title": "Semantic Highlighting", + "properties": { + "abaplint.enableSemanticHighlighting": { + "scope": "window", + "type": "boolean", + "default": true, + "description": "Enable semantic highlighting, requires restart" + } + } + }, + { + "order": 20, + "id": "codeLens", + "title": "Code Lens", + "properties": { + "abaplint.codeLens.messageText": { + "type": "boolean", + "description": "Show message texts", + "default": true }, - "additionalProperties": false, - "default": { - "inferredTypes": true + "abaplint.codeLens.dynamicExceptions": { + "type": "boolean", + "description": "Show dynamic exceptions", + "default": true + } + } + }, + { + "order": 30, + "id": "inlayHints", + "title": "Inlay Hints", + "properties": { + "abaplint.inlayHints.inferredTypes": { + "type": "boolean", + "description": "Show inferred types, requires restart", + "default": true } - }, - "abaplint.codeLens": { - "type": "object", - "title": "Code Lens", - "properties": { - "messageText": { - "type": "boolean", - "description": "Show message texts", - "default": true - }, - "dynamicExceptions": { - "type": "boolean", - "description": "Show dynamic exceptions", - "default": true - } + } + }, + { + "order": 40, + "id": "formatting", + "title": "Formatting", + "properties": { + "abaplint.formatting.enable": { + "type": "boolean", + "description": "Enable document formatting, requires restart", + "default": true }, - "additionalProperties": false, - "default": { - "messageText": true, - "dynamicExceptions": true + "abaplint.formatting.experimental": { + "type": "boolean", + "description": "Enable experimental document formatting, requires restart", + "default": false } } } - } + ] }, "scripts": { "lint": "eslint client/src/**/*.ts server/src/**/*.ts --format unix", @@ -213,9 +234,9 @@ }, "devDependencies": { "@types/mocha": "^10.0.6", - "@types/node": "^20.12.8", - "@typescript-eslint/eslint-plugin": "^7.7.1", - "@typescript-eslint/parser": "^7.7.1", + "@types/node": "^20.12.9", + "@typescript-eslint/eslint-plugin": "^7.8.0", + "@typescript-eslint/parser": "^7.8.0", "@vscode/test-web": "^0.0.54", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", diff --git a/server/package-lock.json b/server/package-lock.json index 348119d8..ea1c1846 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@abaplint/core": "^2.107.2", + "@abaplint/core": "^2.107.3", "glob": "^7.2.3", "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.11", @@ -17,16 +17,16 @@ }, "devDependencies": { "@types/glob": "^8.1.0", - "@types/node": "^20.12.8" + "@types/node": "^20.12.9" }, "engines": { "node": "*" } }, "node_modules/@abaplint/core": { - "version": "2.107.2", - "resolved": "https://registry.npmjs.org/@abaplint/core/-/core-2.107.2.tgz", - "integrity": "sha512-M2AzW29Xa1CsULUMvsiDuaL5O2mrWkN7TY9Ic6lEibWTlpGdd3TT76XNQq+NJAWdnkIbqjQF7U6Ibu7U8LrXWA==", + "version": "2.107.3", + "resolved": "https://registry.npmjs.org/@abaplint/core/-/core-2.107.3.tgz", + "integrity": "sha512-re58u5uzUV7thyjuhm0+xvyQQtJveiK1cuPrPdIfMhTOH31q+o/P+RfDClIOHEZPXqH+6Yw8GXF0ZWYcu5hGZQ==", "dependencies": { "fast-xml-parser": "^4.3.6", "json5": "^2.2.3", @@ -56,9 +56,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.12.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz", - "integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==", + "version": "20.12.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.9.tgz", + "integrity": "sha512-o93r47yu04MHumPBCFg0bMPBMNgtMg3jzbhl7e68z50+BMHmRMGDJv13eBlUgOdc9i/uoJXGMGYLtJV4ReTXEg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -242,9 +242,9 @@ }, "dependencies": { "@abaplint/core": { - "version": "2.107.2", - "resolved": "https://registry.npmjs.org/@abaplint/core/-/core-2.107.2.tgz", - "integrity": "sha512-M2AzW29Xa1CsULUMvsiDuaL5O2mrWkN7TY9Ic6lEibWTlpGdd3TT76XNQq+NJAWdnkIbqjQF7U6Ibu7U8LrXWA==", + "version": "2.107.3", + "resolved": "https://registry.npmjs.org/@abaplint/core/-/core-2.107.3.tgz", + "integrity": "sha512-re58u5uzUV7thyjuhm0+xvyQQtJveiK1cuPrPdIfMhTOH31q+o/P+RfDClIOHEZPXqH+6Yw8GXF0ZWYcu5hGZQ==", "requires": { "fast-xml-parser": "^4.3.6", "json5": "^2.2.3", @@ -268,9 +268,9 @@ "dev": true }, "@types/node": { - "version": "20.12.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz", - "integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==", + "version": "20.12.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.9.tgz", + "integrity": "sha512-o93r47yu04MHumPBCFg0bMPBMNgtMg3jzbhl7e68z50+BMHmRMGDJv13eBlUgOdc9i/uoJXGMGYLtJV4ReTXEg==", "dev": true, "requires": { "undici-types": "~5.26.4" diff --git a/server/package.json b/server/package.json index 22cab6cb..9999b302 100644 --- a/server/package.json +++ b/server/package.json @@ -13,11 +13,11 @@ "url": "https://github.com/abaplint/vscode-abaplint" }, "devDependencies": { - "@types/node": "^20.12.8", + "@types/node": "^20.12.9", "@types/glob": "^8.1.0" }, "dependencies": { - "@abaplint/core": "^2.107.2", + "@abaplint/core": "^2.107.3", "vscode-uri": "^3.0.8", "glob": "^7.2.3", "vscode-languageserver-textdocument": "^1.0.11", diff --git a/server/src/handler.ts b/server/src/handler.ts index 27858ffb..398dc8fa 100644 --- a/server/src/handler.ts +++ b/server/src/handler.ts @@ -7,6 +7,7 @@ import {TextDocument} from "vscode-languageserver-textdocument"; import {FileOperations} from "./file_operations"; import {GitOperations} from "./git"; import {UnitTests} from "./handlers/unit_test"; +import {Formatting} from "./handlers/formatting"; export interface IFolder { root: string; @@ -160,10 +161,13 @@ export class Handler { return new abaplint.LanguageServer(this.reg).references(params); } - public onDocumentFormatting(params: LServer.DocumentFormattingParams): LServer.TextEdit[] { - // todo, temporary workaround, the options from params should also be passed to abaplint - const edits = new abaplint.LanguageServer(this.reg).documentFormatting({textDocument: params.textDocument}); - return edits; + public async onDocumentFormatting(params: LServer.DocumentFormattingParams, + experimentalFormatting: boolean): Promise { + if (experimentalFormatting === true) { + return new Formatting(this.reg).findEdits(params.textDocument); + } else { + return new abaplint.LanguageServer(this.reg).documentFormatting({textDocument: params.textDocument}); + } } public onCodeLens(params: LServer.CodeLensParams): LServer.CodeLens[] { diff --git a/server/src/handlers/formatting.ts b/server/src/handlers/formatting.ts new file mode 100644 index 00000000..e276a7f0 --- /dev/null +++ b/server/src/handlers/formatting.ts @@ -0,0 +1,28 @@ +import * as LServer from "vscode-languageserver"; +import * as abaplint from "@abaplint/core"; + +export class Formatting { + private readonly reg: abaplint.IRegistry; + + public constructor(reg: abaplint.IRegistry) { + this.reg = reg; + } + + public async findEdits(document: LServer.TextDocumentIdentifier): Promise { + const edits: LServer.TextEdit[] = []; + + const issues = new abaplint.Diagnostics(this.reg).findIssues(document); + for (const i of issues) { + const edit = i.getDefaultFix(); + if (edit === undefined) { + continue; + } + + const changes = abaplint.LSPEdit.mapEdit(edit).changes?.[document.uri] || []; + edits.push(...changes); + } + + return edits; + } + +} \ No newline at end of file diff --git a/server/src/server.ts b/server/src/server.ts index 2e964085..0df08389 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -15,6 +15,8 @@ if (fs.read === undefined) { connection = LServer.createConnection(LServer.ProposedFeatures.all); } +let experimentalFormatting = false; + // create a simple text document manager. The text document manager // supports full document sync only const documents = new LServer.TextDocuments(TextDocument); @@ -63,6 +65,14 @@ function initialize() { inlayHintProvider = undefined; } + let documentFormattingProvider = true; + if (params.initializationOptions.formatting?.enable === false) { + documentFormattingProvider = false; + } + if (params.initializationOptions.formatting?.experimental === true) { + experimentalFormatting = true; + } + // does the client support the `workspace/configuration` request? // if not, we will fall back using global settings hasConfigurationCapability = capabilities.workspace && !!capabilities.workspace.configuration; @@ -79,7 +89,7 @@ function initialize() { capabilities: { semanticTokensProvider: tokensProvider, textDocumentSync: LServer.TextDocumentSyncKind.Full, - documentFormattingProvider: true, + documentFormattingProvider: documentFormattingProvider, definitionProvider: true, codeLensProvider: codeLensProvider, inlayHintProvider: inlayHintProvider, @@ -185,7 +195,7 @@ connection.languages.inlayHint.on(async(params) => { connection.onDocumentFormatting(async(params) => { const handler = await getHandler(); - return handler.onDocumentFormatting(params); + return handler.onDocumentFormatting(params, experimentalFormatting); }); connection.onDocumentSymbol(async(params) => {