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

Format config from clojure-lsp broken #1561

Closed
isacjunior opened this issue Feb 23, 2022 · 10 comments
Closed

Format config from clojure-lsp broken #1561

isacjunior opened this issue Feb 23, 2022 · 10 comments

Comments

@isacjunior
Copy link
Contributor

The format on save works when I save a file, but apparently, the format doesn't correspond to the clojure-lsp config. Also, an error is showing when a open my project.

versions:

calva v2.0.245
clojure-lsp version used: 2022.02.23-12.12.12
clj-kondo version used: 2022.02.09

settings:

"calva.fmt.configPath": "CLOJURE-LSP",
"calva.clojureLspPath": "/usr/local/bin/clojure-lsp",
"editor.formatOnSave": true,

error:

Fetching formatting settings from clojure-lsp failed. Check that you are running a version of clojure-lsp that provides "cljfmt-raw" in serverInfo.

Running the Clojure-lsp Server Info I see the cljfmt-raw field.

  "cljfmt-raw": "{:indents {assoc-in-some [[:block 1] [:block 1] [:block 1] [:block 1]], facts [[:block 1] [:block 1] [:block 1] [:block 1]], with-responses [[:block 0] [:block 0] [:block 0] [:block 0]], provided [[:inner 0] [:inner 0] [:inner 0] [:inner 0]], as-delegate [[:block 2] [:block 2] [:block 2] [:block 2]], lambda-expr [[:inner 0]], |fn [[:inner 0]], assoc-if [[:block 1] [:block 1] [:block 1] [:block 1]], defglobal-native [[:inner 0]], profile [[:block 2] [:block 2] [:block 2] [:block 2]], with-scopes [[:block 1] [:block 1] [:block 1] [:block 1]], consume! [[:block 0] [:block 0] [:block 0] [:block 0]], defint [[:block 0] [:block 0] [:block 0] [:block 0]], as-delegate-with-lift [[:block 2] [:block 2] [:block 2] [:block 2]], defglobal-library [[:inner 0]], |if-not [[:block 1]], |when [[:block 1]], let-entities [[:block 2] [:block 2] [:block 2] [:block 2]], |with-state [[:block 1]], constraint-fn [[:block 2] [:block 2] [:block 2] [:block 2]], as-customer [[:block 1] [:block 1] [:block 1] [:block 1]], for-all [[:block 1] [:block 1] [:block 1] [:block 1]], flow [[:block 1] [:block 1] [:block 1] [:block 1]], against-background [[:inner 0] [:inner 0] [:inner 0] [:inner 0]], quick-check [[:block 1] [:block 1] [:block 1] [:block 1]], against-backgroud [[:block 0]], logged-call [[:block 1] [:block 1] [:block 1] [:block 1]], run-recipe [[:inner 0] [:inner 0] [:inner 0] [:inner 0]], log-messages [[:block 0] [:block 0] [:block 0] [:block 0]], profiled [[:block 1] [:block 1] [:block 1] [:block 1]], |def-expr [[:inner 0]], as-admin [[:block 1] [:block 1] [:block 1] [:block 1]], try-type [[:block 0] [:block 0] [:block 0] [:block 0]], |if [[:block 1]], future-facts [[:block 1] [:block 1] [:block 1] [:block 1]], some-with-open [[:block 1] [:block 1] [:block 1] [:block 1]], not-join [[:block 1]], fact [[:block 1] [:block 1] [:block 1] [:block 1]], expand-routes [[:inner 1] [:inner 1] [:inner 1] [:inner 1]], flow-with-defaults [[:block 1] [:block 1] [:block 1]], if-expr [[:block 1]], |let [[:block 1]], idempotent-start [[:block 1] [:block 1] [:block 1] [:block 1]], idempotent-stop [[:block 1] [:block 1] [:block 1] [:block 1]], as-of [[:block 1] [:block 1] [:block 1] [:block 1]], with-fn-validation [[:block 0] [:block 0] [:block 0] [:block 0]], defuf [[:block 1] [:block 1] [:block 1] [:block 1]], rethrow [[:block 1] [:block 1] [:block 1] [:block 1]], flow-as-of [[:block 1] [:block 1] [:block 1] [:block 1]], assoc-some [[:block 1] [:block 1] [:block 1] [:block 1]], future-fact [[:block 1] [:block 1] [:block 1] [:block 1]], tabular [[:inner 0] [:inner 0] [:inner 0] [:inner 0]], as-customer-with-lift [[:block 1] [:block 1] [:block 1] [:block 1]], non-test-action [[:inner 0] [:inner 0] [:inner 0] [:inner 0]], data-fn [[:block 1] [:block 1] [:block 1] [:block 1]], let-expr [[:block 1]], assoc [[:block 1] [:block 1] [:block 1] [:block 1]], assoc-in-if [[:block 1] [:block 1] [:block 1] [:block 1]], flow-without-validation [[:block 1] [:block 1] [:block 1] [:block 1]], ignore-conflict [[:inner 0] [:inner 0] [:inner 0] [:inner 0]], with-cid [[:block 1] [:block 1] [:block 1] [:block 1]], let-flow [[:block 1] [:block 1] [:block 1] [:block 1]], embeds [[:block 0] [:block 0] [:block 0] [:block 0]], system-map [[:block 0] [:block 0] [:block 0] [:block 0]], defhandler [[:block 2] [:block 2] [:block 2] [:block 2]]}}"
@PEZ
Copy link
Collaborator

PEZ commented Feb 23, 2022

Thanks! Can you share your cljfmt config as well? I think it must be something in there making things go boom.

@isacjunior
Copy link
Contributor Author

 :cljfmt {:indents {against-backgroud       [[:block 0]]
                    against-background      [[:inner 0]]
                    as-admin                [[:block 1]]
                    as-customer             [[:block 1]]
                    as-customer-with-lift   [[:block 1]]
                    as-delegate             [[:block 2]]
                    as-delegate-with-lift   [[:block 2]]
                    as-of                   [[:block 1]]
                    assoc                   [[:block 1]]
                    system-map              [[:block 0]]
                    assoc-if                [[:block 1]]
                    assoc-in-if             [[:block 1]]
                    assoc-some              [[:block 1]]
                    assoc-in-some           [[:block 1]]
                    constraint-fn           [[:block 2]]
                    consume!                [[:block 0]]
                    data-fn                 [[:block 1]]
                    defhandler              [[:block 2]]
                    defint                  [[:block 0]]
                    defuf                   [[:block 1]]
                    embeds                  [[:block 0]]
                    expand-routes           [[:inner 1]]
                    fact                    [[:block 1]]
                    facts                   [[:block 1]]
                    flow                    [[:block 1]]
                    flow-as-of              [[:block 1]]
                    flow-without-validation [[:block 1]]
                    for-all                 [[:block 1]]
                    future-fact             [[:block 1]]
                    future-facts            [[:block 1]]
                    idempotent-start        [[:block 1]]
                    idempotent-stop         [[:block 1]]
                    ignore-conflict         [[:inner 0]]
                    let-entities            [[:block 2]]
                    let-flow                [[:block 1]]
                    log-messages            [[:block 0]]
                    logged-call             [[:block 1]]
                    non-test-action         [[:inner 0]]
                    not-join                [[:block 1]]
                    profile                 [[:block 2]]
                    profiled                [[:block 1]]
                    provided                [[:inner 0]]
                    quick-check             [[:block 1]]
                    rethrow                 [[:block 1]]
                    run-recipe              [[:inner 0]]
                    some-with-open          [[:block 1]]
                    tabular                 [[:inner 0]]
                    try-type                [[:block 0]]
                    with-cid                [[:block 1]]
                    with-fn-validation      [[:block 0]]
                    with-responses          [[:block 0]]
                    with-scopes             [[:block 1]]
                    defglobal-native        [[:inner 0]]
                    defglobal-library       [[:inner 0]]
                    if-expr                 [[:block 1]]
                    let-expr                [[:block 1]]
                    lambda-expr             [[:inner 0]]
                    |def-expr               [[:inner 0]]
                    |if                     [[:block 1]]
                    |if-not                 [[:block 1]]
                    |let                    [[:block 1]]
                    |fn                     [[:inner 0]]
                    |with-state             [[:block 1]]
                    |when                   [[:block 1]]}}

@PEZ PEZ changed the title Format on save from clojure-lsp doesn't work Format config from clojure-lsp broken Feb 24, 2022
@PEZ
Copy link
Collaborator

PEZ commented Feb 24, 2022

@isacjunior Thanks! It turned out it wasn't your config, but a race condition. Will have a VSIX soon that you can test for me.

@PEZ
Copy link
Collaborator

PEZ commented Feb 24, 2022

This one should even use the custom config: https://18330-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.246-1561-fix-clojure-lsp-format-config-16a7c9a4.vsix

(Deleted the other message so that no-one wastes time on testing it.)

@isacjunior
Copy link
Contributor Author

isacjunior commented Feb 24, 2022

The error about "cljfmt-raw" wasn't shown. But apparently, the format style doesn't correspond to the cljfmt config.

@PEZ
Copy link
Collaborator

PEZ commented Feb 24, 2022

@isacjunior Thanks for quick help! That was the behaviour of the first VSIX I posted. Did you maybe use that one? (It could still be wrong, I'm just checking.

@isacjunior
Copy link
Contributor Author

The version used is v2.0.246-1561-fix-clojure-lsp-format-config-16a7c9a4

@PEZ
Copy link
Collaborator

PEZ commented Feb 24, 2022

Hmmm. Let's see if your fix is what is missing.

@PEZ
Copy link
Collaborator

PEZ commented Feb 24, 2022

There were some other issues as well, but maybe now: https://18354-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.246-1561-fix-clojure-lsp-format-config-385afdfd.vsix

@isacjunior
Copy link
Contributor Author

Now it worked.

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