calva icon indicating copy to clipboard operation
calva copied to clipboard

Breadcrumbs missing from babashka scripts without file extensions.

Open jeffp42ker opened this issue 3 years ago • 3 comments

We have a few babashka scripts without file extensions that begin with a shebang to indicate they're babashka scripts:

#!/usr/bin/env bb
; vim: ft=clojure
(load-file "common.bb")

The status bar indicates they are Clojure files. However, the breadcrumbs at the top of the file which lists the functions in the file etc do not appear.

Related slack thread: https://clojurians.slack.com/archives/CBE668G4R/p1661453621026229

jeffp42ker avatar Aug 25 '22 20:08 jeffp42ker

Thanks! As we've found out in the slack thread, this is related to clojure-lsp, or maybe to how Calva uses clojure-lsp. I tested with a file with this content:

#!/bin/bb

(ns my.app)

(defn ^:dev/before-load stop []
  (js/console.log "stop"))

(defn ^:dev/after-load start []
  (js/console.log "start"))

If the name of the file is app.cljs I find this in the log between Calva and the clojure-lsp server:

[Trace - 10:08:44 PM] Sending request 'textDocument/codeAction - (31)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/pez/Projects/tests/minimal-shadow-cljs/src/my/app.cljs"
    },
    "range": {
        "start": {
            "line": 0,
            "character": 0
        },
        "end": {
            "line": 0,
            "character": 0
        }
    },
    "context": {
        "diagnostics": [],
        "triggerKind": 2
    }
}


[Trace - 10:08:44 PM] Received response 'textDocument/documentHighlight - (30)' in 2ms.
Result: [
    {
        "range": {
            "start": {
                "line": 4,
                "character": 7
            },
            "end": {
                "line": 4,
                "character": 23
            }
        }
    }
]

Whereas I name it file, without any extension, VS Code identifies it as a Clojure file, but the client<->server log contains this:

[Trace - 10:07:51 PM] Sending request 'textDocument/documentHighlight - (28)'.
Params: {
    "textDocument": {
        "uri": "file:///Users/pez/Projects/tests/minimal-shadow-cljs/src/my/file"
    },
    "position": {
        "line": 8,
        "character": 22
    }
}


[Trace - 10:07:51 PM] Received response 'textDocument/documentHighlight - (28)' in 1ms.
Result: []

CC: @ericdallo

PEZ avatar Aug 25 '22 20:08 PEZ

I get this on emacs: 2022-08-25_17-39

maybe it's a clojure-lsp bug indeed

ericdallo avatar Aug 25 '22 20:08 ericdallo

@PEZ I confirmed it's a bug on clojure-lsp, please open a issue there

ericdallo avatar Aug 25 '22 20:08 ericdallo

I think this is fixed upstream.

PEZ avatar Apr 04 '24 18:04 PEZ