lsp

mikejcusack 2025-10-14T05:05:31.327749Z

@ericdallo Testing the nightly build for the namespaced map support. It doesn't appear to be working for me.

mikejcusack 2025-10-14T05:27:51.203239Z

Calva version used: v2.0.536
clojure-lsp version used: 2025.10.13-18.02.26-nightly
clj-kondo version used: 2025.07.28

mikejcusack 2025-10-14T05:38:36.383919Z

Sorry forgot the colon above, but it's still burying the appropriate response when done properly. I would expect :valueType to be the only suggestion when using the namespaced map.

mikejcusack 2025-10-14T05:40:08.780559Z

It is correct when it's not namespaced.

ericdallo 2025-10-14T11:36:42.988149Z

Are you sure those completions come from Clojure-lsp only? Can you enable lsp-log-io variable and then check lsp-log buffer to check what server is returning when completing?

mikejcusack 2025-10-14T12:50:05.047239Z

I'm using Calva, so yes

mikejcusack 2025-10-14T12:51:32.979709Z

I'm not sure how to do what you requested

ericdallo 2025-10-14T12:52:25.875479Z

let's first make sure you are using the nightly build

mikejcusack 2025-10-14T12:52:35.643679Z

See above

ericdallo 2025-10-14T12:52:59.936949Z

hum look correct

ericdallo 2025-10-14T12:57:16.238109Z

This is how it looks to me, so I wonder if it it's related with calva

ericdallo 2025-10-14T12:57:59.757479Z

so we can see what clojure-lsp is returning for that completion

mikejcusack 2025-10-14T12:58:32.713319Z

So what you have is coming from the same file. What I'm working with is coming from Datomic

mikejcusack 2025-10-14T12:58:59.223339Z

Though I do have it also in the same file given that it's defining the schema

ericdallo 2025-10-14T13:00:34.755719Z

yeah, not the issue here

ericdallo 2025-10-14T13:00:39.999419Z

I created tests for that case too

mikejcusack 2025-10-14T13:02:11.239209Z

Checking

mikejcusack 2025-10-14T13:06:06.879329Z

The log is huge. Which part should I be looking for?

ericdallo 2025-10-14T13:06:29.880489Z

check for completion response

ericdallo 2025-10-14T13:06:45.554509Z

You can restart LSP and do minimal things to repro, reducing this log

mikejcusack 2025-10-14T13:09:57.465179Z

2025-10-14T13:07:21.899Z  INFO [clojure-lsp.handlers:257] - :lsp/completion 11ms - total items: 1
2025-10-14T13:07:21.900Z  DEBUG [clojure-lsp.server:60] - [Trace - 2025-10-14T13:07:21.900Z] Sending response 'textDocument/completion - (19)'. Request took 12ms.
Result: [ {
  "text-edit" : {
    "new-text" : ":valueType",
    "range" : {
      "start" : {
        "line" : 6,
        "character" : 8
      },
      "end" : {
        "line" : 6,
        "character" : 10
      }
    }
  },
  "label" : ":valueType",
  "kind" : 14,
  "detail" : "",
  "data" : {
    "unresolved" : [ [ "documentation", {
      "name" : "valueType",
      "uri" : "...",
      "name-row" : 9,
      "name-col" : 5
    } ] ]
  },
  "score" : 11
} ]

mikejcusack 2025-10-14T13:10:12.133649Z

Does seem to be a Calva issue

ericdallo 2025-10-14T13:10:35.570169Z

yeah, my suggestion is to check if calva is adding any other completion backend like REPL or something

mikejcusack 2025-10-14T13:11:00.697009Z

@pez Is this the case?

mikejcusack 2025-10-14T13:12:13.605739Z

What's not making sense to me though is that when it's not a namespaced map :valueType is the only suggestion, as per above

ericdallo 2025-10-14T13:14:08.801559Z

yeah, also, if clojure-lsp is returning, I'd be expecting that calva is using that. Maybe you can compare both completions of namespaced and not namespaced in the logs and check if there is any big difference that may affect calva showing or not

seancorfield 2025-10-14T13:18:24.630699Z

Calva can be configured to use both lsp and repl or just one or the other, and you can configure which has preference.

mikejcusack 2025-10-14T13:18:28.249329Z

For :i I'm getting

2025-10-14T13:16:20.365Z  INFO [clojure-lsp.handlers:257] - :lsp/completion 13ms - total items: 4
2025-10-14T13:16:20.365Z  DEBUG [clojure-lsp.server:60] - [Trace - 2025-10-14T13:16:20.365Z] Sending response 'textDocument/completion - (97)'. Request took 14ms.
Result: [ {
  "text-edit" : {
    "new-text" : ":id",
    "range" : {
      "start" : {
        "line" : 6,
        "character" : 8
      },
      "end" : {
        "line" : 6,
        "character" : 10
      }
    }
  },
  "label" : ":id",
  "kind" : 14,
  "detail" : "",
  "data" : {
    "unresolved" : [ [ "documentation", {
      "name" : "id",
      "uri" : "...",
      "name-row" : 15,
      "name-col" : 40
    } ] ]
  },
  "score" : 11
}, {
  "text-edit" : {
    "new-text" : ":ident",
    "range" : {
      "start" : {
        "line" : 6,
        "character" : 8
      },
      "end" : {
        "line" : 6,
        "character" : 10
      }
    }
  },
  "label" : ":ident",
  "kind" : 14,
  "detail" : "",
  "data" : {
    "unresolved" : [ [ "documentation", {
      "name" : "ident",
      "uri" : "...",
      "name-row" : 108,
      "name-col" : 24
    } ] ]
  },
  "score" : 11
}, {
  "text-edit" : {
    "new-text" : ":index",
    "range" : {
      "start" : {
        "line" : 6,
        "character" : 8
      },
      "end" : {
        "line" : 6,
        "character" : 10
      }
    }
  },
  "label" : ":index",
  "kind" : 14,
  "detail" : "",
  "data" : {
    "unresolved" : [ [ "documentation", {
      "name" : "index",
      "uri" : "...",
      "name-row" : 258,
      "name-col" : 7
    } ] ]
  },
  "score" : 11
}, {
  "text-edit" : {
    "new-text" : ":isComponent",
    "range" : {
      "start" : {
        "line" : 6,
        "character" : 8
      },
      "end" : {
        "line" : 6,
        "character" : 10
      }
    }
  },
  "label" : ":isComponent",
  "kind" : 14,
  "detail" : "",
  "data" : {
    "unresolved" : [ [ "documentation", {
      "name" : "isComponent",
      "uri" : "...",
      "name-row" : 153,
      "name-col" : 5
    } ] ]
  },
  "score" : 11
} ]

seancorfield 2025-10-14T13:20:05.798739Z

Calva setting for definition provider:

👍 2
mikejcusack 2025-10-14T13:21:25.430769Z

Trying that, thanks

pez 2025-10-14T13:21:59.287639Z

Some of the code blocks in this thread are too big for Slack it seems. I had to really fight to scroll down to here. Slack kept snapping me back to the start of the code block.

mikejcusack 2025-10-14T13:21:59.863459Z

Unfortunately that made no difference

mikejcusack 2025-10-14T13:22:46.595639Z

With lsp,repl

ericdallo 2025-10-14T13:23:44.440569Z

I'd expect to see in that completion popup (keyword) which are completion type info that come from LSP, maybe it's not using that?

mikejcusack 2025-10-14T13:24:16.511869Z

I don't think Calva/VSCode shows that

pez 2025-10-14T13:25:23.684519Z

Calva merges nrepl and lsp answers, iirc.

🤔 1
mikejcusack 2025-10-14T13:26:37.182659Z

Then what is the purpose of the priority?

mikejcusack 2025-10-14T13:27:57.581139Z

Actually it seems the setting wasn't sticking

mikejcusack 2025-10-14T13:28:12.768489Z

When I clicked out of it the text would revert to repl,lsp

mikejcusack 2025-10-14T13:29:15.826319Z

When restarting VSCode it also reverts to repl,lsp

mikejcusack 2025-10-14T13:31:40.270289Z

@seancorfield There does not appear to be a setting to only use one or the other

seancorfield 2025-10-14T13:32:28.207149Z

Apparently not. I thought there was. And I'm also having problems changing it from repl,lsp to lsp,repl and getting it to stick.

mikejcusack 2025-10-14T13:32:46.930269Z

Looks like we found a bug

mikejcusack 2025-10-14T13:33:11.137169Z

I'll create an issue

seancorfield 2025-10-14T13:34:02.792369Z

Yup, no matter what I do in terms of selecting lsp,repl -- clicking, pressing enter, etc -- it reverts to repl,lsp if I even reload the window.

🎯 1
🕵️‍♂️ 1
mikejcusack 2025-10-14T13:35:59.100909Z

@pez https://github.com/BetterThanTomorrow/calva/issues/2951

pez 2025-10-14T19:58:20.976819Z

It’s the VS Code settings editor that is being stupid with it, I think. The actual setting is changed, I also think. And even so. That setting won’t affect these completions. It’s for definitions. Completions are merged.

mikejcusack 2025-10-15T03:37:01.425639Z

I don't see any other settings with that behavior

mikejcusack 2025-10-15T03:37:30.628539Z

What are definitions then?

mikejcusack 2025-10-15T03:37:41.150059Z

And no way to prefer completions from lsp?

mikejcusack 2025-10-15T03:38:03.160119Z

If so that makes it very difficult to use namespaced maps in Calva

pez 2025-10-15T06:41:50.592429Z

Definitions are what powers the Go to Definition command/feature in VS Code.

pez 2025-10-15T06:44:25.501749Z

There’s no config for controlling the merge of completions.

pez 2025-10-15T06:51:20.827629Z

The actual issue looks like something that should be fixed on the #nrepl side of things. Maybe it has been fixed even, Calva probably defaults to old versions. But also maybe it hasn’t. The namespaced map syntax is not very commonly used, I think.

mikejcusack 2025-10-15T10:20:12.241899Z

Eric added support for it in clojure-lsp. It just isn't working correctly in Calva due to the merging

mikejcusack 2025-10-15T10:20:33.799779Z

It would really be helpful to allow configuring the source and priority of completions in Calva

mikejcusack 2025-10-15T10:21:09.872949Z

I actually see namespaced maps all the time in different projects, including very popular ones

ericdallo 2025-10-15T12:03:59.068989Z

@pez I agree with @mike.j.cusack, there should be a way to have access to Clojure-lsp completions ignoring nrepl or the nrepl ones not affecting the LSP ones

❤️ 1
pez 2025-10-15T19:14:50.965069Z

We try to be a bit restrictive with settings in Calva. It adds maintenance so needs to be really worth it. And to me it doesn’t make sense to not see repl completions. I’m not sure all those are even from the repl, so there may be some filtering that can be done. I think support for namespaces maps is best solved at the nrepl side of things.

ericdallo 2025-10-15T19:19:50.989089Z

@pez but cider-nrepl doesn't seem to support completion of #:db{:ind| } and many other that are LSP features like completion of destructured args... I believe it's user choice to use one or other

pez 2025-10-15T19:25:48.243259Z

I don’t believe it is. 😃 But maybe something can be done with how things are merged, I haven’t had a look at it for a while.

ericdallo 2025-10-15T19:30:24.122169Z

Well, we support choosing definition provider, format provider and others that are features that both repl and LSP may provide and user can configure to use one or other, it would be weird only the completion feature do not follow that IMO

🎯 1
seancorfield 2025-10-15T19:57:31.806429Z

Does that mean that you'd get different behavior for #:db{:ind| } depending on whether you have Calva configured as lsp,repl vs repl,lsp? @pez

ericdallo 2025-10-15T19:58:53.266369Z

AFAICS from this issue, yes, I wouldn't expect merge to affect LSP results, but it seems it's affecting

pez 2025-10-15T21:13:08.221979Z

@seancorfield no. The priority setting is about definitions, and do not affect completions.

👍🏻 1
mikejcusack 2025-10-16T06:44:11.692569Z

> And to me it doesn’t make sense to not see repl completions. Why would there need to be both? To me the completions would be better from the LSP if using the LSP because REPL completions will only work for code that has been evaluated by the REPL, whereas the LSP uses static analysis and would be able to complete anything that has been saved in the buffers without needing to send to REPL.

👍 1