Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using "Calva Format: Format and Align Current Form" shortcut in VSCode #2231

Closed
LouDnl opened this issue Jun 23, 2023 · 1 comment

Comments

@LouDnl
Copy link

LouDnl commented Jun 23, 2023

I frequently use the "Calva Format: Format and Align Current Form" shortcut in VSCode, which is a great tool btw.

When trying to format a map that has a key value pair where said value contains a namespaced keyword the formatting doesn't work.

An error is thrown in the developer tools:

ERR Namespaced keywords not supported !

ERR [Extension Host] Error in `formatIndex`: Namespaced keywords not supported !

[Extension Host] Error in `formatIndex`: Namespaced keywords not supported ! (at console.<anonymous> (d:\Beheer\_portable-tools\programming\VSCode-Insider\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:99:151752))
S @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:862
deliver @ event.ts:1075
fire @ event.ts:1031
fire @ ipc.net.ts:650
Q.onmessage @ localProcessExtensionHost.ts:583

[Extension Host] rejected promise not handled within 1 second: Namespaced keywords not supported ! (at console.<anonymous> (d:\Beheer\_portable-tools\programming\VSCode-Insider\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:99:151752))
S @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
N @ rpcProtocol.ts:455
M @ rpcProtocol.ts:440
H @ rpcProtocol.ts:370
G @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:862
deliver @ event.ts:1075
fire @ event.ts:1031
fire @ ipc.net.ts:650
Q.onmessage @ localProcessExtensionHost.ts:583

Example non working where :action value contains a namespaced keyword:

{:action (ring/path-for ::login {:customer-slug customer-slug})
:method  :post
:data-form-type "other"}

Example working where the namespace is written:

{:action        (ring/path-for :my.namespace/login {:customer-slug customer-slug})
:method         :post
:data-form-type "other"}
@PEZ PEZ added the formatting label Jun 23, 2023
@PEZ
Copy link
Collaborator

PEZ commented Jun 23, 2023

This is due to that the version of rewrite-cljs used does not support auto-namespaced keywords:

https://github.com/clj-commons/rewrite-cljs/blob/master/src/rewrite_clj/node/keyword.cljs#L16

This feature in Calva is built on an old fork suffering from this and many more limitations. Things will not improve until align-associative is a feature in the main distribution of cljfmt. For which there is hope now:

Also see https://calva.io/formatting/#about-aligning-associative-forms

@PEZ PEZ closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants